chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Non-finite number I/O (was: Possible numbers bug)


From: John Cowan
Subject: Re: [Chicken-users] Non-finite number I/O (was: Possible numbers bug)
Date: Sat, 28 May 2011 16:59:56 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

Peter Bex scripsit:

> I think it's the same.  Only flonums can be +inf and hence the .0 is
> superfluous.

Superfluous, maybe, but now standard.  R6RS prescribes it (for systems
supporting IEEE floats) and so will R7RS-small, despite being much more
like R5RS in most ways.

Existing implementations use either +inf.0 or something specific to
that implementation.  Specifically: Racket, Gauche, Guile, Kawa, Chibi,
SCM, Ikarus, Larceny, IronScheme, Ypsilon, Mosh, and STklos all use
+inf.0.  Bigloo uses +Infinity.  Scheme48/scsh uses #{Inf}.  SISC uses
infinity.0, which is not even rereadable.  MIT Scheme and Scheme 9 do
not have non-finite values; they always report floating overflow or
divide by zero errors.  (Scheme 9 is non-IEEE; it handles flonums up to
10^10^10 - 1.)

What is more, Chicken is not even consistent: on Linux it prints +inf,
but on Cygwin, which uses Newlib instead of GNU libc, it prints +inf.0.

My recommendations:

Use wrapper logic in number->string to print +inf.0, -inf.0, and +nan.0
in the appropriate circumstances, and make sure that string->number
always accepts them.

Remove the divide-by-zero exception when dividing by inexact 0, which
does not represent a mathematical 0, but any number between the smallest
positive flonum and the largest negative flonum.

-- 
We do, doodley do, doodley do, doodley do,        John Cowan <address@hidden>
What we must, muddily must, muddily must, muddily must; 
Muddily do, muddily do, muddily do, muddily do,    http://www.ccil.org/~cowan
Until we bust, bodily bust, bodily bust, bodily bust.  --Bokonon



reply via email to

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