[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Exact irrationals



 | Date: Mon, 30 May 2005 23:52:44 -0700
 | From: Per Bothner <per@xxxxxxxxxxx>
 | 
 | ... A language implementation could have exact "infinite-precision"
 | real arithmetic to the same extent that it has "infinite-precision"
 | rational arithmetic.  The former is even more resource-hungry, and
 | has some serious limitations in that comparing two exact real
 | numbers isn't always possible.  But it still makes sense to allow
 | for exact real arithmetic.

Scheme having exact irrational numbers is not possible within the
constraints of R5RS section 6.2.4 "Syntax of numerical constants" and
section 6.2.6 "Numerical input and output":

     ... The procedure `number->string'
     takes a number and a radix and returns as a string an external
     representation of the given number in the given radix such that

     (let ((number NUMBER)
           (radix RADIX))
       (eqv? number
             (string->number (number->string number
                                             radix)
                             radix)))

     is true.  It is an error if no possible result makes this
     expression true.

All numbers are required to have an external representation.
An exact irrational number syntax would need to be added.