Mantis - Squeak
Viewing Issue Advanced Details
5693 Kernel minor always 01-02-07 13:38 01-06-07 03:32
robdavid  
 
normal  
new 3.9  
open  
none    
none  
0005693: ScaledDecimal printString truncates rather than rounds, giving some surprising results.
When a floating point number is converted to ScaledDecimal, rounding erros can cause printString can give odd results, eg.

(1.23 asScaledDecimal:2) printString

gives "1.22s2"

Is this really what it should be doing?
Questions over issue seem to have existed when ScaledDecimal was written; ScaledDecimalTest<<testPrintString contains the comment:

"The printed representation of a ScaledDecimal is truncated, not rounded.
Not sure if this is right, so this test describes the current Squeak implementation.
If someone knows a reason that rounding would be preferable, then update
this test."
related to 0006696assigned andreas ScaledDecimal can read in base 16 but cannot print in base 16 

Notes
(0008839)
nicolas cellier   
01-06-07 03:32   
For information, both VW and Dolphin do a rounded print.
didn't see much about printString in the standard... (http://wiki.squeak.org/squeak/uploads/172/standard_v1_9-indexed.pdf) [^]
except:

Answer a string that is a valid literal representation that approximates the numeric value of the
receiver.

Both rounding and truncating are compliant...