Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: "Michael C. Grant" <mcgrant@mindspring.com>
Subject: Re: Division by zero crashes on DEC should be avoidable!
Date: 1998/03/08	[thread overview]
Message-ID: <6dvpck$edd@camel12.mindspring.com> (raw)
In-Reply-To: lpaEpF70x.LAD@netcom.com


You're quite correct. For a number of reasons, including pipelining issues,
floating-point exceptions can significantly decrease the performance of a
piece of computational code. And I don't want the processor to have to empty
its floating-point pipeline just to tell me something that I already know.

Interestingly, many pipelining issues reared their ugly head _after_ the
IEEE floating-point standard was already established. In fact, if I remember
correctly, certain Alpha processors purposefully violate certain more
esoteric parts of the standard, in order to preserve the pipeline in
exceptional circumstances.

So unnecessary floating-point exceptions can _seriously_ compromise the
performance of floating-point code. But so can writing a bunch of extra code
to manually detect division by zero.

No matter what, it is always important to fully understand the consequences
of division by zero, etc. when writing numerical code. If your code
considers a division by zero to be an exceptional occurrence, then I say
that it's _your_ responsibility to throw an exception---and it's _your_
responsibility to document your code so that its users avoid that pitfall.
Don't let the compiler do your work for you, because invariably it doesn't
catch everything.

Michael

Pierre Asselin wrote in message ...
>"Michael C. Grant" <mcgrant@mindspring.com> writes:
>
>>Folks, it really isn't very difficult to work with division by zero and
>>infinities in computational code. In fact, it's a very useful idiom, and
>>that's precisely the reason why the IEEE floating-point standards allow
it.
>
>I think there's also a technical reason behind it.  Something to do
>with vector processors or long floating-point pipelines, and not
>stalling them with an exception when an infinity or a NAN would do.






  reply	other threads:[~1998-03-08  5:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-03-06  5:00 Division by zero crashes on DEC should be avoidable! Andrew Ellerton
1998-03-06  5:00 ` Ron Natalie
1998-03-06  5:00 ` Daniel S. Riley
1998-03-06  5:00 ` mathog
1998-03-06  5:00   ` Michael C. Grant
1998-03-06  5:00     ` Pierre Asselin
1998-03-08  5:00       ` Michael C. Grant [this message]
1998-03-06  5:00 ` Dag-Erling Coidan Sm�rgrav
1998-03-06  5:00   ` John Wilson
1998-03-06  5:00   ` Michael C. Grant
1998-03-06  5:00     ` Jeffrey J. Potoff
1998-03-09  5:00     ` Dan A. Mercer
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox