HUGE_VALF, HUGE_VAL, HUGE_VALL

Header: <math.h>

The HUGE_VALF, HUGE_VAL and HUGE_VALL macros expand to positive floating-point constant expressions which compare equal to the values returned by floating-point functions and operators in case of overflow (see math_errhandling).

# Declarations

#define HUGE_VALF /*implementation defined*/

(since C99)

#define HUGE_VAL /*implementation defined*/
#define HUGE_VALL /*implementation defined*/

(since C99)

# Example

#include <math.h>
#include <stdio.h>
 
int main(void)
{
    const double result = 1.0 / 0.0;
    printf("1.0/0.0 == %f\n", result);
    if (result == HUGE_VAL)
        puts("1.0/0.0 == HUGE_VAL");
}

# See also