Re: exp() infinity [message #61834] |
Fri, 08 August 2008 09:52 |
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  |
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  |
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  |
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
|
|
|