Karim Belabas on Fri, 24 Jan 2025 18:11:40 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: equality of t_INTMODs |
* Max Alekseyev [2025-01-24 17:56]: > Hi Karim, > > On "===" vs "==", what are other notable cases when the two give different > results? There are many: ? 1. == 0E38 \\ at default precision %1 = 1 ? [] == 0 %2 = 1 ? 1 == [1,0,0]~ %3 = 1 ? Mod(1,2) == 1 %4 = 1 etc. > Do I understand correctly, that internally functions in PARI/GP, such as > setsearch(), rely on "===" rather than "=="? Mostly yes. They rely on cmp(), which is a universal comparison function. Mathematically meaningless but transitive, and it guarantees cmp(x,y) == 0 if and only if x === y 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/