comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Floating Underflow/Overflow
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Floating Underflow/Overflow [message #27319 is a reply to message #27229] Tue, 16 October 2001 12:18 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"George N. White III" <WhiteG@dfo-mpo.gc.ca> writes:

> 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.

On the other hand, the performance of IDL falls down rather badly when
dealing with conditional tests on large arrays, especially when FOR
loops cannot be avoided. Even using WHERE() usually makes a pretty
large performance hit.

One little trick for avoiding underflows in exponentials might go like
this. If you wish to compute Y = EXP(-X), for large X, then you can
usually use a "mask" variable to avoid the underflow.

MASK = (X LT UPPER_LIMIT)
Y = MASK * EXP(-X*MASK)

Note that this doesn't catch overflows which will be more disastrous.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: INTERPOLATE note
Next Topic: Re: bug in contour?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 09:57:11 PDT 2025

Total time taken to generate the page: 0.16069 seconds