This is the mail archive of the
mailing list for the Kawa project.
Re: bug #27553 - patch
- From: Per Bothner <per at bothner dot com>
- To: Charles Turner <chturne at gmail dot com>
- Cc: kawa at sourceware dot org
- Date: Mon, 11 Apr 2011 18:30:09 -0700
- Subject: Re: bug #27553 - patch
- References: <4DA34977.email@example.com>
Not sure if this is "the right way" to solve this bug. I wanted the
stack trace for (/ 1 0) to be the same as (/ 0 0), so that's why I've
called IntNum.quotient(), I could have raised the exception immediately,
but I thought consistency would be appreciated.
I don't know if the current behavior is a good idea - but it is intentional.
The meaning of (/ 1 0) is the same as the literal 1/0, which is "exact
This has some uses - for example the length of an infinite list is (or
be) infinity. A range a..1/0 where the upper bound is infinity is a
starts with the lower bound and continues forever. This can also be a
for substring/slicing operations.
On the other hand, I don't think there is a similar use case for (/ 0 0).
In the inexact (float) realm we have NaN, so #i0/0 is +nan.0 .
Alas, there isn't a lot of actual support for exact infinities. To support
it we should probably have an ExtendedIntNum class, which extends RatNum,
and which IntNum in turn extends: ExtendedIntNum is IntNum plus infinities.
Then we need to make sure and define semantics for all the operations.
Many things already work as they should. For example: (< 395 1/0) is true.
(+ 395 1/0) is 1/0.