HUGE_VALF, HUGE_VAL, HUGE_VALL
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) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Factor operations | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Interpolations | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Saturation arithmetic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Generic numeric operations | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Nearest integer floating point operations | |||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
Floating point manipulation functions | |||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
Classification and comparison | |||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||
Types | |||||||||||||||||||||||||||||||||||||||||
Macro constants | |||||||||||||||||||||||||||||||||||||||||
|
|
Defined in header <cmath>
|
||
#define HUGE_VALF /* implementation defined */ |
(since C++11) | |
#define HUGE_VAL /* implementation defined */ |
||
#define HUGE_VALL /* implementation defined */ |
(since C++11) | |
The macros 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
Constant | Explanation |
HUGE_VALF
|
Expands to positive float expression that indicates overflow |
HUGE_VAL
|
Expands to positive double expression that indicates overflow, not necessarily representable as a float |
HUGE_VALL
|
Expands to positive long double expression that indicates overflow, not necessarily representable as a float or double |
On implementations that support floating-point infinities, these macros always expand to the positive infinities of float, double, and long double
Notes
On implementations that do not support floating-point infinities, these macros expand to the maximum finite number of their respective types.
C++98 added float and long double overloads of mathematical functions. There is a problem that the float overloads cannot return HUGE_VAL to indicate overflow because this macro is not guaranteed to be representable as a float
LWG issue 357 was raised to target this problem. LWG found that C99 has the same problem (float and long double overloads were also added in C99), and C99 introduced new macros HUGE_VALF and HUGE_VALL
See also
(C++11)
|
evaluates to positive infinity or the value guaranteed to overflow a float (macro constant) |
C documentation for HUGE_VAL
|