Opened 18 months ago

Last modified 7 months ago

#28704 new defect

Inconsistent cmp for p-adics

Reported by: saraedum Owned by:
Priority: minor Milestone: sage-9.3
Component: padics Keywords: cmp
Cc: roed, slelievre, xcaruso Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


As reported in 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.

The problem seems to be in ccmp doing the following

    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.

Change History (3)

comment:1 Changed 16 months ago by embray

  • Milestone changed from sage-9.0 to sage-9.1

Ticket retargeted after milestone closed

comment:2 Changed 12 months ago by mkoeppe

  • Milestone changed from sage-9.1 to sage-9.2

Moving tickets to milestone sage-9.2 based on a review of last modification date, branch status, and severity.

comment:3 Changed 7 months ago by mkoeppe

  • Milestone changed from sage-9.2 to sage-9.3
Note: See TracTickets for help on using tickets.