More ANSI float.h stuff
Doug Gwyn
gwyn at smoke.BRL.MIL
Thu Jan 19 23:13:28 AEST 1989
In article <5198 at lynx.UUCP> m5 at lynx.UUCP (Mike McNally) writes:
>The <float.h> file of the ANSI library contains two constants, FLT_EPSILON
>and DBL_EPSILON. These are (according to K&R II) supposed to be the
>smallest x such that 1.0 + x != 1.0. ...
Funny, this question just came up a couple of days ago (perhaps in
comp.std.c). The actual wording in the proposed Standard is "the
difference between 1.0 and the least value greater than 1.0 that is
representable in the given floating point type" with the formula
for the floating point model given for clarification: b^(1-p).
>Seems to me that there is a difference, because intermediate results during
>expression evaluation may involve greater precision than available for
>storage of values.
Yes, that's permitted. The *_EPSILON constant applies to the
storage representation for the floating-point types, which is
often narrower than the representation used within a floating
point arithmetic register.
Reminder: This is my interpretation, not an official pronouncement.
More information about the Comp.lang.c
mailing list