Open saraedum opened 4 years ago
As reported in https://ask.sagemath.org/question/48658/possible-bug-in-_cmp_-function/ cmp is inconsistent for p-adics, i.e., a<b does not imply b>a. While ordering p-adics has no deep meaning, it should at least be consistent.
cmp
a<b
b>a
The problem seems to be in ccmp doing the following
ccmp
mpz_sub(holder.value, a, b) mpz_mod(holder.value, holder.value, prime_pow.pow_mpz_t_tmp(prec)) return mpz_sgn(holder.value)
But mpz_mod is always non-negative.
CC: @roed314 @slel @xcaruso
Component: padics
Keywords: cmp
Issue created by migration from https://trac.sagemath.org/ticket/28704
Ticket retargeted after milestone closed
Moving tickets to milestone sage-9.2 based on a review of last modification date, branch status, and severity.
Moving to 9.4, as 9.3 has been released.
As reported in https://ask.sagemath.org/question/48658/possible-bug-in-_cmp_-function/
cmp
is inconsistent for p-adics, i.e.,a<b
does not implyb>a
. While ordering p-adics has no deep meaning, it should at least be consistent.The problem seems to be in
ccmp
doing the followingBut mpz_mod is always non-negative.
CC: @roed314 @slel @xcaruso
Component: padics
Keywords: cmp
Issue created by migration from https://trac.sagemath.org/ticket/28704