C++ Standard Library C++ STL Library

C++ <cmath> - HUGE_VAL, HUGE_VALF, HUGE_VALL



The HUGE_VAL, HUGE_VALF and HUGE_VALL macros expand to positive expression of type double, float and long double respectively.

A function returns this value when the result of a mathematical operation yields a value that is too large in magnitude to be representable with its return type. This is one of the possible range errors, and is signaled by setting errno to ERANGE.

Actually, functions may either return a positive or a negative HUGE_VAL (HUGE_VAL or -HUGE_VAL) to indicate the sign of the result for type double. Similarly, for type float, the functions may either return a positive or a negative HUGE_VALF (HUGE_VALF or -HUGE_VALF) to indicate the sign of the result. Lastly, the functions may either return a positive or a negative HUGE_VALL (HUGE_VALL or -HUGE_VALL) to indicate the sign of the result for type long double.

ConstantDescription
HUGE_VAL Expands to positive double expression that indicates overflow.
HUGE_VALF Expands to positive float expression that indicates overflow.
HUGE_VALL Expands to positive long double expression that indicates overflow.

❮ C++ <cmath> Library