help-octave
[Top][All Lists]
Advanced

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

Re: Possible loss of accuracy


From: Tatsuro MATSUOKA
Subject: Re: Possible loss of accuracy
Date: Thu, 16 May 2013 15:02:22 +0900 (JST)

--- On Thu, 2013/5/16, marco atzeriwrote:
> Il 5/16/2013 1:07 AM, Stephen Montgomery-Smith ha scritto:
> > OK guys, look at this.
> >
> > exp(2^50 * log(1-2^-50))
> > ans =  3.6787944117144216749e-01
> >
> > (1-2^-50)^(2^50)
> > ans =  3.6787944112862880353e-01
> >
> > So the problem is with the pow function, not the log or the exp.
> >
> 
> as such is a problem in the libc providing the pow
> function implementation
> 
> on cygwin octave 3.6.4, I have:
> 
> octave:1> format long e
> octave:2> exp(2^50*log(1-2^-50))
> ans =  3.67879441171442e-01
> octave:3> (1-2^-50)^(2^50)
> ans =  3.67879441171442e-01
> octave:4> (1-2^-50)^(2^50)-exp(2^50*log(1-2^-50))
> ans =  0.00000000000000e+00

On MinGW octave 3.6.4, on MSVC octave 3.6.2, the results are the same as those 
on cygwin.

Regards

Tatsuro


reply via email to

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