chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] IEEE float arithmetic


From: John Cowan
Subject: Re: [Chicken-users] IEEE float arithmetic
Date: Tue, 20 Jun 2006 11:37:41 -0400
User-agent: Mutt/1.3.28i

Thomas Chust scripsit:

> in my humble opinion it is a good idea to throw an exception by default 
> if a numerical operation does not make sense. This makes error detection 
> in algorithms much easier. If CHICKEN did not throw exceptions in cases 
> like division by zero, I would find myself wrapping tons of numerical 
> operations in custom functions or macros in order to throw the 
> exceptions by hand. 

What do you do now about the other ways of generating infinities and NaNs?
An overflow will be a correctly signed infinity, and attempts to add or
divide +infinity and -infinity will return NaN.

I also note that while the IEEE 754 standard allows both quiet NaNs and
signaling NaNs (which throw an exception when you try to use them),
universal practice seems to be for quiet NaNs, which just propagate
until an explicit test is made.

> In my eyes, performing those operations and returning some more or
> less sensible value is better suited for "unsafe" languages like C
> where you have to do error checking by hand anyway.

Well, IEEE behavior is probably going to be in R6RS anyhow (it's in the
current draft of SRFI 77).

-- 
A witness cannot give evidence of his           John Cowan
age unless he can remember being born.          address@hidden
  --Judge Blagden                               http://www.ccil.org/~cowan




reply via email to

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