The minimum range of the float datatype is 1E-37 to 1E+37. What is the maximum range of floats?
-
See the macros in http://www.gnu.org/software/libc/manual/html_node/Floating-Point-Parameters.html – Barmar Sep 02 '13 at 05:23
-
The ranges for floating point types are defined in [float.h](http://pubs.opengroup.org/onlinepubs/009695399/basedefs/float.h.html) – boleto Sep 02 '13 at 05:28
-
Have look [here][1] this may help you [1]: http://stackoverflow.com/questions/10108053/ranges-of-floating-point-datatype-in-c – Indra Yadav Sep 02 '13 at 05:29
4 Answers
As for the maximum of maximum floating types, the standard didn't specify them. What the standard specify is "the minimum of maximum".
C11 §5.2.4.2.2 Characteristics of floating types
<float.h>
Section 12 & 13The values given in the following list shall be replaced by constant expressions with implementation-defined values that are greater than or equal to those shown: — maximum representable finite floating-point number, (1 − b−p)bemax
FLT_MAX 1E+37
DBL_MAX 1E+37
LDBL_MAX 1E+37
FLT_MIN 1E-37
DBL_MIN 1E-37
LDBL_MIN 1E-37

- 119,891
- 44
- 235
- 294
The maximum range, and the range on all real-world implementations that matter, is -INFINITY
to +INFINITY
. One place it actually comes into play that the "range of representable values: for float
includes the infinities (on implementations that support infinities) is that it's a constraint violation for a constant expression to be outside the range of values for its type, but that even something like 1e9999999999999999999999999999
is within the range of values for IEEE single-precision float, since the range is -INFINITY
to +INFINITY
. There's a defect report/interpretation detailing this issue somewhere, but I don't have the link handy.

- 208,859
- 35
- 376
- 711
-
+1 This answer makes me wonder about all the implementations, somewhere, that have the same bug as described in http://blog.frama-c.com/index.php?post/2012/11/19/Funny-floating-point-bugs-in-Frama-C-Oxygen-s-front-end . The mind boggles. – Pascal Cuoq Sep 02 '13 at 20:31
There is no general maximum range. The C standard only specifies which range has to be covered at least. A compiler can support any greater range.
There is however a standard for floating types, IEEE 754, specifying the behavior of floating point platforms in detail. This standard is usually applied.
According to that standard, the values are 1.4E-45 and 3.4E38.

- 15,657
- 5
- 63
- 75
There is no maximum range. An implementation is allowed to be arbitrarily generous. The only restrictions placed on floating point implementations are that:
The set of possible values of
float
is a subset of the set of possible values ofdouble
;The set of possible values of
double
is a subset of the set of possible values oflong double
;The set of all possible values of
float
(and thusdouble
andlong double
) must include at least one finite number ≥ 1E37 and one finite number ≤ -1E37;The set of all possible values of
float
(and thusdouble
andlong double
) must include at least one positive number ≤ 1E-37 which is not zero;The set of all possible values of
float
must include at least one positive number ≤ 1.0 + 1.0E-5 which is greater than 1.0; while the set of all possible values ofdouble
(and thuslong double
) must include at least one positive number ≤ 1.0 + 1.0E-9 which is greater than 1.0.
The last requirement does not strictly require double
to be more precise than float
since float
could also include the same value.
However, an implementation may define the macro __STDC_IEC_559__
. If it does, it needs to promise to implement the IEC-60559 standard (which is, in effect, IEEE-754); this commitment includes requiring float
to be precisely the IEC-60559 single precision (32-bit) format, and double
to be precisely the IEC-60559 double precision (64-bit) format. long double
is not required to be an IEC-60559 format, but it must, as above, be a superset of double
(or exactly the same type).

- 234,347
- 28
- 237
- 341