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: Sat, 11 Nov 2000 13:12:01 -0500
User-agent: IMAIL/1.6; Edwin/3.103; MIT-Scheme/7.5.10

   Date: 11 Nov 2000 16:18:53 +0100
   From: Florian Weimer <address@hidden>

   On GNU/Linux, the standard floating point round mode is "round to
   extended precision" (64 bit, IIRC).  There is probably some code
   out there which breaks when the rounding mode is changed that way.
   If you want to embed Guile in your application, this can have quite
   unexpected results.

This isn't an accurate statement.  An accurate statement is that, on
the x86 architecture, the default rounding mode is "round to nearest
or even" and the default precision is "extended".  This is true not
only for GNU/Linux on that platform, but for all other operating
systems that I know of.  (Normally the operating system does not
change the hardware default.)

The problem with this as a default from the point of view of a
cross-platform application like Guile is that this is _not_ the same
default that is used on other hardware.  Thus programs written on this
hardware will perform differently when used on, say, the alpha.  So if
you're interested in portability, the correct default is to use IEEE
double-precision format.

However, you do have a good point that I hadn't considered, which is
that Guile might be embedded in an existing non-portable application,
and in particular one that cares about the extra precision.  I
suppose that it will be necessary to have a settable option that says
"do not change the hardware's default floating-point modes" in order
to support such applications.

One thing that strikes me here is that the most important thing that
should be done here -- more important than deciding what is the
appropriate default behavior -- is to document these floating-point
issues in the manual.  It's very important that users understand the
ramifications of the global floating-point modes, and what their
options are for controlling them.  This will prevent surprises of the
type you mention, where adding Guile changes the floating-point
behavior.  It will also help people to understand that attempting to
exploit non-standard floating-point formats will make their code
non-portable.



reply via email to

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