On Thu, Oct 20, 2011 at 03:45:40PM -0700, Fred Cisin wrote:
On Thu, 20 Oct 2011, David Cantrell wrote:
THAT is
already present. "float" in C means that it is an approximation
to 24 binary significant digits.
No, it tells you that it can *represent no more
than* 24 binary
significant digits.
float pi = 3.1f; /* close enough for government work */
that the *type* can have 24 significant binary digits doesn't mean
that the *data* has 24 significant binary digits.
I have to disagree.
float pi = 3.1f;
DOES, INDEED, give you 24 significant digts OF WHAT YOU FED IT.
What I'm getting at is that there's no widely understood datatype that
lets me say:
pi = 3.1 to two significant decimal digits;
and that it is foolish to assume that any float is accurate to 24
significant binary digits. The moment you, eg, multiply two floats
which are already approximations together, then you lose precision.
--
David Cantrell | Enforcer, South London Linguistic Massive
Irregular English:
ladies glow; gentlemen perspire; brutes, oafs and athletes sweat