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

_______________________________________________
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs

Reply via email to