Source for ASCII to FLOAT
Andrew Hume
andrew at alice.UUCP
Sat Jul 29 14:02:15 AEST 1989
it seems to me the discussion of an atof is going in th wrong
direction. it is nice to insist that 1.0 and 0.1e1 evaluate
to the same bit pattern but really what we want, at least what i want,
is an accurate atof. if you consider the real number line, the set
of possible values of double (or whatever precision) are just a bunch
of points on this line. then atof should return the closest such point
to the real represented by the string. (ties should
probably be broken systematically.)
in summary, get someone who really knows what is going on
(not me certainly) to figure it out; buggering around with
half-hearted hacks to preserve some precious bits of accuracy
is simply a waste of time, however well intentioned.
(sorry, my spleen needed venting.)
More information about the Comp.lang.c
mailing list