Re: Shouldn't 7r6.5 be the same as 7r65 * 0.1
Posted by
Klaus D. Witzel on
Jul 05, 2006; 5:05pm
URL: https://forum.world.st/Shouldn-t-7r6-5-be-the-same-as-7r65-0-1-tp51969p51972.html
Thank you Wolfgang (did you see the response from Ken).
But one thing remains: in 7r6.5e4 the exponent is also computed base 7,
contrary to the comment in NumberParsingTest>>#testFloatReadWithRadix.
/Klaus
On Tue, 04 Jul 2006 20:11:04 +0200, Wolfgang Helbig wrote:
> Klaus, you asked:
>> Would some good soul please explain what
>>
>> Number readFrom: '7r6.5'
>
> And here is the good soul's answer:
>
> 7r6.5 = 6*7^0 + 5 * 7^(-1) = 6 + 5/7 = 6.714285714285... with the last
> 6 digits repeating at infinitum.
>
> Whereas 7r65 * 0.1 should evaluate to
> 7r65 * 0.1 = (6*7^1 + 5*7^0) * 10^-1 = (6*7 + 5) / 10 = 4.7
>
> (Notation: "^" is the exponentation operator, like 3^2 = 3 * 3 = 9).
>
> Greetings,
> Wolfgang
>
> --
> "Dijkstra is right, but you don't say such things!"
> (A less courageous programmer)
>
>
>