[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 39/85: positive?, negative? use integer lib
From: |
Andy Wingo |
Subject: |
[Guile-commits] 39/85: positive?, negative? use integer lib |
Date: |
Thu, 13 Jan 2022 03:40:19 -0500 (EST) |
wingo pushed a commit to branch main
in repository guile.
commit f507c97380b1ac51d963b300f0b52e5edf329ff4
Author: Andy Wingo <wingo@pobox.com>
AuthorDate: Tue Jan 4 13:59:46 2022 +0100
positive?, negative? use integer lib
* libguile/numbers.c (scm_positive_p, scm_negative_p): Use integer lib.
---
libguile/numbers.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 6aa944111..54d2f0a51 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -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))
- [Guile-commits] 78/85: Optimize bignum subtraction, (continued)
- [Guile-commits] 78/85: Optimize bignum subtraction, Andy Wingo, 2022/01/13
- [Guile-commits] 70/85: Fix bug when making mpz from 0, Andy Wingo, 2022/01/13
- [Guile-commits] 83/85: Don't use HAVE_COPYSIGN in libguile/numbers.c, Andy Wingo, 2022/01/13
- [Guile-commits] 20/85: Implement lcm with new integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 22/85: Implement scm_logior with new integer library, Andy Wingo, 2022/01/13
- [Guile-commits] 30/85: Implement scm_bit_extract with new integer library, Andy Wingo, 2022/01/13
- [Guile-commits] 28/85: Reimplement integer-expt in Scheme, Andy Wingo, 2022/01/13
- [Guile-commits] 15/85: Implement centered-divide with new integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 32/85: Integer library takes bignums via opaque struct pointer, Andy Wingo, 2022/01/13
- [Guile-commits] 38/85: Clean up <, reimplement in terms of integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 39/85: positive?, negative? use integer lib,
Andy Wingo <=
- [Guile-commits] 41/85: Clean up scm_sum, Andy Wingo, 2022/01/13
- [Guile-commits] 43/85: Simplify scm_product, use integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 44/85: Remove support for allowing exact numbers to be divided by zero, Andy Wingo, 2022/01/13
- [Guile-commits] 45/85: Clean up scm_divide, Andy Wingo, 2022/01/13
- [Guile-commits] 46/85: Fix deprecated bit-count* when counting 0 bits, Andy Wingo, 2022/01/13
- [Guile-commits] 48/85: Reimplement scm_is_{un, }signed_integer for bignums, Andy Wingo, 2022/01/13
- [Guile-commits] 54/85: scm_to_mpz uses integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 51/85: Reimplement scm_{to,from}_{int64,uint64}, Andy Wingo, 2022/01/13
- [Guile-commits] 52/85: Implement scm_{to,from}_wchar inline, Andy Wingo, 2022/01/13
- [Guile-commits] 58/85: Remove dead bignum frexp code from numbers.c, Andy Wingo, 2022/01/13