Floating-Point Format Builtins (Using the GNU Compiler Collection (GCC)) (original) (raw)
7.2.1 Floating-Point Format Builtins ¶
Built-in Function: double
__builtin_huge_val (void)
¶
Returns a positive infinity, if supported by the floating-point format, else DBL_MAX
. This function is suitable for implementing the ISO C macro HUGE_VAL
.
Built-in Function: float
__builtin_huge_valf (void)
¶
Similar to __builtin_huge_val
, except the return type is float
.
Built-in Function: long double
__builtin_huge_vall (void)
¶
Similar to __builtin_huge_val
, except the return type is long double
.
Built-in Function: _Floatn
__builtin_huge_valfn (void)
¶
Similar to __builtin_huge_val
, except the return type is_Floatn
.
Built-in Function: _Floatnx
__builtin_huge_valfnx (void)
¶
Similar to __builtin_huge_val
, except the return type is_Floatnx
.
Built-in Function: int
__builtin_fpclassify (int, int, int, int, int, ...)
¶
This built-in implements the C99 fpclassify functionality. The first five int arguments should be the target library’s notion of the possible FP classes and are used for return values. They must be constant values and they must appear in this order: FP_NAN
,FP_INFINITE
, FP_NORMAL
, FP_SUBNORMAL
andFP_ZERO
. The ellipsis is for exactly one floating-point value to classify. GCC treats the last argument as type-generic, which means it does not do default promotion from float to double.
Built-in Function: double
__builtin_inf (void)
¶
Similar to __builtin_huge_val
, except a warning is generated if the target floating-point format does not support infinities.
Built-in Function: _Decimal32
__builtin_infd32 (void)
¶
Similar to __builtin_inf
, except the return type is _Decimal32
.
Built-in Function: _Decimal64
__builtin_infd64 (void)
¶
Similar to __builtin_inf
, except the return type is _Decimal64
.
Built-in Function: _Decimal128
__builtin_infd128 (void)
¶
Similar to __builtin_inf
, except the return type is _Decimal128
.
Built-in Function: float
__builtin_inff (void)
¶
Similar to __builtin_inf
, except the return type is float
. This function is suitable for implementing the ISO C99 macro INFINITY
.
Built-in Function: long double
__builtin_infl (void)
¶
Similar to __builtin_inf
, except the return type is long double
.
Built-in Function: _Floatn
__builtin_inffn (void)
¶
Similar to __builtin_inf
, except the return type is _Floatn
.
Built-in Function: _Floatn
__builtin_inffnx (void)
¶
Similar to __builtin_inf
, except the return type is _Floatnx
.
Built-in Function: int
__builtin_isinf_sign (...)
¶
Similar to isinf
, except the return value is -1 for an argument of -Inf
and 1 for an argument of +Inf
. Note while the parameter list is an ellipsis, this function only accepts exactly one floating-point argument. GCC treats this parameter as type-generic, which means it does not do default promotion from float to double.
Built-in Function: double
__builtin_nan (const char *str)
¶
This is an implementation of the ISO C99 function nan
.
Since ISO C99 defines this function in terms of strtod
, which we do not implement, a description of the parsing is in order. The string is parsed as by strtol
; that is, the base is recognized by leading ‘0’ or ‘0x’ prefixes. The number parsed is placed in the significand such that the least significant bit of the number is at the least significant bit of the significand. The number is truncated to fit the significand field provided. The significand is forced to be a quiet NaN.
This function, if given a string literal all of which would have been consumed by strtol
, is evaluated early enough that it is considered a compile-time constant.
Built-in Function: _Decimal32
__builtin_nand32 (const char *str)
¶
Similar to __builtin_nan
, except the return type is _Decimal32
.
Built-in Function: _Decimal64
__builtin_nand64 (const char *str)
¶
Similar to __builtin_nan
, except the return type is _Decimal64
.
Built-in Function: _Decimal128
__builtin_nand128 (const char *str)
¶
Similar to __builtin_nan
, except the return type is _Decimal128
.
Built-in Function: float
__builtin_nanf (const char *str)
¶
Similar to __builtin_nan
, except the return type is float
.
Built-in Function: long double
__builtin_nanl (const char *str)
¶
Similar to __builtin_nan
, except the return type is long double
.
Built-in Function: _Floatn
__builtin_nanfn (const char *str)
¶
Similar to __builtin_nan
, except the return type is_Floatn
.
Built-in Function: _Floatnx
__builtin_nanfnx (const char *str)
¶
Similar to __builtin_nan
, except the return type is_Floatnx
.
Built-in Function: double
__builtin_nans (const char *str)
¶
Similar to __builtin_nan
, except the significand is forced to be a signaling NaN. The nans
function is proposed byWG14 N965.
Built-in Function: _Decimal32
__builtin_nansd32 (const char *str)
¶
Similar to __builtin_nans
, except the return type is _Decimal32
.
Built-in Function: _Decimal64
__builtin_nansd64 (const char *str)
¶
Similar to __builtin_nans
, except the return type is _Decimal64
.
Built-in Function: _Decimal128
__builtin_nansd128 (const char *str)
¶
Similar to __builtin_nans
, except the return type is _Decimal128
.
Built-in Function: float
__builtin_nansf (const char *str)
¶
Similar to __builtin_nans
, except the return type is float
.
Built-in Function: long double
__builtin_nansl (const char *str)
¶
Similar to __builtin_nans
, except the return type is long double
.
Built-in Function: _Floatn
__builtin_nansfn (const char *str)
¶
Similar to __builtin_nans
, except the return type is_Floatn
.
Built-in Function: _Floatnx
__builtin_nansfnx (const char *str)
¶
Similar to __builtin_nans
, except the return type is_Floatnx
.
Built-in Function: int
__builtin_issignaling (...)
¶
Return non-zero if the argument is a signaling NaN and zero otherwise. Note while the parameter list is an ellipsis, this function only accepts exactly one floating-point argument. GCC treats this parameter as type-generic, which means it does not do default promotion from float to double. This built-in function can work even without the non-default-fsignaling-nans
option, although if a signaling NaN is computed, stored or passed as argument to some function other than this built-in in the current translation unit, it is safer to use -fsignaling-nans
. With -ffinite-math-only
option this built-in function will always return 0.
Built-in Function: double
__builtin_powi (double, int)
¶
Built-in Function: float
__builtin_powif (float, int)
¶
Built-in Function: long double
__builtin_powil (long double, int)
¶
Returns the first argument raised to the power of the second. Unlike thepow
function no guarantees about precision and rounding are made.