Bill Allombert on Sat, 30 Oct 1999 12:27:27 +0200 (MET DST)


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

Re: sqr() bug?


Thank you to participate to the bug-killing project, it' the first
report since last week.

>  sqr(x): square of x. Not identical to x*x in
>the case of 2-adics, where it returns a more precise result.  
>gp> (5+O(2^10))^2 
> %1 = 1 + 2^3 + 2^4 + O(2^11) 
>gp> sqr(5+O(2^10))
> %2 = 1 +2^3 + 2^4 + O(2^11)

There is no bug here:
gp> (5+O(2^10))*(5+O(2^10))
%3 = 1 + 2^3 + 2^4 + O(2^10)

Of course powering function use squaring as much as possible.
In fact gmul check if its arguments have the same memory adress,
and use gsqr in this case,so
gp> a=5+O(2^10);
gp> a*a
%4 = 1 + 2^3 + 2^4 + O(2^11)  

Perhaps it is a bug, perhaps not.

Bill.