Thu May 12 15:35:49 CEST 2011
in much the same way asInteger does for a float.
Having said all of this allow me to contradict myself. It seems to me that
a scaled decimal should in general store more digits than are displayed.
For example money might be stored with a large (possibly arbitrary) number
of digits after the decimal point but only display two digits beyond the decimal
I don't know how ScaledDecimal is implemented but I would be inclined to
use arbitrary or large size integers and store the location of the decimal point
internally recomputing the position of the decimal point after each calculation.
This is an expensive way of doing computations but I expect users of
ScaledDecimal can live with that. When converting non decimal results to
ScaledDecimal then how many digits of precision to maintain must be specified
Dealing with ScaledDecimal is a complicated matter and I have probably failed
to appreciate many of the complications but whoever is implementing
(and Smalltalk needs ScaledDecimal) needs to appreciate those complications.
Anybody here a financial expert?
More information about the Pharo-project