1/0=inf, -1/0=minf



Thanks for the interesting references.

I have to agree with Richard: the Bergstra&Tucker paper isn't terribly helpful for the applications I have in mind; it might be more helpful for a theorem-proving system.

Re Richard's paper:

The analogy with IEEE NaN's is quite interesting, but it also inherits all of the bad properties of NaN's as a result (pun intended!).

If the concept of 0/0 could help solve the problem of continued fractions, it might be worth while, but since it doesn't, 0/0 is relatively useless (at least to me).

I find 'signed zeros' to be such an abomination, that I have to reject them, as well.

We are thus left with the finite rationals union {-oo} union {+oo}, which we can represent by -1/0 and 1/0 if it seems convenient.  Notice that in Common Lisp, "+oo" and "-oo" are both _symbols_, so we can declare these as constant symbols that are bound to themselves.

(I don't know enough about Common Lisp's 'CLOS' (Common Lisp Object System) to know if I could change '<' to be a generic function which could be overloaded via 'defmethod' for dealing with +oo and -oo.)

Since I'm going to this trouble primarily for ordering purposes, the inclusion of a separate -0 makes things so much more complicated that it isn't worth doing at all.

If you don't like the fact that (/ (/ -1/0)) == 1/0, then you can always leave (/ x/0) undefined.  Me, on the other hand, would still rather have (/ (/ x)) == x only for finite numbers.
---

On a slightly different subject, would there be any advantage to encoding rationals not with a _pair_ (numerator,denominator), but with _four_ elements: (n,d,a,b), which represents the number n/d, but also includes a,b such that a*n+b*d=1, thus providing a 'proof' that the numerator and denominator are relatively prime ??

In general, the sizes of a,b are about the same as the sizes of n,d, so this essentially doubles the storage space, but with 64-bit machines, we have twice as much storage, anyway.  :-)

Since gcd's are typically done all the time in rational number implementations, you get the 'multipliers' a,b _for free_.

Perhaps such a representation has already been considered for polynomials in CAS systems ?

At 08:14 AM 8/5/2013, Richard Fateman wrote:
>On 8/5/2013 7:54 AM, Oliver Kullmann wrote:
>>Also
>>
>>http://dl.acm.org/citation.cfm?id=1219095
>>The rational numbers as an abstract data type
>>
>>could be of interest (it shows how to work well with 1/0 = 0).
>
>I haven't studied this paper in detail, but since it describes an axiom system for rationals
>in which 1/0 = 0  is a consequence, it appears that this is inappropriate for computer algebra
>systems...  where applications seem to require that 1/0 is certainly not zero.
>
>Perhaps this is another example of the gap between theory and practice in computing.
>
>Richard.
>
>>There are various papers follow up on this new algebraic structure.
>>
>>Oliver
>>
>>On Mon, Aug 05, 2013 at 07:23:40AM -0700, Richard Fateman wrote:
>>>You might look at ..
>>>computation with the extended rational numbers...
>>>
>>>www.cs.berkeley.edu/~fateman/papers/extrat.pdf?
>>>(1994)
>>>
>>>RJF
>>>
>>>On 8/5/2013 6:19 AM, Henry Baker wrote:
>>>>I've been playing with rational numbers which allow the denominator to be zero.
>.... snip