danaj / Math-Prime-Util

Perl (XS) module implementing prime number utilities, including sieves

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possibly misleading error message

hvds opened this issue · comments

In XS.xs:_validate_int() I see:

  if (len == 0 || ptr == 0)  croak("Parameter must be a positive integer");
  if (ptr[0] == '-' && negok) {
    isneg = 1; ptr++; len--;           /* Read negative sign */

It looks like the message should be negok ? "Parameter must be an integer" : "Parameter must be a positive integer".

It looks like that was fixed in February in github, with the same behavior. Those changes also tried to consistently use "non-negative" rather than "positive" unless zero is not allowed.