This is the mail archive of the mailing list for the Kawa project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bug #27553 - patch

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 infinity".
This has some uses - for example the length of an infinite list is (or should
be) infinity. A range a..1/0 where the upper bound is infinity is a range which
starts with the lower bound and continues forever. This can also be a convenience
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.
	--Per Bothner

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]