Re: Floating Underflow/Overflow [message #27247 is a reply to message #27246] |
Mon, 15 October 2001 07:54   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
bente@uni-wuppertal.de (Kay) writes:
> Hi,
>
> i get Floating Overflow/Underflow error messages during my
> calculations, but the result seems to be correct, can these warnings
> be ignored then?
> I�m calculating a Fermi Distribution (I want a sphere with smooth
> edges and this seemed to be the easiest way) I think, that the results
> get to low for larger radiuses so IDL makes this error message. Is it
> possible to tell IDL to round to zero then or what do i have to do?
Hi Kay--
In all likelihood you can ignore the over- and underflows. You can
use !EXCEPT = 2 to find out where in your program the exceptions are
being created. You can also turn off exceptions using !EXCEPT if that
is crucial.
While I have argued in the past that most people don't need underflow
errors, and that they should be silent, other folks on the newsgroup
have argued that we should strive to avoid them, so such errors should
be printed. Leaving the question of right vs. wrong on error messages
aside for the moment, I indeed think it is important to avoid over and
underflows.
My guess is that you are getting both when you use EXP() in the Fermi
distribution. To avoid this you can use some simple techniques. One
idea is to use thresholding to keep all values in-bounds, like this,
EXP((X) > (-1e-38) < 1e38). That is not really satisfactory though
because sometimes you *want* the effect of an underflow. That is
perhaps best solved using the WHERE() command to locate extremal
values and treat them specially.
Good luck,
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|