On Sat, Apr 11, 2015 at 11:10:33AM +0200, Karim Belabas wrote:
> * Chris De Corte [2015-04-11 10:32]:
> > I get the following error:
> > cos: precision too low in mpsc1
> >
> > What can you recommend me please?
>
> Assuming the error is something like
>
> (10:53) gp > \p38
> (10:53) gp > cos(1e100)
> *** at top-level: cos(1e100)
> *** ^----------
> *** cos: precision too low in mpcosm1.
>
> then the error means that the input accuracy is simply to small to compute
> anything at all about the result.
>
> Most other systems (e.g. mpfr) consider that the input is exact, and can thus
> be completed by any number of trailing zeroes.
... in base 2, not 10, of course,
so for example with IEEE754 double (53bit precision),
1e100 is completed to 10295115178936058*2^(332-53)
and not to 10^100
and IEEE754 gives cos(1e100) = 0.9247242388
which is almost the opposite of the value of
cos(10^100) = -0.9280819050
> But PARI floats may represent
> any real number in some range (see paragraph 2.3.2 in GP user's manual). In
> this case [1e100 (1 - 1-e-38), 1e100 (1 + 1-e-38)], an nothing can be said
> about the result except that it's between -1 and 1, which does not even
> bound its exponent !
>
> The simplest solution is to increase the default precision
>
> (10:54) gp > \p200
> realprecision = 211 significant digits (200 digits displayed)
> (10:54) gp > cos(1e100)
> %1 = -0.92808190507465534345619464377695592818318207643905039332511420954252122203079670126138117700511187183691887194853024728615605695907677892307983039507078619377572991288890406946861814031710664466671099
>
> Note that this only increases the accuracy of *subsequent* inputs.
And alternatively in this case you can give the input as an exact rational
number:
? cos(10^100)
%1 = -0.92808190507465534345619464377695592818
Cheers,
Bill.