Namespaces
Variants

isinf

From cppreference.net
< c ‎ | numeric ‎ | math
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99) (C99) (C99) (C23)
Maximum/minimum operations
Exponential functions
Power functions
Trigonometric and hyperbolic functions
Nearest integer floating-point
(C99) (C99) (C99)
(C23) (C23) (C23) (C23)
Floating-point manipulation
Narrowing operations
(C23)
(C23)
(C23)
(C23)
(C23)
(C23)
Quantum and quantum exponent
Decimal re-encoding functions
Total order and payload functions
Classification
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Types
Macro constants
Special floating-point values
Arguments and return values
Error handling
Fast operation indicators
헤더 파일에 정의됨 <math.h>
#define isinf(arg) /* implementation defined */
(C99부터)

주어진 부동 소수점 숫자 arg 가 양의 무한대 또는 음의 무한대인지 판단합니다. 매크로는 정수 값을 반환합니다.

FLT_EVAL_METHOD 는 무시됩니다: 인수가 해당 타입보다 더 넓은 범위와 정밀도로 평가되더라도, 먼저 해당 의미론적 타입으로 변환된 후 분류가 그 타입을 기반으로 수행됩니다.

목차

매개변수

arg - 부동소수점 값

반환값

arg 가 무한한 값을 가지면 0이 아닌 정수 값, 0 그렇지 않으면.

예제

#include <stdio.h>
#include <math.h>
#include <float.h>
int main(void)
{
    printf("isinf(NAN)         = %d\n", isinf(NAN));
    printf("isinf(INFINITY)    = %d\n", isinf(INFINITY));
    printf("isinf(0.0)         = %d\n", isinf(0.0));
    printf("isinf(DBL_MIN/2.0) = %d\n", isinf(DBL_MIN/2.0));
    printf("isinf(1.0)         = %d\n", isinf(1.0));
    printf("isinf(exp(800))    = %d\n", isinf(exp(800)));
}

가능한 출력:

isinf(NAN)         = 0
isinf(INFINITY)    = 1
isinf(0.0)         = 0
isinf(DBL_MIN/2.0) = 0
isinf(1.0)         = 0
isinf(exp(800))    = 1

참고문헌

  • C17 표준 (ISO/IEC 9899:2018):
  • 7.12.3.3 The isinf 매크로 (p: 172)
  • C11 표준 (ISO/IEC 9899:2011):
  • 7.12.3.3 The isinf 매크로 (p: 236)
  • C99 표준 (ISO/IEC 9899:1999):
  • 7.12.3.3 The isinf 매크로 (p: 217)

참고 항목

주어진 부동소수점 값을 분류합니다
(함수 매크로)
주어진 숫자가 유한한 값인지 확인합니다
(함수 매크로)
(C99)
주어진 숫자가 NaN인지 확인합니다
(함수 매크로)
주어진 숫자가 정규(normal)인지 확인합니다
(함수 매크로)