help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] strange behaviour of addition of floats and exponential f


From: Peter Johansson
Subject: Re: [Help-gsl] strange behaviour of addition of floats and exponential function
Date: Fri, 28 Jan 2011 09:09:07 -0500
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7

On 1/26/11 6:15 PM, Chandra Sekhar Mallarapu wrote:
What about this question?
gsl_sf_exp(0.0000000000000000000000005731906218817495693050559208091994557794428814131237532386326994000326495726)
 gives me the value as 
1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
 instead of the actual value. What can I do to get a correct answer for the 
result of the exponential function?


Taylor expansion. You can approximate exp(x) with 1.0+x. If x is a float that evaluates to 1.0 on my computer even if you use double (double precision) it evaluates to 1.0 on my computer. As mentioned previously, if you want 50 decimals precision you need to look at a different solution.

Thanks,
Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]