1*404b540aSrobert /* Copyright (C) 2002 Free Software Foundation, Inc. 2*404b540aSrobert 3*404b540aSrobert This file is part of GCC. 4*404b540aSrobert 5*404b540aSrobert GCC is free software; you can redistribute it and/or modify 6*404b540aSrobert it under the terms of the GNU General Public License as published by 7*404b540aSrobert the Free Software Foundation; either version 2, or (at your option) 8*404b540aSrobert any later version. 9*404b540aSrobert 10*404b540aSrobert GCC is distributed in the hope that it will be useful, 11*404b540aSrobert but WITHOUT ANY WARRANTY; without even the implied warranty of 12*404b540aSrobert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*404b540aSrobert GNU General Public License for more details. 14*404b540aSrobert 15*404b540aSrobert You should have received a copy of the GNU General Public License 16*404b540aSrobert along with GCC; see the file COPYING. If not, write to 17*404b540aSrobert the Free Software Foundation, 51 Franklin Street, Fifth Floor, 18*404b540aSrobert Boston, MA 02110-1301, USA. */ 19*404b540aSrobert 20*404b540aSrobert /* As a special exception, if you include this header file into source 21*404b540aSrobert files compiled by GCC, this header file does not by itself cause 22*404b540aSrobert the resulting executable to be covered by the GNU General Public 23*404b540aSrobert License. This exception does not however invalidate any other 24*404b540aSrobert reasons why the executable file might be covered by the GNU General 25*404b540aSrobert Public License. */ 26*404b540aSrobert 27*404b540aSrobert /* 28*404b540aSrobert * ISO C Standard: 5.2.4.2.2 Characteristics of floating types <float.h> 29*404b540aSrobert */ 30*404b540aSrobert 31*404b540aSrobert #ifndef _FLOAT_H___ 32*404b540aSrobert #define _FLOAT_H___ 33*404b540aSrobert 34*404b540aSrobert /* Radix of exponent representation, b. */ 35*404b540aSrobert #undef FLT_RADIX 36*404b540aSrobert #define FLT_RADIX __FLT_RADIX__ 37*404b540aSrobert 38*404b540aSrobert /* Number of base-FLT_RADIX digits in the significand, p. */ 39*404b540aSrobert #undef FLT_MANT_DIG 40*404b540aSrobert #undef DBL_MANT_DIG 41*404b540aSrobert #undef LDBL_MANT_DIG 42*404b540aSrobert #define FLT_MANT_DIG __FLT_MANT_DIG__ 43*404b540aSrobert #define DBL_MANT_DIG __DBL_MANT_DIG__ 44*404b540aSrobert #define LDBL_MANT_DIG __LDBL_MANT_DIG__ 45*404b540aSrobert 46*404b540aSrobert /* Number of decimal digits, q, such that any floating-point number with q 47*404b540aSrobert decimal digits can be rounded into a floating-point number with p radix b 48*404b540aSrobert digits and back again without change to the q decimal digits, 49*404b540aSrobert 50*404b540aSrobert p * log10(b) if b is a power of 10 51*404b540aSrobert floor((p - 1) * log10(b)) otherwise 52*404b540aSrobert */ 53*404b540aSrobert #undef FLT_DIG 54*404b540aSrobert #undef DBL_DIG 55*404b540aSrobert #undef LDBL_DIG 56*404b540aSrobert #define FLT_DIG __FLT_DIG__ 57*404b540aSrobert #define DBL_DIG __DBL_DIG__ 58*404b540aSrobert #define LDBL_DIG __LDBL_DIG__ 59*404b540aSrobert 60*404b540aSrobert /* Minimum int x such that FLT_RADIX**(x-1) is a normalized float, emin */ 61*404b540aSrobert #undef FLT_MIN_EXP 62*404b540aSrobert #undef DBL_MIN_EXP 63*404b540aSrobert #undef LDBL_MIN_EXP 64*404b540aSrobert #define FLT_MIN_EXP __FLT_MIN_EXP__ 65*404b540aSrobert #define DBL_MIN_EXP __DBL_MIN_EXP__ 66*404b540aSrobert #define LDBL_MIN_EXP __LDBL_MIN_EXP__ 67*404b540aSrobert 68*404b540aSrobert /* Minimum negative integer such that 10 raised to that power is in the 69*404b540aSrobert range of normalized floating-point numbers, 70*404b540aSrobert 71*404b540aSrobert ceil(log10(b) * (emin - 1)) 72*404b540aSrobert */ 73*404b540aSrobert #undef FLT_MIN_10_EXP 74*404b540aSrobert #undef DBL_MIN_10_EXP 75*404b540aSrobert #undef LDBL_MIN_10_EXP 76*404b540aSrobert #define FLT_MIN_10_EXP __FLT_MIN_10_EXP__ 77*404b540aSrobert #define DBL_MIN_10_EXP __DBL_MIN_10_EXP__ 78*404b540aSrobert #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ 79*404b540aSrobert 80*404b540aSrobert /* Maximum int x such that FLT_RADIX**(x-1) is a representable float, emax. */ 81*404b540aSrobert #undef FLT_MAX_EXP 82*404b540aSrobert #undef DBL_MAX_EXP 83*404b540aSrobert #undef LDBL_MAX_EXP 84*404b540aSrobert #define FLT_MAX_EXP __FLT_MAX_EXP__ 85*404b540aSrobert #define DBL_MAX_EXP __DBL_MAX_EXP__ 86*404b540aSrobert #define LDBL_MAX_EXP __LDBL_MAX_EXP__ 87*404b540aSrobert 88*404b540aSrobert /* Maximum integer such that 10 raised to that power is in the range of 89*404b540aSrobert representable finite floating-point numbers, 90*404b540aSrobert 91*404b540aSrobert floor(log10((1 - b**-p) * b**emax)) 92*404b540aSrobert */ 93*404b540aSrobert #undef FLT_MAX_10_EXP 94*404b540aSrobert #undef DBL_MAX_10_EXP 95*404b540aSrobert #undef LDBL_MAX_10_EXP 96*404b540aSrobert #define FLT_MAX_10_EXP __FLT_MAX_10_EXP__ 97*404b540aSrobert #define DBL_MAX_10_EXP __DBL_MAX_10_EXP__ 98*404b540aSrobert #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ 99*404b540aSrobert 100*404b540aSrobert /* Maximum representable finite floating-point number, 101*404b540aSrobert 102*404b540aSrobert (1 - b**-p) * b**emax 103*404b540aSrobert */ 104*404b540aSrobert #undef FLT_MAX 105*404b540aSrobert #undef DBL_MAX 106*404b540aSrobert #undef LDBL_MAX 107*404b540aSrobert #define FLT_MAX __FLT_MAX__ 108*404b540aSrobert #define DBL_MAX __DBL_MAX__ 109*404b540aSrobert #define LDBL_MAX __LDBL_MAX__ 110*404b540aSrobert 111*404b540aSrobert /* The difference between 1 and the least value greater than 1 that is 112*404b540aSrobert representable in the given floating point type, b**1-p. */ 113*404b540aSrobert #undef FLT_EPSILON 114*404b540aSrobert #undef DBL_EPSILON 115*404b540aSrobert #undef LDBL_EPSILON 116*404b540aSrobert #define FLT_EPSILON __FLT_EPSILON__ 117*404b540aSrobert #define DBL_EPSILON __DBL_EPSILON__ 118*404b540aSrobert #define LDBL_EPSILON __LDBL_EPSILON__ 119*404b540aSrobert 120*404b540aSrobert /* Minimum normalized positive floating-point number, b**(emin - 1). */ 121*404b540aSrobert #undef FLT_MIN 122*404b540aSrobert #undef DBL_MIN 123*404b540aSrobert #undef LDBL_MIN 124*404b540aSrobert #define FLT_MIN __FLT_MIN__ 125*404b540aSrobert #define DBL_MIN __DBL_MIN__ 126*404b540aSrobert #define LDBL_MIN __LDBL_MIN__ 127*404b540aSrobert 128*404b540aSrobert /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown. */ 129*404b540aSrobert /* ??? This is supposed to change with calls to fesetround in <fenv.h>. */ 130*404b540aSrobert #undef FLT_ROUNDS 131*404b540aSrobert #define FLT_ROUNDS 1 132*404b540aSrobert 133*404b540aSrobert #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 134*404b540aSrobert /* The floating-point expression evaluation method. 135*404b540aSrobert -1 indeterminate 136*404b540aSrobert 0 evaluate all operations and constants just to the range and 137*404b540aSrobert precision of the type 138*404b540aSrobert 1 evaluate operations and constants of type float and double 139*404b540aSrobert to the range and precision of the double type, evaluate 140*404b540aSrobert long double operations and constants to the range and 141*404b540aSrobert precision of the long double type 142*404b540aSrobert 2 evaluate all operations and constants to the range and 143*404b540aSrobert precision of the long double type 144*404b540aSrobert 145*404b540aSrobert ??? This ought to change with the setting of the fp control word; 146*404b540aSrobert the value provided by the compiler assumes the widest setting. */ 147*404b540aSrobert #undef FLT_EVAL_METHOD 148*404b540aSrobert #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ 149*404b540aSrobert 150*404b540aSrobert /* Number of decimal digits, n, such that any floating-point number in the 151*404b540aSrobert widest supported floating type with pmax radix b digits can be rounded 152*404b540aSrobert to a floating-point number with n decimal digits and back again without 153*404b540aSrobert change to the value, 154*404b540aSrobert 155*404b540aSrobert pmax * log10(b) if b is a power of 10 156*404b540aSrobert ceil(1 + pmax * log10(b)) otherwise 157*404b540aSrobert */ 158*404b540aSrobert #undef DECIMAL_DIG 159*404b540aSrobert #define DECIMAL_DIG __DECIMAL_DIG__ 160*404b540aSrobert 161*404b540aSrobert #endif /* C99 */ 162*404b540aSrobert #endif /* _FLOAT_H___ */ 163