std:: fpclassify
| Common mathematical functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Mathematical special functions (C++17) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Mathematical constants (C++20) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Basic linear algebra algorithms (C++26) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Data-parallel types (SIMD) (C++26) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Floating-point environment (C++11) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Complex numbers | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Numeric array (
valarray
)
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Pseudo-random number generation | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Bit manipulation (C++20) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Saturation arithmetic (C++26) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Factor operations | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Interpolations | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Generic numeric operations | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| C-style checked integer arithmetic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Nearest integer floating point operations | |||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Floating point manipulation functions | |||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Classification and comparison | |||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||
| Types | |||||||||||||||||||||||||||||||||||||||||
| Macro constants | |||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
헤더 파일에 정의됨
<cmath>
|
||
| (1) | ||
|
int
fpclassify
(
float
num
)
;
int
fpclassify
(
double
num
)
;
|
(C++11부터)
(C++23까지) |
|
|
constexpr
int
fpclassify
(
/* floating-point-type */
num
)
;
|
(C++23부터) | |
|
헤더 파일에 정의됨
<cmath>
|
||
|
template
<
class
Integer
>
int fpclassify ( Integer num ) ; |
(A) |
(C++11부터)
(C++23부터 constexpr) |
std::fpclassify
의 오버로드를 매개변수
num
의 타입으로서 모든 cv-한정자가 없는 부동 소수점 타입에 대해 제공합니다.
(C++23부터)
목차 |
매개변수
| num | - | 부동 소수점 또는 정수 값 |
반환값
다음 중 하나: FP_INFINITE , FP_NAN , FP_NORMAL , FP_SUBNORMAL , FP_ZERO 또는 구현에서 정의된 타입으로, num 의 범주를 지정합니다.
참고 사항
추가 오버로드는 반드시 (A) 와 정확히 동일하게 제공될 필요는 없습니다. 정수 타입의 인수 num 에 대해 std :: fpclassify ( num ) 가 std :: fpclassify ( static_cast < double > ( num ) ) 와 동일한 효과를 가지도록 보장하기에 충분하기만 하면 됩니다.
예제
#include <cfloat> #include <cmath> #include <iostream> auto show_classification(double x) { switch (std::fpclassify(x)) { case FP_INFINITE: return "Inf"; case FP_NAN: return "NaN"; case FP_NORMAL: return "normal"; case FP_SUBNORMAL: return "subnormal"; case FP_ZERO: return "zero"; default: return "unknown"; } } int main() { std::cout << "1.0/0.0 is " << show_classification(1 / 0.0) << '\n' << "0.0/0.0 is " << show_classification(0.0 / 0.0) << '\n' << "DBL_MIN/2 is " << show_classification(DBL_MIN / 2) << '\n' << "-0.0 is " << show_classification(-0.0) << '\n' << "1.0 is " << show_classification(1.0) << '\n'; }
출력:
1.0/0.0 is Inf 0.0/0.0 is NaN DBL_MIN/2 is subnormal -0.0 is zero 1.0 is normal
참고 항목
|
(C++11)
|
주어진 숫자가 유한한 값을 가지는지 검사합니다
(함수) |
|
(C++11)
|
주어진 숫자가 무한한지 검사합니다
(함수) |
|
(C++11)
|
주어진 숫자가 NaN인지 검사합니다
(함수) |
|
(C++11)
|
주어진 숫자가 정규화된 숫자인지 검사합니다
(함수) |
|
모든 기본 숫자 타입의 속성을 조회하기 위한 인터페이스를 제공합니다
(클래스 템플릿) |
|
|
C 문서
for
fpclassify
|
|