Re: Shouldn't 7r6.5 be the same as 7r65 * 0.1
Posted by
Nicolas Cellier-3 on
Jul 05, 2006; 5:29pm
URL: https://forum.world.st/Shouldn-t-7r6-5-be-the-same-as-7r65-0-1-tp51969p51970.html
Yes, 7r6.5e4 is equivalent to 7r65000.0
That is the natural behavior we would expect i think
To be more precise, however, the number on the right of exponent e is interpreted in base 10.
let us take another example:
7r6.5e12 is (6*7^0+5*7^-1) * 7^12 that is 6*7^12+5*7^11
it is not interpreted as (6*7^0+5*7^-1) * 7^ 7r12 that is 6*7^9+5*7^8
Nicolas
Klaus D. Witzel:
> 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)
> >
> >
> >
>
>
>
>
________________________________________________________________________
iFRANCE, exprimez-vous !
http://web.ifrance.com