<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le lun. 10 juin 2019 à 17:33, Bernhard Pieber <<a href="mailto:bernhard@pieber.com">bernhard@pieber.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
For my accounting I like to use ScaledDecimal, knowing it is just a fraction with a scale.<br>
<br>
I just stumbled upon the following:<br>
0.1s * 0.5s. "0.0s1"<br>
<br>
The underlying fraction is correct (1/20). However, the scale is 1, which surprised me. Shouldn't the scale be 2?<br>
<br></blockquote><div>Maybe... But then what scale to use for division?</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
In VA Smalltalk which I use for accounting as well the multiplication results in 0.05s2, which I had expected. (It prints as 0.05, though.)<br>
<br>
Fraction>>#asScaledDecimal even has the needed code:<br>
"Convert the receiver to a ScaledDecimal.<br>
        If there is a finite decimal representation of the receiver, then use the exact number of decimal places required.<br>
        Else, use a default number of decimals."<br>
<br>
(1/20) asScaledDecimal. "0.05s2"<br>
<br>
Some other strangeness:<br>
3s scale. "0"<br>
3 asScaledDecimal scale. "0"<br>
3s asScaledDecimal scale. "8"<br>
<br>
ScaledDecimal>>#asScaledDecimal should probably just return self.<br>
<br></blockquote><div>+1</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
What do you think?<br>
<br>
- Bernhard<br>
<br>
<br>
<br>
</blockquote></div></div>