a decimal class for Squeak?

Hans-Martin Mosner hm.mosner at cityweb.de
Mon Jan 4 20:50:33 UTC 1999


Adam Bridge wrote:

> Has anyone implimented a discrete decimal arithmetic class for Squeak?
> I'd sure like to steal it if you have!
>
> ab
>
> __
> Adam Bridge
> Idea Processing

You probably don't need a decimal arithmetic class. What you need is
decimal fractions, which are just a special case of the good old
Fractions found in every self-respecting Smalltalk. With these,
arithmetic using +, -, *, / is exact (which is probably what you're after
anyway).
You might want to implement a special number class which does the right
kind of displaying and denominator fudging.
Every single case of decimal arithmetic that I've seen (ok, it's just
one: VisualAge...) is unnecessarily complicated, slow and limited. Why
would you want to have that?
Back in the good old COBOL days, BCD number representation had a place
since programs were I/O dominated anyway. But nowadays it's just
nonsense.

Hans-Martin





More information about the Squeak-dev mailing list