[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: John Cowan
Subject: Re: [Chicken-hackers] CR: expt should signal error on domain error
Date: Tue, 14 Jun 2011 11:21:01 -0400
User-agent: Mutt/1.5.18 (2008-05-17)

Felix scripsit:

> The voting period for this change request has started:

I've voted no on this, primarily because I think a deviation from
IEEE behavior needs considerable justification.  NaNs were introduced
into floating-point representations precisely so that it wouldn't be
necessary to raise and catch exceptions.

Here's what Will Kahan, the architect of IEEE 754, had to say:

Some programmers think invoking language locutions that enable the trap
to abort upon INVALID operations is the safe way to avoid all such
disputes [about NaNs and other defaults at singularities]; they are
mistaken.  Doing so may abort searches prematurely.  For example, try to
find a positive root x of an equation like

        (TAN(x) - ASIN(x) )/x**4 = 0.0

by using Newton's iteration or the Secant iteration starting from
various first guesses between 0.1 and 0.9.  In general, a root-finder
that does not know the boundary of an equation's domain must be doomed
to abort, if it probes a wild guess thrown outside that domain, unless
it can respond to NaN by retracting the wild guess back toward a
previous guess inside the domain.

[end quotation] page 9

Now it's true that Chicken's exceptions aren't aborts: you can recover from
them, but only at considerable expense.  As Kahan says elsewhere in the paper,
"Deferred judgments are *usually* better judgments but not *always*, alas";
still, they are the default.

John Cowan   address@hidden
If a soldier is asked why he kills people who have done him no harm, or a
terrorist why he kills innocent people with his bombs, they can always
reply that war has been declared, and there are no innocent people in an
enemy country in wartime.  The answer is psychotic, but it is the answer
that humanity has given to every act of aggression in history.  --Northrop Frye

reply via email to

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