Re: why is this happening?

Loïc Grenié <[email protected]> Sat, 2 May 2026 07:43:12 +0200
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <CAMLkfFTTxAXJtp9AoBMd2Fuhazenay6AQ2GUS1zqheZOqHFQyw@mail.gmail.com>
--0000000000002151c90650cf2d9a
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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 =3D=3D.

     Hope this helps,

         Lo=C3=AFc

--0000000000002151c90650cf2d9a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:verdana,sans-serif">On Sat=C2=A02 May, 2026, at 02:31, American Ci=
tizen wrote:</div></div><div class=3D"gmail_quote gmail_quote_container"><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">? Vecsmall([1]) - Vecsmall(=
[1])<br>
=C2=A0=C2=A0 ***=C2=A0 =C2=A0at top-level: Vecsmall([1])-Vecsmall([1])<br>
=C2=A0=C2=A0 ***=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^--------------<br>
=C2=A0=C2=A0 *** _-_: forbidden addition t_VECSMALL + t_VECSMALL.<br>
=C2=A0=C2=A0 ***=C2=A0 =C2=A0Break loop: type &#39;break&#39; to go back to=
 GP prompt<br>
break&gt;<br>
<br>
Can anyone explain why this won&#39;t work?<br>
<br>
Can&#39;t we subtract any element in GP Pari from itself and get 0 or null =
?</blockquote><div><br></div><div style=3D"font-family:verdana,sans-serif" =
class=3D"gmail_default">=C2=A0 =C2=A0 =C2=A0You cannot add/subtract two vec=
smalls, because the sum/difference of</div><div style=3D"font-family:verdan=
a,sans-serif" class=3D"gmail_default">=C2=A0 two (short) integers of 64 bit=
s (32 on 32 bit platforms) can easily overrun</div><div style=3D"font-famil=
y:verdana,sans-serif" class=3D"gmail_default">=C2=A0 64 bits. If you just w=
ant to know whether the 2 vecsmalls are equal, you</div><div style=3D"font-=
family:verdana,sans-serif" class=3D"gmail_default">=C2=A0 can use =3D=3D.</=
div><div style=3D"font-family:verdana,sans-serif" class=3D"gmail_default"><=
br></div><div style=3D"font-family:verdana,sans-serif" class=3D"gmail_defau=
lt">=C2=A0 =C2=A0 =C2=A0Hope this helps,</div><div style=3D"font-family:ver=
dana,sans-serif" class=3D"gmail_default"><br></div><div style=3D"font-famil=
y:verdana,sans-serif" class=3D"gmail_default">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0Lo=C3=AFc</div></div></div>

--0000000000002151c90650cf2d9a--