1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 13:30:26 +02:00

Remove last non-admin SCM_I_BIG_MPZ uses in numbers.c

* libguile/numbers.c (scm_magnitude, scm_angle): Use integers lib.
This commit is contained in:
Andy Wingo 2022-01-07 11:21:41 +01:00
parent a4524da8c1
commit 3d56a90736

View file

@ -6327,12 +6327,10 @@ SCM_PRIMITIVE_GENERIC (scm_magnitude, "magnitude", 1, 0, 0,
} }
else if (SCM_BIGP (z)) else if (SCM_BIGP (z))
{ {
int sgn = mpz_sgn (SCM_I_BIG_MPZ (z)); if (scm_is_integer_negative_z (scm_bignum (z)))
scm_remember_upto_here_1 (z); return scm_integer_negate_z (scm_bignum (z));
if (sgn < 0)
return scm_i_clonebig (z, 0);
else else
return z; return z;
} }
else if (SCM_REALP (z)) else if (SCM_REALP (z))
return scm_i_from_double (fabs (SCM_REAL_VALUE (z))); return scm_i_from_double (fabs (SCM_REAL_VALUE (z)));
@ -6371,9 +6369,7 @@ SCM_PRIMITIVE_GENERIC (scm_angle, "angle", 1, 0, 0,
} }
else if (SCM_BIGP (z)) else if (SCM_BIGP (z))
{ {
int sgn = mpz_sgn (SCM_I_BIG_MPZ (z)); if (scm_is_integer_negative_z (scm_bignum (z)))
scm_remember_upto_here_1 (z);
if (sgn < 0)
return scm_i_from_double (atan2 (0.0, -1.0)); return scm_i_from_double (atan2 (0.0, -1.0));
else else
return flo0; return flo0;