Does the Standard specify any minimum range or minimum
precision for the float, double and long double. I haven't
found anything in the Standard about it.
> Does the Standard specify any minimum range or minimum[color=blue]
> precision for the float, double and long double. I haven't
> found anything in the Standard about it.[/color]
Yes: Float must offer at least the equivalent of 6 decimal digits of
precision; double and long double must offer at least the equivalent of 10
digits.
In practice, virtually all implementations use the machine's native
floating-point types; on most machines today those offer approximately 6
digits for float and 16 digits for double. Implementations are less
consistent for long double, but double is good enough for most applications
anyway.
"Andrew Koenig"[color=blue]
> In practice, virtually all implementations use the machine's native
> floating-point types; on most machines today those offer approximately 6
> digits for float and 16 digits for double.[/color]
Borland C++ documents have always stated 7 for float and 15 for double.
On Sat, 07 Aug 2004 20:14:05 GMT, JKop <NULL@NULL.NULL > wrote in
comp.lang.c++:
[color=blue]
>
> Does the Standard specify any minimum range or minimum
> precision for the float, double and long double. I haven't
> found anything in the Standard about it.
>
> -JKop[/color]
This is one of those cases where the C++ standard adopts the
requirements of the C standard without repeating the text.
Section 5.2.4.2 Numerical limits spells out the minimum ranges for all
integer and floating point types, and minimum precision and several
other important factors for the floating point types. An
implementation, C or C++, is required to document its implementation.
The section number is the same in both the older version of the C
standard which the C++ standard includes, and the current C standard.
Jack Klein posted:
[color=blue]
> This is one of those cases where the C++ standard adopts the
> requirements of the C standard without repeating the text.
>
> Section 5.2.4.2 Numerical limits spells out the minimum ranges for all
> integer and floating point types, and minimum precision and several
> other important factors for the floating point types. An
> implementation, C or C++, is required to document its implementation.
>
> The section number is the same in both the older version of the C
> standard which the C++ standard includes, and the current C standard.[/color]
Great! Now all I need is the C Standard. What ever happened to self-
sufficency, self-containment?
Comment