Float equality? (was: [BUG] Float NaN's)

Jarvis, Robert P. (Bob) (Contingent) bob.jarvis at timken.com
Fri Sep 17 14:11:38 UTC 2004


> Quoth Lex Spoon [mailto:lex at cc.gatech.edu] :
> "Richard A. O'Keefe" <ok at cs.otago.ac.nz> wrote:
> > Many financial calculations *MAY* be done safely using 
> floating point.
> 
> Yes, but of course you need to count in cents, shillings, ore, or
> whatnot, which defeats the purpose most people have of using floating
> point to begin with: to get free support for things after the decimal
> point.
> 
> So, I think you would agree that people doing financial calculations
> should still default to using integers, even if their language has
> floating point numbers just begging to be used.  Such people *can* use
> floating point, but it is unlikely to help them, and it has gotchas
> involved.

I just remembered that many times banking calculations in the U.S. are
carried down to the 1/100th of a cent, i.e. 4 decimal places if the units
are dollars.  This makes it much easier to run out of precision.

> "Jarvis, Robert P. (Bob) (Contingent)" <bob.jarvis at timken.com> wrote:
> > Thank you!  Great paper.  Google found several references, including
> > 
> > 	http://docs.sun.com/source/806-3568/ncg_goldberg.html
> 	
> It is cool, and I'm reading it, but at a glance it leaves out the most
> important material: what a *programmer* should know about floating
> point.  For example, when should you use it?  And what gotchas are
> there?

Sounds like a great subject for a paper.

Bob Jarvis
Compuware @ Timken

-----------------------------------------
**********************************************************************
PLEASE NOTE: The above email address has recently changed from a previous
naming standard -- if this does not match your records, please update them
to use this new name in future email addressed to this individual.    This
message and any attachments are intended for the   individual or entity
named above. If you are not the intended  recipient, please do not forward,
copy, print, use or disclose this   communication to others; also please
notify the sender by   replying to this message, and then delete it from
your system.     The Timken Company
**********************************************************************




More information about the Squeak-dev mailing list