Re: equality of t_INTMODs

Denis Simon <[email protected]>
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <[email protected]>
Hi all,

if I understand well the discussion, the relation == is not transitive, but === is.
Example : 
Mod(14,20) == Mod(39,55) == Mod(4,20)
but not Mod(14,20) and Mod(4,20) 

Denis SIMON.

----- Mail original -----
> De: "Karim Belabas" <[email protected]>
> À: "Max Alekseyev" <[email protected]>
> Cc: "Pari Users" <[email protected]>
> Envoyé: Vendredi 24 Janvier 2025 17:23:14
> Objet: Re: equality of t_INTMODs

> Hi Max,
> 
>  we recommend using
> 
>   a === b (is identical to)
> 
> rather than the much more liberal and more costly
> 
>   a == b (is equal to; in the sense of "there is a natural map sending a
>           to the domain of b or sending b to the domain of a, such that the
>           comparison makes sense and equality holds")
> 
> Cheers,
> 
>    K.B.
> 
> * Max Alekseyev [2025-01-24 17:11]:
>> Hi Karim,
>> 
>> After the fix we have
>> 
>> ? Mod(14,20) == Mod(39,55)
>> %1 = 1
>> 
>> I understand why, but nevertheless it looks very confusing.
>> 
>> Regards,
>> Max
>> 
>> 
>> On Fri, Jan 24, 2025 at 10:58 AM Karim Belabas <
>> [email protected]> wrote:
>> 
>> > Hi Max,
>> >
>> > * Max Alekseyev [2025-01-24 16:12]:
>> > > In view of a recently discovered issue in Sage (
>> > > https://github.com/sagemath/sage/issues/39372), I'd like to check how
>> > the
>> > > following two (in)equalities co-exist in PARI/GP. Do they violate any
>> > > design conventions and/or represent a notable exception to those?
>> > >
>> > > ? Mod(14,20) == Mod(39,55)
>> > > %1 = 0
>> > > ? Mod(14,20) - Mod(39,55) == 0
>> > > %2 = 1
>> >
>> > They do violate the design convention (x == y iff x - y == 0;
>> > use the === operator for proper equality without implicit coercion).
>> >
>> > t_POLMOD had the same issue. Both issues are now fixed in 'master'.
>> >
>> > Cheers,
>> >
>> >     K.B.
>> > --
>> > Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
>> > Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
>> > http://www.math.u-bordeaux.fr/~kbelabas/
>> >
> 
>    K.B.
> --
> Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
> Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
> http://www.math.u-bordeaux.fr/~kbelabas/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.