Re: Floating Underflow/Overflow [message #27229] |
Tue, 16 October 2001 08:19  |
George N. White III
Messages: 56 Registered: September 2000
|
Member |
|
|
On Mon, 15 Oct 2001, Paul van Delst wrote:
> Kay wrote:
>> i get Floating Overflow/Underflow error messages during my
>> calculations, but the result seems to be correct, can these warnings
>> be ignored then?
>> [...]
"Seems to be correct" only offers some hope that when you understand
the reason for underflow you will realize that it doesn't affect
your results. Even then, you may want to alter the program to
avoid underflow:
1. underflow is often an expensive way to set a variable to zero -- when
the source of underflow is understood it may become obvious that a
significant chunk of calculation isn't needed and shouldn't be used (e.g.,
by adding a range test to omit the section where underlow occurs when the
inputs are "out of bounds").
2. modern hardware with branch prediction and combined f.p. ops
is generally tuned for peak performance in typical cases, and can
fall down very badly when handling exceptions. Even if your current
program performs adequately, once you have analyzed the underflow
you may want to document it in case you encounter performance problems
in the future.
> First test your code after setting !EXCEPT = 2. this will tell you on
> what lines of code you are getting the over/underflow. Then you can
> alter your algorithm to avoid them depending on your needs.
> [...]
> So, like I said before, it depends on what you want to do. The
> operational forecast model always has to run. It can't crash with an
> error or produce a crappy number unless it's flagged as crappy.
>
> Just my opinion of course, but I treat all fp errors as serious.
I suspect that operational forecast models have to run in a set
amount of time too.
--
George N. White III <gnw3@acm.org> Bedford Institute of Oceanography
|
|
|