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: Chandra Sekhar Mallarapu
Subject: RE: [Help-gsl] strange behaviour of addition of floats and exponential function
Date: Wed, 26 Jan 2011 23:15:19 +0000

________________________________________
From: Jordi Gutiérrez Hermoso address@hidden
Sent: Wednesday, January 26, 2011 6:11 PM
To: Chandra Sekhar Mallarapu
Cc: address@hidden
Subject: Re: [Help-gsl] strange behaviour of addition of floats and exponential 
function

2011/1/26 Chandra Sekhar Mallarapu <address@hidden>:

> From: Jordi Gutiérrez Hermoso address@hidden

> On 26 January 2011 09:18, Chandra Sekhar Mallarapu
> <address@hidden> wrote:
>> I am trying to do C=A+B, where
>> A=0.0000000000000000021675312011946934078589202290913712085038187871567725434340800916288571897894144058
>
> What data types are A, B, and C? I don't think there are any float
> types in any common architecture that are broad enough to be accurate
> to that many digits.
>
> A, B, C are double data type in C. Even if its not accurate till the
> last digit, shouldn't it be accurate to some digits atleast?

I think you ought to consult

     http://en.wikipedia.org/wiki/Floating_point_arithmetic

for a brief overview and

     http://perso.ens-lyon.fr/jean-michel.muller/goldberg.pdf

more a more in-depth treatment.

In short, your expectations of how floating point arithmetic works
need refinement.

Thanks.
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?


--chandra


reply via email to

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