[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] CR: Division by inexact zero should return infinity/na
From: |
Peter Bex |
Subject: |
[Chicken-hackers] CR: Division by inexact zero should return infinity/nan |
Date: |
Wed, 24 Aug 2011 21:18:44 +0200 |
User-agent: |
Mutt/1.4.2.3i |
Hi all,
I'm working on fixing several bugs in numbers, and now I stumbled
upon Chicken's behaviour with zero-flonums:
(/ 1.0 0.0) => error: division by zero
(/ -1.0 0.0) => error: division by zero
(/ 0.0 0.0) => error: division by zero
However, an inexact zero is not exactly zero; it could be some
very small value unrepresentable by the internal floating-point
storage.
This is really annoying, as you'd get "random" errors when you're working
with numbers in the extreme ranges representable by flonums even if you
absolutely know you're dividing by nonzero values.
All other Schemes I tested with (Guile, Gauche, Scheme48, Racket and Gambit)
return +inf.0 for (/ 1.0 0.0) and -inf.0 for (/ -1.0 0.0).
They return +nan.0 for (/ 0.0 0.0). Extra data points would be welcome.
I'd like to open a CR for doing the same in Chicken, to make it behave
like a good little robot. If it is accepted, a corresponding change will
also be made to the "numbers" egg. The CR has ticket number #672 in Trac.
Cheers,
Peter
--
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
is especially attractive, not only because it can be economically
and scientifically rewarding, but also because it can be an aesthetic
experience much like composing poetry or music."
-- Donald Knuth
- [Chicken-hackers] CR: Division by inexact zero should return infinity/nan,
Peter Bex <=
- Re: [Chicken-hackers] CR: Division by inexact zero should return infinity/nan, John Cowan, 2011/08/24
- Re: [Chicken-hackers] CR: Division by inexact zero should return infinity/nan, Felix, 2011/08/25
- Re: [Chicken-hackers] CR: Division by inexact zero should return infinity/nan, Peter Bex, 2011/08/25
- Re: [Chicken-hackers] CR: Division by inexact zero should return infinity/nan, Ivan Shmakov, 2011/08/25
- Re: [Chicken-hackers] CR: Division by inexact zero should return infinity/nan, Felix, 2011/08/25
- Re: [Chicken-hackers] CR: Division by inexact zero should return infinity/nan, Alex Shinn, 2011/08/25
- Re: [Chicken-hackers] CR: Division by inexact zero should return infinity/nan, Alaric Snell-Pym, 2011/08/25
- Re: [Chicken-hackers] CR: Division by inexact zero should return infinity/nan, Felix, 2011/08/25
- Re: [Chicken-hackers] CR: Division by inexact zero should return infinity/nan, John Cowan, 2011/08/25
- Re: [Chicken-hackers] CR: Division by inexact zero should return infinity/nan, John Cowan, 2011/08/25