[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] CR: Division by inexact zero should return infinit
From: |
Peter Bex |
Subject: |
Re: [Chicken-hackers] CR: Division by inexact zero should return infinity/nan |
Date: |
Thu, 25 Aug 2011 11:19:11 +0200 |
User-agent: |
Mutt/1.4.2.3i |
On Thu, Aug 25, 2011 at 03:50:40AM -0400, Felix wrote:
> > 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.
>
> Yes, that's floating point.
No, that's the division operator in Chicken. The particular floating
point representation we are using explicitly supports returning infinities.
> > 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.
>
> CL signals div-by-zero.
But we're a Scheme. Also, CL is overengineered design by committee
and hence is and not tied to the IEEE standard (it's optional).
According to the Hyperspec, this is actually not even defined; it says
an implementation *might* raise an error on zero. Returning inf or nan
is allowed too. I guess your favorite implementation just doesn't.
We are, since we compile to C, which (AFAIK) is explicitly tied to IEEE
floating point representation and semantics. At least, it is on modern
machines. We're already using it everywhere (except in the division case)
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, 2011/08/24
- 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 <=
- 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