[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: |
Felix |
Subject: |
Re: [Chicken-hackers] CR: Division by inexact zero should return infinity/nan |
Date: |
Thu, 25 Aug 2011 09:27:54 -0400 (EDT) |
From: Alaric Snell-Pym <address@hidden>
Subject: Re: [Chicken-hackers] CR: Division by inexact zero should return
infinity/nan
Date: Thu, 25 Aug 2011 14:03:28 +0100
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 08/25/2011 11:07 AM, Felix wrote:
>>> 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.
>>
>> It is the general problem of floating-point equality. The underlying
>> floating point representation is a platform-specific detail. It
>> happens to be IEEE in most cases. R5RS doesn't require IEEE. Chicken
>> does not (at least to my knowledge) require IEEE.
>
> Floating point equality is poorly defined; therefore, we should avoid it
> where possible, and avoid baking its semantics into other parts of the
> system. When dividing by a floating-point number, therefore, we need to
> avoid the "conditional branch" of return a value / raise an error
> depending on the results of a floating point comparison...
We have to deal with FP-equality anyway (=, eqv?, integer?). Sorry,
I prefer high-level semantics for generic arithmetic operations.
cheers,
felix
- [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, 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 <=
- 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