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

Home » Public Forums » archive » Locate an underflow
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: Locate an underflow [message #25212 is a reply to message #25132] Wed, 23 May 2001 11:25 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Paul van Delst <paul.vandelst@noaa.gov> writes:

> Hmm. I do see your point, but if I grab someone else's code (not
> just IDL code BTW) the first thing I do is run their supplied test
> case (I hope there is one) with all warning flags on (for IDL,
> !EXCEPT = 2; for Fortran or similar, set the platform specific
> compiler switch to trap under/overflows, divide by zero, etc.).
>
> If, on running said code, I get a crapload of underflow errors, it's
> an indication that that either a) the code hasn't been tested very
> well or b) the programmer didn't really think about the problem
> enough (and I'm guilty of both of these.... most of the time
> actually). If there are (usually harmelss) underflow errors, how do
> I know that there won't be other more serious errors at some point
> for different input?

Yah, but consider the difference between the following bits of code:

1> y = exp(-x^2)

2> u = x^2
2> sz = size(x)
2> isdouble = sz(sz(0)+1) EQ 5
2> mask = u LT alog(machar(double=isdouble).xmax)
2> y = mask*exp(-u*mask)

Both sets of code accomplish the same thing, computing a gaussian
function, except the second one avoids bogus underflow error messages.
Which one do you think I'd rather write? :-) Which one shows the
original mathematical intent more ?

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
Read Message
Read Message
Read Message
Read Message
Previous Topic: read Nexrad level 3 data
Next Topic: Re: read Nexrad level 3 data

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

Current Time: Fri Oct 10 22:37:47 PDT 2025

Total time taken to generate the page: 0.96238 seconds