Storing floats, etc in GOODS

Yar Hwee Boon hboon at motionobj.com
Sat Oct 23 06:26:41 UTC 2004


On Fri, 22 Oct 2004 13:41:44 -0400, Jarvis, Robert P. (Bob) (Contingent)  
<bob.jarvis at timken.com> wrote:

> value, is stored as 3.2000000000000002.  This is an example of why  
> putting
> monetary values in floating point variables is not a good idea.  Perhaps  
> you
> could use Fraction or ScaledDecimal if they are appropriate?

I'll probably wrap a currency class around Fraction or Integer as other  
the posts suggested. ScaledDecimal should be out, as John Pierce  
mentioned, the scale applies only to its display, not its actual value  
used in arithmetic.

John: I'll skip your changeset for now, not sure I'm comfortable doing a  
major change such as this as I'm still quite new to Squeak. Hopefully  
someone else will find it useful. Thanks.

-- 
Regards
HweeBoon
MotionObj



More information about the Squeak-dev mailing list