Re: vecsum a Vecsmall

"Ruud H.G. van Tol" <[email protected]> Sun, 1 Mar 2026 14:00:06 +0100
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <[email protected]>
On 2026-03-01 12:24, Bill Allombert wrote:
 > On Sun, Mar 01, 2026 at 11:55:33AM +0100, Ruud H.G. van Tol wrote:

 >> vecsum() doesn't "transparently allow a t_VECSMALL" yet, or a List(),
 >> where for example vecsearch() and vecsort() do.
 >> As do vecmin(), vecmax(), but their docs don't mention it explicitly.

Should it be mentioned in their documentation?


 >> Is vecsum() more limited on purpose?
 >
 > Not, it is t_VECSMALL which is limited on purpose.
 > We do not want to allow direct arithmetic operations on t_VECSMALL 
components,
 > because they are not well-defined.
 >
 > On the other hand, comparaison is normally fine.

OK, understood.

- - - - - - - - - - - - - -

Somewhat related:

? setisset(Vec([1,2,42]))
%2 = 1

? setisset(Vecsmall([1,2,42]))
%3 = 0

I think that should either return 1, or give an error on bad input-type.
Now it is "serving two masters".

-- Ruud