float.h in C Language
The header file float.h
defines various macros related to the floating-point types float
, double
, and long double
, specifying their ranges and precision.
FLT_ROUNDS
This macro indicates the rounding direction used in floating-point addition. Its possible values are:- -1: Undetermined.
- 0: Round towards zero.
- 1: Round to the nearest integer.
- 2: Round towards positive infinity.
- 3: Round towards negative infinity.
FLT_RADIX
This macro represents the base of the exponent in scientific notation, which is generally 2.- Maximum Values of Floating-Point Types
FLT_MAX
DBL_MAX
LDBL_MAX
- Minimum Positive Values of Floating-Point Types
FLT_MIN
DBL_MIN
LDBL_MIN
- Smallest Difference Representable Between Two Floating-Point Values (Machine Precision)
FLT_EPSILON
DBL_EPSILON
LDBL_EPSILON
DECIMAL_DIG
This macro indicates the number of decimal digits that can be represented accurately.FLT_EVAL_METHOD
This macro specifies how floating-point expressions are evaluated regarding type conversion. Its possible values are:- -1: Undetermined.
- 0: Operations are performed in the current type.
- 1: Operations involving
float
anddouble
use the range and precision ofdouble
. - 2: All floating-point operations use the range and precision of
long double
.
- Number of Bits in the Mantissa
FLT_MANT_DIG
DBL_MANT_DIG
LDBL_MANT_DIG
- Number of Decimal Digits in the Exponent
FLT_DIG
DBL_DIG
LDBL_DIG
- Minimum Negative Exponent in Scientific Notation
FLT_MIN_EXP
DBL_MIN_EXP
LDBL_MIN_EXP
- Minimum Decimal Exponent in Scientific Notation (Negative)
FLT_MIN_10_EXP
DBL_MIN_10_EXP
LDBL_MIN_10_EXP
- Maximum Exponent in Scientific Notation
FLT_MAX_EXP
DBL_MAX_EXP
LDBL_MAX_EXP
- Maximum Decimal Exponent in Scientific Notation
FLT_MAX_10_EXP
DBL_MAX_10_EXP
LDBL_MAX_10_EXP
All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.