By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,750 Members | 1,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,750 IT Pros & Developers. It's quick & easy.

float, double, long double

P: n/a

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
Jul 22 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
> 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.


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.
Jul 22 '05 #2

P: n/a

"Andrew Koenig"
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.


Borland C++ documents have always stated 7 for float and 15 for double.

Fraser.
Jul 22 '05 #3

P: n/a
On Sat, 07 Aug 2004 20:14:05 GMT, JKop <NU**@NULL.NULL> wrote in
comp.lang.c++:

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


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
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Jul 22 '05 #4

P: n/a
Jack Klein posted:
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.

Great! Now all I need is the C Standard. What ever happened to self-
sufficency, self-containment?
-JKop
Jul 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.