float equality

Jonathan M Davis jmdavisProg at gmx.com
Sat Feb 19 21:17:08 PST 2011


On Saturday 19 February 2011 20:46:50 Walter Bright wrote:
> bearophile wrote:
> > Walter:
> >> That'll just trade one set of problems for another.
> > 
> > But the second set of problems may be smaller :-)
> 
> There's a total lack of evidence for that. Furthermore,
> 
> 1. Roundoff error is not of a fixed magnitude.
> 
> 2. A user may choose to ignore roundoff errors, but that is not the
> prerogative of the language.
> 
> 3. What is an acceptable amount of roundoff error is not decidable by the
> language.
> 
> 4. At Boeing doing design work, I've seen what happens when engineers
> ignore roundoff errors. It ain't pretty. It ain't safe. It ain't correct.

Honestly, the more that I learn about and deal with floating point numbers, the 
more I wonder why we don't just use fixed point. Obviously that can be a bit 
limiting for the size of the number (on either side of the decimal) - 
particularly in 32-bit land - but with 64-bit numbers, it sounds increasingly 
reasonable given all of the issues with floating point values. Ideally, I 
suppose, you'd have both, but the CPU specifically supports floating point (I 
don't know about fixed point), and I don't think that I've ever used a language 
which really had fixed point values (unless you count integers as fixed point with 
no digits to the right of the decimal).

- Jonathan M Davis


More information about the Digitalmars-d mailing list