Karim BELABAS on Wed, 4 Sep 2002 23:31:35 +0200 (MEST)


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

Re: bug?


On Wed, 28 Aug 2002, Paul van Wamelen wrote:
> The following is strange but at least understandable:
>
> ? exp(10^-300)
> %2 = 1.000000000000000000000000000
> ? %-1
> %3 = 1.000000000000000000000000000 E-300
> ? % - 10^-300
> %4 = 1.34971959 E-329
>
> So exp of very small numbers are computed to large precision (I assume
> because it is possible!) But then cos should work the same way, but it
> doesn't:
>
> ? cos(10^-300)
> %5 = 1.000000000000000000000000000
> ? %-1
> %6 = -4.999999999999999999708086868 E-601
>
> well sort of, but that isn't .5 to relative precision 28. It looks worse
> if you up the precision:
>
> ? default(realprecision,100)
>    realprecision = 105 significant digits (100 digits displayed)
> ? cos(10^-300) - (1 - 10^-600/2)
> %11 =
> 2.91913131511413537189539175501010675755770891175910936852001807591773586414884430473814008517840
> E-620
>
> Shouldn't this be about 10^-700?
>
> I'm using
>                  GP/PARI CALCULATOR Version 2.1.1 (released)
>                 UltraSparc (MicroSparc kernel) 32-bit version
>                 (readline disabled, extended help available)
>
> but I believe this behaviour is VERY old.

I have fixed this relatively recently [04/2002 says CVS. I had not yet
decided to report as much as possible to pari-dev]: from CHANGES

Done for version 2.2.3 (released 10/06/2002):
   47- sin(1e-100) ---> 9.999999999999999999735998397 E-101 [ precision loss ]

Since this involved changes to lots of functions, and the problem was not
crucial [ nobody had complained for, say 15 years], I have not backported the
patches to the stable version (and don't intend to).

    Karim.
-- 
Karim Belabas                    Tel: (+33) (0)1 69 15 57 48
Dép. de Mathematiques, Bat. 425  Fax: (+33) (0)1 69 15 60 19
Université Paris-Sud             Email: Karim.Belabas@math.u-psud.fr
F-91405 Orsay (France)           http://www.math.u-psud.fr/~belabas/
--
PARI/GP Home Page: http://www.parigp-home.de/