[REBOL] Re: to-integer problem
From: joel:neely:fedex at: 16-Apr-2003 7:24
Hi, Will,
Will Arp wrote:
> Hi all 8)
>
> >>to-integer (1.14 * 100)
> == 113
>
> Is this a bug or am I missing something?
>
>> to-integer (1.14 * 100)
== 113
>> (1.14 * 100)
== 114
>> (1.14 * 100) - 114
== -1.4210854715202E-14
>> (1.14 * 100) - to-integer(1.14 * 100)
== 0.999999999999986
Two issues:
1) rounding error in decimal-binary/binary-decimal conversion,
2) assumptions made in the floating-point-to-string conversion
about how much difference was worth bringing to the user's
attention.
--
Polonius: ... What do you read, my lord?
Hamlet: Words, words, words.
_Hamlet_, Act II, Scene 2