guile-devel
[Top][All Lists]
Advanced

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

IEEE floating point support for guile?


From: Chris Hanson
Subject: IEEE floating point support for guile?
Date: Fri, 03 Nov 2000 19:10:52 -0500
User-agent: IMAIL/1.6; Edwin/3.103; MIT-Scheme/7.5.10

   Date: 03 Nov 2000 17:46:04 -0500
   From: Jim Blandy <address@hidden>

   Have you looked over R5RS's section on numerical behavior?  We want
   to be compatible with that; I don't know whether it conflicts with
   IEEE.

R5RS strongly urges the use of IEEE floating-point format.  It is
silent on whether operations may return NaN or Inf values.

   > Recently, there was a discussion on comp.lang.python about similar
   > changes for Python.  There may be some ideas there, but the discussion
   > soon mutated into a discussion of whether (/ 1 2) should produce 0 or
   > 0.5.  BTW, I prefer 0.5 (or 1/2), but is there a way in guile to perform
   > integer division?

   The QUOTIENT procedure is required in R5RS.

It's not legal to return 0 (exact zero) for (/ 1 2); that is covered
by the primary rule for exact computations: "If two implementations
produce exact results for a computation that did not involve inexact
intermediate results, the two ultimate results will be mathematically
equivalent.".  It _is_ permitted to return 0.0 (inexact zero), but
that's just silly; if you are going to coerce to inexact you might as
well return 0.5.



reply via email to

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