guile-devel
[Top][All Lists]

IEEE floating point support for guile?

 From: Chris Hanson Subject: IEEE floating point support for guile? Date: Thu, 09 Nov 2000 16:01:33 -0500 User-agent: IMAIL/1.6; Edwin/3.103; MIT-Scheme/7.5.10

```   Date: 09 Nov 2000 21:42:17 +0100

At any rate, it seems to me that also the case when floating-point
exceptions aren't generated can be useful.

In many instances of numerical calculation, you *know* that singular
values will occur in some places, but the results can be useful
anyway.  A simple example is when plotting a function with
singularities at some points.

There are cases where it's more interesting to study the resulting
vector or matrix and note in which slots you have got singular values
instead of getting an exception when the singular value is generated.
The latter is useful if there's a bug in the program.  The former is
useful if there's a numerical problem.

I'm not saying that non-exception operations aren't useful; clearly
they are useful in a variety of situations.  My point is that, for
naive use of floating-point operations, it's better to generate
exceptions.

Naive users will set up computations and run them, and look at the end
result.  They will expect that the flonums will behave as real numbers
and that the result will reflect that naive model.  If there's an
intermediate result of Inf or NaN, their model will be violated and
the result invalid.  If exceptions are enabled, invalid intermediate
results will signal errors and the user will be forced to face the
fact that what they are trying to do won't work.

Sophisticated users presumably understand that flonums can not be
modelled as real numbers, and that they need to understand the details
of the intermediate results.  Such users may very well be willing to
exploit exceptional values to gain a particular end result, and it's
reasonable to allow them to do this.  On the other hand, the only two
floating-point wizards I know, Jack and Gerry, _never_ do this, so I
don't have an example of a real numerical analyst who uses Inf or NaN.

```