[Top][All Lists]

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

Re: [Chicken-hackers] CR: expt should signal error on domain error

From: Felix
Subject: Re: [Chicken-hackers] CR: expt should signal error on domain error
Date: Fri, 17 Jun 2011 07:16:06 +0200 (CEST)

> By no means.  But I think (/ 1.0 0.0), and variants of that, should
> return +inf.0 rather than throwing an exception.  Floating-point zero
> is not necessarily a true zero; it's just a number too close to zero to
> represent.  Its reciprocal therefore is a number too big to represent
> precisely.  OTOH, (/ 0.0 0.0) should return +nan.0.

Why is floating-point zero not zero? Should "(zero? 0.0)" be
everything but true? Should "(zero? (exact->inexact 0))" be false?
Should "(= 0.0 0.0)" be false? Sure, numeric representation always
meets a limit, but there must be some determinism, somewhere.

> Of the Schemes I routinely test with, Racket, Gauche, Gambit, Bigloo,
> Guile, Kawa, Scheme48, SISC, Chibi, Chez, Ikarus, Larceny, IronScheme,
> Ypsilon, Mosh, and STklos all behave as I suggest.  Only MIT, Chicken,
> and scsh throw exceptions.  Scheme 9 throws an exception for (/ 1.0 0.0)
> but returns 0.0 for (/ 0.0 0.0).
> None of this applies, or should apply, to exact numbers: both (/ 1 0)
> and (/ 0 0) should throw exceptions.

This is totally inconsistent. Even though the IEEE numeric model seems
to be the de-facto standard I don't see why a high-level language
should go out of its way just to follow this model because the
number-crunchers like it? 


reply via email to

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