[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 61/85: Remove last non-admin SCM_I_BIG_MPZ uses in numbe
From: |
Andy Wingo |
Subject: |
[Guile-commits] 61/85: Remove last non-admin SCM_I_BIG_MPZ uses in numbers.c |
Date: |
Thu, 13 Jan 2022 03:40:23 -0500 (EST) |
wingo pushed a commit to branch main
in repository guile.
commit 3d56a907368054d27293bf9925ae90e5766c668b
Author: Andy Wingo <wingo@pobox.com>
AuthorDate: Fri Jan 7 11:21:41 2022 +0100
Remove last non-admin SCM_I_BIG_MPZ uses in numbers.c
* libguile/numbers.c (scm_magnitude, scm_angle): Use integers lib.
---
libguile/numbers.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 280a91ab4..9575df09c 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -6327,12 +6327,10 @@ SCM_PRIMITIVE_GENERIC (scm_magnitude, "magnitude", 1,
0, 0,
}
else if (SCM_BIGP (z))
{
- int sgn = mpz_sgn (SCM_I_BIG_MPZ (z));
- scm_remember_upto_here_1 (z);
- if (sgn < 0)
- return scm_i_clonebig (z, 0);
+ if (scm_is_integer_negative_z (scm_bignum (z)))
+ return scm_integer_negate_z (scm_bignum (z));
else
- return z;
+ return z;
}
else if (SCM_REALP (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))
{
- int sgn = mpz_sgn (SCM_I_BIG_MPZ (z));
- scm_remember_upto_here_1 (z);
- if (sgn < 0)
+ if (scm_is_integer_negative_z (scm_bignum (z)))
return scm_i_from_double (atan2 (0.0, -1.0));
else
return flo0;
- [Guile-commits] 73/85: Optimize scm_integer_mul_zz., (continued)
- [Guile-commits] 73/85: Optimize scm_integer_mul_zz., Andy Wingo, 2022/01/13
- [Guile-commits] 84/85: Have log and log10(real nan) return real nan regardless of sign, Andy Wingo, 2022/01/13
- [Guile-commits] 85/85: Remove dead code in scm_integer_inexact_sqrt_z, Andy Wingo, 2022/01/13
- [Guile-commits] 24/85: Implement scm_logtest with new integer library, Andy Wingo, 2022/01/13
- [Guile-commits] 13/85: Implement centered-quotient with new integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 23/85: Implement scm_logxor with new integer library, Andy Wingo, 2022/01/13
- [Guile-commits] 19/85: Implement gcd with new integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 57/85: Expose frexp from integers lib, Andy Wingo, 2022/01/13
- [Guile-commits] 59/85: divide2double refactor, Andy Wingo, 2022/01/13
- [Guile-commits] 60/85: Simplify scm_exact_integer_quotient, Andy Wingo, 2022/01/13
- [Guile-commits] 61/85: Remove last non-admin SCM_I_BIG_MPZ uses in numbers.c,
Andy Wingo <=
- [Guile-commits] 64/85: Avoid scm_i_mkbig outside numbers.c., Andy Wingo, 2022/01/13
- [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