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

Home » Public Forums » archive » Re: exp() infinity
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() infinity [message #61834] Fri, 08 August 2008 09:52
mankoff is currently offline  mankoff
Messages: 131
Registered: March 2004
Senior Member
On Aug 8, 12:07 pm, maffie <matthias.demuz...@geo.kuleuven.be> wrote:
> Hi,
>
> Thank you!
> I the meanwhile I found this link, with the exact same question (and
> answer):http://www.dfanning.com/math_tips/underflow.html
>
> Is there also a possibility to add double precision (with this "d") to
> an array? And it seems that I have many more problems with my
> calculations, because I get some more messages about underflow and
> overflow.
>
> Thereby 2 more questions:
> - Would there be a solution to solve all these in ones? Like adding a
> statement somewhere to work in double precision in any of the
> calculations?
> - Is there an easy way to see where exactly (in a sequence of
> calculations) where it all goes wrong?
>
> Thank you!
> Matthias

To convert an array to double you can do
IDL> dbl = arr*1.0d
or slighly faster
IDL> dbl = DOUBLE(arr)

To find out where the problems are happening, you can use ON_ERROR or !
EXCEPT and CHECK_MATH

-k.
Re: exp() infinity [message #61836 is a reply to message #61834] Fri, 08 August 2008 09:06 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
maffie wrote:
> Hi all,
>
> I have a small question concerning the exponential function exp():
> For values above around 89, IDL returns exp(89) = Infinity.
>
> Is there any way to get the mathematical solution??
> e.g. exp(89) = 4.4896128e38
>
> Thank you!
> Matthias

the help file says:
"The expression to be evaluated. If Expression is double-precision
floating or complex, the result is of the same type. All other types are
converted to single-precision floating-point and yield floating-point
results."

so try
IDL> print,exp(89.0D)
4.4896128e+038

Jean
Re: exp() infinity [message #61837 is a reply to message #61836] Fri, 08 August 2008 09:07 Go to previous message
matthias.demuzere is currently offline  matthias.demuzere
Messages: 32
Registered: January 2006
Member
Hi,

Thank you!
I the meanwhile I found this link, with the exact same question (and
answer):
http://www.dfanning.com/math_tips/underflow.html


Is there also a possibility to add double precision (with this "d") to
an array? And it seems that I have many more problems with my
calculations, because I get some more messages about underflow and
overflow.

Thereby 2 more questions:
- Would there be a solution to solve all these in ones? Like adding a
statement somewhere to work in double precision in any of the
calculations?
- Is there an easy way to see where exactly (in a sequence of
calculations) where it all goes wrong?

Thank you!
Matthias
Re: exp() infinity [message #61838 is a reply to message #61836] Fri, 08 August 2008 08:57 Go to previous message
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
On Fri, 8 Aug 2008, maffie wrote:

> Hi all,
>
> I have a small question concerning the exponential function exp():
> For values above around 89, IDL returns exp(89) = Infinity.
>
> Is there any way to get the mathematical solution??
> e.g. exp(89) = 4.4896128e38
>
> Thank you!
> Matthias
>

IDL> print, exp(89d)
4.4896128e+38

double precision raises your limit to 709.

regards,
lajos
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Plotting a pie chart
Next Topic: Re: Plotting a pie chart

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

Current Time: Fri Oct 10 10:49:35 PDT 2025

Total time taken to generate the page: 0.95965 seconds