chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] IEEE float arithmetic


From: felix winkelmann
Subject: Re: [Chicken-users] IEEE float arithmetic
Date: Tue, 20 Jun 2006 07:37:18 +0200

On 6/19/06, John Cowan <address@hidden> wrote:
I'd like to have Chicken inexact numbers play nicely as IEEE floats,
since on all practical platforms they *are* IEEE floats.  This involves
the following modifications.

1) Allow the reader to understand Infinity.0, -Infinity.0, and NaN.0 .
These should be defined in the reader as numeric literals.  As a fallback,
they could be defined in Scheme code:

        (define Infinity.0 (* 1.0e307 1.0e307))
        (define -Infinity.0 (* -1.0e307 1.0e307))
        (define NaN.0 (- Infinity.0 -Infinity.0))

This, however, makes them only available in code, not in a Scheme datum.

Chicken already supports +inf, -inf and +nan.
(+inf.0, ... are supported as well, but a bug I just fixed
in the number-parser prevented it from working).


2) Remove the divide-by-zero trap in inexact division, and allow the IEEE
results to appear openly.  This will mean that (/ 1.0 0.0) will evaluate
to Infinity.0, (/ -1.0 0.0) to -Infinity.0, and (/ 0.0 0.0) to NaN.0.

Uh oh - I don't think this is good... Does it really give much to propagate
nan's in thise case through numeric operations?


cheers,
felix




reply via email to

[Prev in Thread] Current Thread [Next in Thread]