1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-29 22:40:34 +02:00

positive?, negative? use integer lib

* libguile/numbers.c (scm_positive_p, scm_negative_p): Use integer lib.
This commit is contained in:
Andy Wingo 2022-01-04 13:59:46 +01:00
parent 54d7722523
commit f507c97380

View file

@ -4974,11 +4974,7 @@ SCM_PRIMITIVE_GENERIC (scm_positive_p, "positive?", 1, 0, 0,
if (SCM_I_INUMP (x))
return scm_from_bool (SCM_I_INUM (x) > 0);
else if (SCM_BIGP (x))
{
int sgn = mpz_sgn (SCM_I_BIG_MPZ (x));
scm_remember_upto_here_1 (x);
return scm_from_bool (sgn > 0);
}
return scm_from_bool (scm_is_integer_positive_z (scm_bignum (x)));
else if (SCM_REALP (x))
return scm_from_bool(SCM_REAL_VALUE (x) > 0.0);
else if (SCM_FRACTIONP (x))
@ -4998,11 +4994,7 @@ SCM_PRIMITIVE_GENERIC (scm_negative_p, "negative?", 1, 0, 0,
if (SCM_I_INUMP (x))
return scm_from_bool (SCM_I_INUM (x) < 0);
else if (SCM_BIGP (x))
{
int sgn = mpz_sgn (SCM_I_BIG_MPZ (x));
scm_remember_upto_here_1 (x);
return scm_from_bool (sgn < 0);
}
return scm_from_bool (scm_is_integer_negative_z (scm_bignum (x)));
else if (SCM_REALP (x))
return scm_from_bool(SCM_REAL_VALUE (x) < 0.0);
else if (SCM_FRACTIONP (x))