[vwnc] [gemstone-smalltalk] Re: Further on ScaledDecimal ...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] [gemstone-smalltalk] Re: Further on ScaledDecimal ...

Dennis smith-4
You might also look at the Java specs for "Decimal" type.
By default a Decimal variable has 2 decimal places (nice for accounting),
but retains 5 places of precision for intermediate operations.

You can then round or truncate as you please and when you please.

You can of course change the specs by
    Decimal varName (10,3)
which is 3 decimals, 10 precision.

This is basically what VW provides (and GS currently), its just extended to
more precision -- and is likely faster since it can bypass the
round/truncate.



Dennis Smith wrote:

> Wait -- thinking about Integers ...
>
> If  3 // 2  ==  1
> Why not
>    3s // 2s == 1s  (truncated)
> or
>    1.00s // 3s == 0.33s
>
> In other words, given that the only real way a FixedPoint (ScaledDecimal)
> can not be truncated is on division (since multiplication adds the
> scales) then
> why a new type when // does what you are talking about??
>

--
Dennis Smith                         +1 416.798.7948
Cherniak Software Development Corporation   Fax: +1 416.798.0948
509-2001 Sheppard Avenue East        [hidden email]
Toronto, ON M2J 4Z8              sip:[hidden email]
Canada         http://www.CherniakSoftware.com
Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc