Loïc Grenié on Sat, 02 May 2026 07:43:28 +0200


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

Re: why is this happening?


On Sat 2 May, 2026, at 02:31, American Citizen wrote:
? Vecsmall([1]) - Vecsmall([1])
   ***   at top-level: Vecsmall([1])-Vecsmall([1])
   ***                              ^--------------
   *** _-_: forbidden addition t_VECSMALL + t_VECSMALL.
   ***   Break loop: type 'break' to go back to GP prompt
break>

Can anyone explain why this won't work?

Can't we subtract any element in GP Pari from itself and get 0 or null ?

     You cannot add/subtract two vecsmalls, because the sum/difference of
  two (short) integers of 64 bits (32 on 32 bit platforms) can easily overrun
  64 bits. If you just want to know whether the 2 vecsmalls are equal, you
  can use ==.

     Hope this helps,

         Loïc