Leading zeroes

weird.attractor at gmail.com weird.attractor at gmail.com
Thu Mar 28 20:15:59 CET 2024


Hello GMP team,

Thank you for making your wonderful software freely available!

I encountered a bug while running the R version. While the isprime()
function usually is able to handle strings, it apparently gets confused if
there are leading zeroes.

> gmpVersion()

[1] '6.3.0'

> isprime("45") #correct
[1] 0
> isprime("045") #wrong
[1] 2
> isprime("000045")
[1] 2

 

Within R, this is easily fixed by converting the string to a numeric before
calling isprime(), but I didn't see anywhere in the manual that warns of
this behavior.

> isprime(as.numeric("045"))
[1] 0

 

Thank you again,

Dr. Christian Anderson



More information about the gmp-bugs mailing list