in reply to
Irrational numbers

Certain irrational numbers have a compact but useful representation; for example the square-root of two can be represented as `bless(\'2 ** 0.5', 'Surd')`. A suitably smart implementation of the `Surd` class could figure out that root-2 times 3-root-2 equals 6 without resorting to floating point arithmetic.

The problem with π is that it's not just irrational; it's transcendental. There's no convenient, accurate representation of it. You've just got to store an approximation as a float or string or whatever, and it will only be accurate to a certain number of decimal places.

Comment on
Re: Irrational numbers
Select or Download Code | |
---|---|

Re^2: Irrational numbers by grondilu (Pilgrim) on Dec 17, 2012 at 22:20 UTC | |

- Re^3: Irrational numbers
by tobyink (Abbot) on Dec 18, 2012 at 08:35 UTC |

In Section
Meditations