mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 22:10:21 +02:00
(scm_modular_expt): Return a negative remainder for a
negative divisor, the same as `modulo' does.
This commit is contained in:
parent
d6628681cd
commit
b7b8c57576
1 changed files with 4 additions and 0 deletions
|
@ -1626,6 +1626,10 @@ SCM_DEFINE (scm_modular_expt, "modulo-expt", 3, 0, 0,
|
|||
n_tmp,
|
||||
k_tmp,
|
||||
m_tmp);
|
||||
|
||||
if (mpz_sgn (m_tmp) < 0 && mpz_sgn (SCM_I_BIG_MPZ (result)) != 0)
|
||||
mpz_add (SCM_I_BIG_MPZ (result), SCM_I_BIG_MPZ (result), m_tmp);
|
||||
|
||||
cleanup:
|
||||
mpz_clear (m_tmp);
|
||||
mpz_clear (k_tmp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue