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

infinities reformulated [was Re: My ideas about infinity in Scheme (revised)]

This page is part of the web mail archives of SRFI 70 from before July 7th, 2015. The new archives for SRFI 70 contain all messages, not just those from before July 7th, 2015.



 | Date: Mon, 23 May 2005 15:30:02 +0900
 | From: Alex Shinn <alexshinn@xxxxxxxxx>
 | 
 | On 5/23/05, Aubrey Jaffer <agj@xxxxxxxxxxxx> wrote:
 | >  | Date: Sun, 22 May 2005 20:46:53 +0900
 | >  | From: Alex Shinn <alexshinn@xxxxxxxxx>
 | >  |
 | >  | On 5/22/05, Aubrey Jaffer <agj@xxxxxxxxxxxx> wrote:
 | >  | >
 | >  | > In hundreds of years of using rational numbers, mathematicians have
 | >  | > not discovered 1/0 to be a useful extension to the rational numbers.
 | >  |
 | >  | Well, mathematically 1/0 isn't real or complex either, as it doesn't
 | >  | obey the properties of a field
 | > 
 | > 1/0 and -1/0 can be added in a way that preserves the total ordering
 | > of the real numbers.
 | 
 | But closure is lost because (+ 1/0 -1/0) is not real (at which point
 | it's no longer a group, much less field).  Introduction of 0/0 to
 | regain closure breaks the inverse element property of groups (the
 | identity element is still 1 but 0/0 has no inverse).

I have come up with a clearer formulation:

  6.2.2x Inexactness

  In an implementation which represents inexact real numbers with
  IEEE-754 64-bit flonums:

  (= 3.141592653589793
     3.14159265358979323846
     3.1415926535897932384626433
     3.141592653589793238462643383279
     3.14159265358979323846264338327950288)       ==>  #t

  Thus an inexact real number represents not a single value, but a
  neighborhood of (mathematical) real numbers.  The inaccuracies of
  inexact calculations are due to misalignment of functional
  projection of a given neighborhood onto the real line neighborhoods.

  The interpretation of real infinities is that 1/0 represents real
  numbers greater than can be encoded by finite inexacts in the
  implementation (> 179.76931348623158e306 for IEEE-754 64-bit
  flonums) and that -1/0 represents numbers less than can be encoded
  by finite inexacts in the implementation (< -179.76931348623158e306
  for IEEE-754 64-bit flonums).  This preserves the total ordering of
  the (mathematical) real numbers and extends Scheme's representation
  to cover the entire real line.  Note that no numerical infinity,
  with its attendant theoretical problems, is constructed; 1/0 and
  -1/0 represent the half-lines beyond either end of the
  implementation's inexact rational range.  For any finite real number
  x:

  (= -1/0 x))                 ==>  #f
  (= 1/0 x))                  ==>  #f
  (< -1/0 x 1/0))             ==>  #t
  (> 1/0 x -1/0))             ==>  #t

  Implementations of Scheme which provide inexact real numbers shall
  implement positive infinity and negative infinity as unique inexact
  real numbers.

  An optional third infinity, which is not real, may be returned by a
  numerical function when no inexact neighborhood (including
  infinities) contains the correct answer.  An implementation may
  report a violation of an implementation restriction in any
  calculation for which the result would be an unreal infinity.

I believe these semantics avoid the problems caused by introduction of
new elements to the field.

 | > Many ideas about efficiency have been invalidated by the growth of
 | > instruction speed far outstripping growth in L1 cache size.  An
 | > article about this is:
 | > <http://swiss.csail.mit.edu/~jaffer/CNS/interpreter-speed>
 | 
 | An interpreter is still an order of magnitude slower than a native
 | compiler.  Regardless, if there are situations (either explicit
 | from the use of real? or implicit via method polymorphism) where in
 | the middle of a loop you must check against the IEEE-754
 | infinities, then you will suffer a serious performance loss.

IEEE 64-bit infinities are those numbers whose 11-bit exponent field
is all ones (2047).  They can be quickly detected without using a FPU.