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

Jason Rogers jacaetevha at fast-mail.org
Tue Sep 14 13:53:21 UTC 2004


On Tue, 14 Sep 2004 10:45:13 -0700 (PDT), Chris Muller  
<afunkyobject at yahoo.com> wrote:
> If I want to write a financial application, should Floats be avoided?
> Fractions provide unlimited precision at a pretty severe performance  
> cost and
> Decimals appear to use an underlying Fraction too, not to mention there  
> are not
> many users of Decimal so its kind of a murky cloud for me.
>
> Any commentary is appreciated.

Sorry for the simplicity, but is #equals:considering: not an appropriate  
work-around (where 'considering' is an appropriate delta)?  For a app  
dealing with medications, the delta may end up being extremely small.  For  
financials it could be some reasonable amount of 0.005.

-- 
Jason Rogers

"I am crucified with Christ: nevertheless I live; yet not I,
but Christ liveth in me: and the life which I now live in
the flesh I live by the faith of the Son of God, who loved
me, and gave himself for me."
     Galatians 2:20



More information about the Squeak-dev mailing list