Bill Allombert on Thu, 26 Oct 2006 20:55:24 +0200


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

Re: [BUG?] log(2) flip/flopping


On Wed, Oct 25, 2006 at 05:46:29PM -0700, Ilya Zakharevich wrote:
> I discovered this by trying to investigate mysterious failures of
> test suite of Math::Pari:
> 
>     ? log(2)
>     %1 = 0.6931471805599453094172321215
>     ? \p 38
>        realprecision = 38 significant digits
>     ? log(2)
>     %2 = 0.69314718055994530941723212145817656808
>     ? \p 58
>        realprecision = 67 significant digits (58 digits displayed)
>     ? log(2)
>     %3 = 0.6931471805599453094172321214581765680755001343602552541207
>     ? \p 38
>        realprecision = 38 significant digits
>     ? log(2)
>     %4 = 0.69314718055994530941723212145817656807
> 
> Is this change between ...08 and ...07 as expected?
> 
> The code is in constlog2()...

This bug is known and recorded as bug #498.

The correct fix is to provide a version of constlog2 (and constpi and
consteuler) which performs exact rounding.

I suppose we could easily improve constlog2() so that the rounding is more
frequently correct.

Cheers,
Bill