Namespaces
Variants

std:: isnormal

From cppreference.net
Common mathematical functions
Nearest integer floating point operations
(C++11)
(C++11)
(C++11) (C++11) (C++11)
Floating point manipulation functions
(C++11) (C++11)
(C++11)
(C++11)
Classification and comparison
(C++11)
(C++11)
(C++11)
(C++11)
isnormal
(C++11)
(C++11)
Types
(C++11)
(C++11)
(C++11)
Macro constants
헤더 파일에 정의됨 <cmath>
(1)
bool isnormal ( float num ) ;

bool isnormal ( double num ) ;

bool isnormal ( long double num ) ;
(C++11부터)
(C++23까지)
constexpr bool isnormal ( /*floating-point-type*/ num ) ;
(C++23부터)
SIMD 오버로드 (C++26부터)
헤더 파일에 정의됨 <simd>
template < /*math-floating-point*/ V >

constexpr typename /*deduced-simd-t*/ < V > :: mask_type

isnormal ( const V & v_num ) ;
(S) (C++26부터)
헤더 파일에 정의됨 <cmath>
template < class Integer >
bool isnormal ( Integer num ) ;
(A) (C++11부터)
(C++23부터 constexpr)
1) 주어진 부동 소수점 숫자 num 이 정상(normal)인지 확인합니다. 즉, 0, 서브노멀(subnormal), 무한대(infinite), NaN이 아닌 경우를 의미합니다. 라이브러리는 매개변수 num 의 타입으로 모든 cv-한정자가 없는 부동 소수점 타입에 대한 오버로드를 제공합니다. (C++23 이후)
S) SIMD 오버로드는 v_num 에 대해 요소별(element-wise) std::isnormal 을 수행합니다.
(정의는 math-floating-point deduced-simd-t 참조)
(C++26부터)
A) 추가적인 오버로드가 모든 정수 타입에 대해 제공되며, 이들은 double 로 처리됩니다.

목차

매개변수

num - 부동 소수점 또는 정수 값
v_num - 요소 타입이 부동 소수점 타입인 std::basic_simd 전문화의 데이터 병렬 객체

반환값

1) true 만약 num 이 정상이면, false 그렇지 않으면.
S) 데이터 병렬 마스크 객체로, 범위 [ 0 , v_num. size ( ) ) 내의 모든 i 에 대해 v_num [ i ] 가 정상일 때 i 번째 요소가 true 이고, 그렇지 않으면 false 인 객체입니다.

참고 사항

추가 오버로드는 반드시 (A) 와 정확히 동일하게 제공될 필요는 없습니다. 정수 타입의 인수 num 에 대해 std :: isnormal ( num ) std :: isnormal ( static_cast < double > ( num ) ) 와 동일한 효과를 가지도록 보장하기에 충분하기만 하면 됩니다.

예제

#include <cfloat>
#include <cmath>
#include <iostream>
int main()
{
    std::cout << std::boolalpha
              << "isnormal(NaN) = " << std::isnormal(NAN) << '\n'
              << "isnormal(Inf) = " << std::isnormal(INFINITY) << '\n'
              << "isnormal(0.0) = " << std::isnormal(0.0) << '\n'
              << "isnormal(DBL_MIN/2.0) = " << std::isnormal(DBL_MIN / 2.0) << '\n'
              << "isnormal(1.0) = " << std::isnormal(1.0) << '\n';
}

출력:

isnormal(NaN) = false
isnormal(Inf) = false
isnormal(0.0) = false
isnormal(DBL_MIN/2.0) = false
isnormal(1.0) = true

참고 항목

(C++11)
주어진 부동 소수점 값을 분류합니다
(함수)
(C++11)
주어진 숫자가 유한한 값을 가지는지 확인합니다
(함수)
(C++11)
주어진 숫자가 무한대인지 확인합니다
(함수)
(C++11)
주어진 숫자가 NaN인지 확인합니다
(함수)
C documentation for isnormal