[Seaside-dev] Troubles with WANumberPrinter>>printFloat:on:
Michael Lucas-Smith
mlucas-smith at cincom.com
Thu Jun 4 19:31:23 UTC 2009
Lukas Renggli wrote:
>> It solves all but two:
>>
>> WAPrinterTest>>testFloatPrinter fails doing
>> self assert: (convert print: 0.99) = '0.99'
>>
>> The resulting output is '0.98'
>>
>
> Bummer.
>
Here's a detailed breakdown of the exection path. Perhaps you'll see
something that surprises you.
printFloat: aNumber on: aStream
aNumber -> 0.99
"sign" (-1** 0) *
"mantissa" (2r1111110101110000101001 * (2** -21)) *
"exponent" (2** -1)
multiplier := base raisedTo: precision -> 100
fraction := accuracy ifNil: [1.0 / multiplier] -> 0.01
"sign" (-1** 0) *
"mantissa" (2r10100011110101110000101 * (2** -22)) *
"exponent" (2** -7)
rounded := aNumber roundTo: fraction -> 0.99
"sign" (-1** 0) *
"mantissa" (2r111111010111000010100011 * (2** -23)) *
"exponent" (2** -1)
<snip>
(rounded fractionPart -> 0.99
"sign" (-1** 0) *
"mantissa" (2r111111010111000010100011 * (2** -23)) *
"exponent" (2** -1)
abs roundTo: fraction) -> 0.99
"sign" (-1** 0) *
"mantissa" (2r111111010111000010100011 * (2** -23)) *
"exponent" (2** -1)
* multiplier -> 99.0
"sign" (-1** 0) *
"mantissa" (2r110001011111111111111111 * (2** -23)) *
"exponent" (2** 6)
More information about the seaside-dev
mailing list