| Bill Allombert on Thu, 09 Oct 2014 17:37:28 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| experimental localprec() feature |
Dear PARI developpers,
I have created an experimental git branch bill-localprec that adds a command
localprec() which allow to set the real precision locally:
Consider the function:
f(s)=Pi^s
and
s=precision(1.,100)
Pi is computed using the current precision.
If we want the resut to be correct to the precision of s,
we could do
g(s)=
{ my(prec=default(realprecision));
default(realprecision,precision(s));
my(r=Pi^s);
default(realprecision,prec);
r;
}
which is rather cumbersome. Using localprec() it is sufficient to say:
g(s)=localprec(precision(s));Pi^s
Also it is safer since the value of realprecision is restored even if an error
occurs.
Cheers,
Bill.