help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] roundTo:


From: J Pfersich
Subject: [Help-smalltalk] roundTo:
Date: Sat, 02 Dec 2006 15:28:07 -0700

st> -8 roundTo: 3 !
-6       ===============> incorrect, should be -9
st> 8 roundTo: 3 !
9        ===============>  correct
The ANSI definition is:

roundTo: factor
Answer the number nearest the receiver that is a multiple of factor.
As far as I can see these statements should be true:

-8 roundTo: 3 yields -9
8 roundTo: -3 yields 9
25 roundTo: -7 yields 28
-25 roundTo: 7 yields -28
-27 roundTo: 4 yields -28
27 roundTo: -4 yields 28
It doesn't now. Fixing roundTo: may break the uses in Point.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]