Peter Bruin on Wed, 12 Feb 2014 13:12:31 +0100


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

precision of result when adding t_REAL with lots of cancellation


Bonjour Denis et pari-dev,

The following issue came up when I tried to apply Denis Simon's
2-descent program for elliptic curves over number fields (ell.gp) to a
certain elliptic curve over the quadratic field with defining polynomial
y^2 - 229.  The linear polynomial b in ZZ[y] below takes positive values
at both roots of y^2 - 229, but one of these values is very small.
Denis's program takes this into account and increases the precision if
b(y) is exactly 0 or has precision less than 10 digits.  In the example
below, there is a huge cancellation between two real numbers that only
differ by one bit, but PARI rounds up the precision to 19 digits.

A quick fix for Denis's program is to increase the bound for the
precision test in ell.gp:nfrealsign() from 10 to 38 digits.  However, I
am wondering if in general the current PARI behaviour of rounding up the
precision of the result of t_REAL + t_REAL is really desirable in cases
where the actual precision is extremely small (say at most four bits).
Would it be reasonable to round the precision _down_ in such cases?
This would mean that in some computations slightly more precision will
be lost than necessary, and maybe this case distinction has a negative
effect on speed, but erring on the side of caution here seems possibly
worthwile here.

Thanks,

Peter


gp > b = -1554544300737274875964190134520312870631312460283689944298138572669148295776039072867720281361776956435252620954745928376624817557704277432961924925312*y + 23524523971732905757341977352314040726186200302188191824300117738073539522011689544444863977622786771332621915440577829842674416407299864303146477224320
gp > K = bnfinit(y^2 - 229);
gp > u=polcoeff(b,1)*K.roots[2]
%167 = -2.3524523971732905757341977352314040726 E151
gp > v=polcoeff(b,0)*1.
%168 = 2.3524523971732905757341977352314040726 E151
gp > u+v
%169 = -7.695704335233296721 E112
gp > precision(u)
%170 = 38
gp > precision(v)
%171 = 38
gp > precision(u+v)
%172 = 19
gp > \x 167
[&=00000000021d9ef0] REAL(lg=4,CLONE):0500000000000004 (-,expo=502):e0000000000001f6 e5f89090ac75f550 1ca006af54bb397b 

gp > \x 168
[&=00000000021da0a0] REAL(lg=4,CLONE):0500000000000004 (+,expo=502):60000000000001f6 e5f89090ac75f550 1ca006af54bb397a