You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to understand some code in ulong_extras/is_probabprime.c, and I found something unusual. It doesn't seem to be causing any bugs, so either I'm misunderstanding something, or the code is never executed, or it's executed but (unexpectedly?) works.
In the code for n_is_probabprime_lucas, on line 425, n_mulmod_precomp is being called with ninv, which is a ulong created by n_preinvert_limb. But typically n_mulmod_precomp is called with a double generated by n_precompute_inverse instead. That double is typically between 0 and 1, so it's strange that it's cast from a ulong in this case.
Compare the code for n_is_probabprime_fibonacci, on line 258, where n_precompute_inverse is paired with n_mulmod_precomp and n_preinvert_limb with n_mulmod2_preinv, as expected.
Is this intentional?
Thanks,
Mikhail Hogrefe
The text was updated successfully, but these errors were encountered:
Hello,
I'm trying to understand some code in
ulong_extras/is_probabprime.c
, and I found something unusual. It doesn't seem to be causing any bugs, so either I'm misunderstanding something, or the code is never executed, or it's executed but (unexpectedly?) works.In the code for n_is_probabprime_lucas, on line 425, n_mulmod_precomp is being called with
ninv
, which is aulong
created by n_preinvert_limb. But typicallyn_mulmod_precomp
is called with adouble
generated by n_precompute_inverse instead. That double is typically between 0 and 1, so it's strange that it's cast from aulong
in this case.Compare the code for n_is_probabprime_fibonacci, on line 258, where
n_precompute_inverse
is paired withn_mulmod_precomp
andn_preinvert_limb
withn_mulmod2_preinv
, as expected.Is this intentional?
Thanks,
Mikhail Hogrefe
The text was updated successfully, but these errors were encountered: