Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PP sqrtmod(-a, n) fails #51

Open
hvds opened this issue Jun 4, 2021 · 1 comment
Open

PP sqrtmod(-a, n) fails #51

hvds opened this issue Jun 4, 2021 · 1 comment

Comments

@hvds
Copy link
Contributor

hvds commented Jun 4, 2021

% $PERL -MMath::Prime::Util -wle 'print $Math::Prime::Util::VERSION'
0.73
% $PERL -MMath::Prime::Util=sqrtmod -wle 'print sqrtmod(-1, 17) // "undef"'
4
% MPU_NO_XS=1 $PERL -MMath::Prime::Util=sqrtmod -wle 'print sqrtmod(-1, 17) // "undef"'
undef
% 

Found by observation of the code. I didn't check if negative modulus was supposed to be supported, that may also be a problem.

@danaj
Copy link
Owner

danaj commented Jun 5, 2021

Also seems to be fixed in the sqrtmod / rootmod rewrite. Negative inputs are supported, and the documentation indicates we'll use the absolute value (just like Pari/GP). I tried to be more consistent with the *mod functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants