| | |
#define HUGE_VALF /* implementation defined */ | | (since C++11) |
#define HUGE_VAL /* implementation defined */ | | |
#define HUGE_VALL /* implementation defined */ | | (since C++11) |
| | |
The macrosHUGE_VALF,HUGE_VAL andHUGE_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 (seemath_errhandling).
Constant | Explanation |
HUGE_VALF | Expands to positivefloat expression that indicates overflow |
HUGE_VAL | Expands to positivedouble expression that indicates overflow, not necessarily representable as afloat |
HUGE_VALL | Expands to positivelongdouble expression that indicates overflow, not necessarily representable as afloat ordouble |
On implementations that support floating-point infinities, these macros always expand to the positive infinities offloat,double, andlongdouble, respectively.
On implementations that do not support floating-point infinities, these macros expand to the maximum finite number of their respective types.
C++98 addedfloat andlongdouble overloads of mathematical functions. There is a problem that thefloat overloads cannot returnHUGE_VAL to indicate overflow because this macro is not guaranteed to be representable as afloat.
LWG issue 357 was raised to target this problem. LWG found that C99 has the same problem (float andlongdouble overloads were also added in C99), and C99 introduced new macrosHUGE_VALF andHUGE_VALL to solve the problem. Therefore the issue was closed and the C99 resolution was adopted in C++11.
[edit]See also
| evaluates to positive infinity or the value guaranteed to overflow afloat (macro constant)[edit] |
|