Chris Calloway wrote:
> wormwood_3 wrote:
>
>> The second case is, of course, what is throwing me. By having a decimal
>> point, "1.1" is a float type, and apparently it cannot be represented by
>> binary floating point numbers accurately. I must admit that I do not
>> understand why this is the case. Would anyone be able to enlighten me?
>>
>
> This is fairly standard computer science, not just Python. If you take
> freshman Fortran for scientists, you will eat, sleep, and breath this stuff.
>
> Is one tenth any power of 2?
>
> Like how 2**-1 is 0.5? Or how 2**-2 is 0.25? Or 2**-3 is 0.125? Or 2**-4
> is 0.0625. Oops, we went right by 0.1.
>
> Any binary representation of one tenth will have a round-off error in
> the mantissa.
>
I've always wondered:
There are numbers in Decimal that can't be represented accurately in
Binary without infinite precision.
But it doesn't go the other way. Rational base-2 numbers are rational
base-10 numbers. I'm supposing this is because base-10 is a higher base
than base-2.
So I've wondered that, even though Pi is an irrational number in
base-10, is it possible that it's a simple (rational) number in a higher
base?
I mean, I suppose a base of Pi would result in Pi being 1, but what
about integer bases?
Is there some kind of theory that relates to this and why there's not a
higher base with an easy representation of Pi?
I'd be interested to read about this but I'm not sure what to look for.
-Luke
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor