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

Home » Public Forums » archive » Re: exp function bug
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: exp function bug [message #7574] Fri, 06 December 1996 00:00
Peter Mason is currently offline  Peter Mason
Messages: 145
Registered: June 1996
Senior Member
On Thu, 5 Dec 1996, Robert Cannon wrote:
> Can anyone tell me what is going on here, or if it happens on other
> platforms?
> The first time I call exp (-710.72026d0) after starting idl I get:
> hera:~> idl
> IDL. Version 4.0.1 (IRIX mipseb).
> IDL> print, exp (-710.72026d0)
> 2.8462073e+134
> IDL> print, exp (-710.72026d0)
> 2.1782760e-309
> This is on an sgi crimson. I get the impression the same may happen on
> an alpha, but for a different value - it has to be -710.72026d0 on the
> sgi: -710.72025d0 works fine.....

I think that exp(-710.72026d0) is on the borderline of giving a
floating-point underflow on your platform. Here are some approximate
values of "a" in EXP(a) beyond which a floating-point underflow occurs on
IDL platforms I have available here. (I haven't observed inconsistencies
like you did.)
PLATFORM A
Intel Pentium, NT3.51 -708.D
DEC ALPHASTATION 200 4/233, NT3.51 -708.D
DEC ALPHA/AXP 3000/500, OSF -744.D
(|A| is much smaller for single precision, of course.)

I don't really understand what could cause those inconsistent answers.
Here's, well, a stream of consciousness...
EXP(large neg value) used to silently return 0.0 in older versions of IDL (the
way I prefer it to do), and when RSI introduced support for some floating
point "denormals" (Infinity and NaN), things were quite strange initially:
On my DEC OSF platform, EXP(-x) would generate an underflow error for
moderately large x, but would cause IDL to crash with a segfault given a
suitably large (much larger) x.
I think that when you're working right at the edge of FP precision like this,
you can easily run into platform-specific differences. (For example, ALPHA/
NT doesn't handle denormals in hardware.)
But I also think that EXP(-710.72026d0) == 2.8462073e+134 is unacceptable at
any time, and that you should send in a bug report. (Perhaps there is some
bug in IDL's FP exception-handling code on the SGI.)


Peter Mason
Re: exp function bug [message #7576 is a reply to message #7574] Thu, 05 December 1996 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Andy Loughe <afl@cdc.noaa.gov> wrote:

> Robert Cannon wrote:
>>
>> Can anyone tell me what is going on here, or if it happens on other
>> platforms?
>>
>> The first time I call exp (-710.72026d0) after starting idl I get:
>>
>> hera:~> idl
>> IDL. Version 4.0.1 (IRIX mipseb).
>>
>> IDL> print, exp (-710.72026d0)
>> 2.8462073e+134
>> IDL> print, exp (-710.72026d0)
>> 2.1782760e-309
>>
>> This is on an sgi crimson. I get the impression the same may happen on
>> an alpha, but for a different value - it has to be -710.72026d0 on the
>> sgi: -710.72025d0 works fine.....
>
>
> For interest's sake...
> This does not happen on a SUN SparcStation running Solaris 2.5

Doesn't happen on a Mac either.

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
2642 Bradbury Court, Fort Collins, CO 80521
Phone: 970-221-0438 Fax: 970-221-4762
E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
-----------------------------------------------------------
Re: exp function bug [message #7585 is a reply to message #7576] Thu, 05 December 1996 00:00 Go to previous message
Andy Loughe is currently offline  Andy Loughe
Messages: 174
Registered: November 1995
Senior Member
Robert Cannon wrote:
>
> Can anyone tell me what is going on here, or if it happens on other
> platforms?
>
> The first time I call exp (-710.72026d0) after starting idl I get:
>
> hera:~> idl
> IDL. Version 4.0.1 (IRIX mipseb).
>
> IDL> print, exp (-710.72026d0)
> 2.8462073e+134
> IDL> print, exp (-710.72026d0)
> 2.1782760e-309
>
> This is on an sgi crimson. I get the impression the same may happen on
> an alpha, but for a different value - it has to be -710.72026d0 on the
> sgi: -710.72025d0 works fine.....


For interest's sake...
This does not happen on a SUN SparcStation running Solaris 2.5

--
Andrew F. Loughe | afl@cdc.noaa.gov
University of Colorado, CIRES | http://cdc.noaa.gov/~afl
Campus Box 449 | phn:(303)492-0707 fax:(303)497-7013
Boulder, CO 80309-0449 | "If you are going to be blue, be bright
blue!"
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: create and play MPEGS
Next Topic: Re: Functions and arrays

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

Current Time: Wed Oct 08 15:22:42 PDT 2025

Total time taken to generate the page: 0.00411 seconds