Working with the set of real numbers (was: Finding size of Variable)
Albert van der Horst
albert at spenarnc.xs4all.nl
Wed Mar 5 03:15:14 CET 2014
In article <mailman.7687.1393902132.18130.python-list at python.org>,
Chris Angelico <rosuav at gmail.com> wrote:
>On Tue, Mar 4, 2014 at 1:45 PM, Albert van der Horst
><albert at spenarnc.xs4all.nl> wrote:
>>>No, the Python built-in float type works with a subset of real numbers:
>> To be more precise: a subset of the rational numbers, those with a denominator
>> that is a power of two.
>And no more than N bits (53 in a 64-bit float) in the numerator, and
>the denominator between the limits of the exponent. (Unless it's
>subnormal. That adds another set of small numbers.) It's a pretty
>tight set of restrictions, and yet good enough for so many purposes.
>But it's a far cry from "all real numbers". Even allowing for
>continued fractions adds only some more; I don't think you can
>represent surds that way.
Adding cf's adds all computable numbers in infinite precision.
However that is not even a drop in the ocean, as the computable
numbers have measure zero.
A cf object yielding its coefficients amounts to a program that generates
an infinite amount of data (in infinite time), so it is not
very surprising it can represent any computable number.
Pretty humbling really.
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert at spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
More information about the Python-list