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

infinity notations



Some new possibilities have come to light.  Here are all the possible
Scheme infinity notations that I know of:

	positive	negative	indeterminate	Scheme
	 infinity	 infinity	 number		 implementations
	=========	=========	=============	================
   A	+#.#		-#.#		#.#		Scm 5d7, Guile 1.3.4, Bigloo 2.5c

   B	+/0		-/0		0/0

   C	+/0.		-/0.		0/0.

   D	#i+/0		#i-/0		#i0/0

   E	1/0		-1/0		0/0		Scm 5d8

   F	+1/0		-1/0		0/0

   G	+1/0.		-1/0.		0/0.

   H	#i1/0		#i-1/0		#i0/0		Kawa 1.7

   I	#i+1/0		#i-1/0		#i0/0

   J	inf.0		-inf.0		NaN		Elk 3.0

   K	+inf.		-inf.		+nan.		Gambit 3.0

   L	+inf.0		-inf.0		+nan.0		Mz Scheme 202

   M	#i+inf		#i-inf		#i+nan

The notation for indeterminate numbers need not be readable, as it
signifies an error condition.  The unsigned notations of J do not meet
the stipulations of R5RS section 2.1 "Identifiers":

    ...  in all implementations a sequence of letters, digits, and
    "extended alphabetic characters" that begins with a character that
    cannot begin a number is an identifier.

Notations K and L use `.' to indicate the inexactness of infinities.
The trailing `0' of L seems unnecessary, but mzscheme will not accept
infinity literals without it.  Prefixing nan with `+' can be
misleading, as it is used to indicate numbers about which nothing,
including the sign, is known.  In mathematical parlance, "inf" stands
for infimum, the greatest lower bound.

Notations E, F, H, and I can be read in some implementations without
modifying the Scheme reader.  Of course in those implementations, the
`1' can be replaced by any positive integer.  For output notations F
and I should be used in preference to E and H because the `+' stresses
the sign of the positive infinity.  Notations B, C, and D eliminate
the `1' for positive and negative infinities.

Notations C and G use a trailing `.' to indicate inexactness as K
does.  This requires a small extension to R5RS number syntax, as
rational notation (`1/0') does not currently allow a trailing period.