C/float.h

Материал из C\C++ эксперт
Версия от 15:16, 22 июня 2010; Admin (обсуждение | вклад)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

The header float.h in the C Standard Library for the C programming language contains macros that expand to various limits and parameters of the standard floating-point types.

The macros, as defined on ISO 9899:1999 section 5.2.4.2.2, are:

  • FLT_ROUNDS - indicates the rounding mode for floating-point addition, meaning:
  • -1 indeterminable;
  • 0 toward zero;
  • 1 to nearest;
  • 2 toward positive infinity;
  • 3 toward negative infinity;
  • other value means implementation-defined rounding behavior.
  • FLT_EVAL_METHOD - determines the evaluation formats of expressions involving all floating types:
  • -1 indeterminable;
  • 0 evaluate all operations and constants just to the precision of the type;
  • 1 evaluate operations and constants of type float and double to the range and precision of the double type;
  • 2 evaluate all operations and constants to the range and precision of the long double type;
  • other value means implementation-defined behavior.
  • FLT_RADIX - radix of exponent representation (at least 2).
  • FLT_MANT_DIG, DBL_MANT_DIG, LDBL_MANT_DIG - number of digits in the floating-point significand.
  • DECIMAL_DIG - (at least 10)
  • FLT_DIG, DBL_DIG, LDBL_DIG - (at least 6, 10, 10)
  • FLT_MIN_EXP, DBL_MIN_EXP, LDBL_MIN_EXP
  • FLT_MIN_10_EXP, DBL_MIN_10_EXP, LDBL_MIN_10_EXP, (at least -37)
  • FLT_MAX_EXP, DBL_MAX_EXP, LDBL_MAX_EXP
  • FLT_MAX_10_EXP, DBL_MAX_10_EXP, LDBL_MAX_10_EXP (at least +37)
  • FLT_MAX, DBL_MAX, LDBL_MAX - (at least 1E+37)
  • FLT_EPSILON, DBL_EPSILON, LDBL_EPSILON - (at least 1E-5, 1E-9, 1E-9)
  • FLT_MIN, DBL_MIN, LDBL_MIN - (at least 1E-37)