[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 64/69: Use scm_integer_to_double_z in numbers.c instead
From: |
Andy Wingo |
Subject: |
[Guile-commits] 64/69: Use scm_integer_to_double_z in numbers.c instead of big2dbl |
Date: |
Fri, 7 Jan 2022 08:27:27 -0500 (EST) |
wingo pushed a commit to branch wip-inline-digits
in repository guile.
commit 7f39e35bdc67d65c59b511ff1be33a0e52535355
Author: Andy Wingo <wingo@pobox.com>
AuthorDate: Fri Jan 7 11:33:34 2022 +0100
Use scm_integer_to_double_z in numbers.c instead of big2dbl
* libguile/numbers.c: Use internal function instead of big2dbl which we
will deprecate.
---
libguile/numbers.c | 43 ++++++++++++++++++++++---------------------
1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/libguile/numbers.c b/libguile/numbers.c
index b2d78a694..0b09d0d8e 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -1072,7 +1072,7 @@ SCM_PRIMITIVE_GENERIC (scm_floor_quotient,
"floor-quotient", 2, 0, 0,
return scm_integer_floor_quotient_zz (scm_bignum (x), scm_bignum (y));
else if (SCM_REALP (y))
return scm_i_inexact_floor_quotient
- (scm_i_big2dbl (x), SCM_REAL_VALUE (y));
+ (scm_integer_to_double_z (scm_bignum (x)), SCM_REAL_VALUE (y));
else if (SCM_FRACTIONP (y))
return scm_i_exact_rational_floor_quotient (x, y);
else
@@ -1164,7 +1164,7 @@ SCM_PRIMITIVE_GENERIC (scm_floor_remainder,
"floor-remainder", 2, 0, 0,
return scm_integer_floor_remainder_zz (scm_bignum (x), scm_bignum (y));
else if (SCM_REALP (y))
return scm_i_inexact_floor_remainder
- (scm_i_big2dbl (x), SCM_REAL_VALUE (y));
+ (scm_integer_to_double_z (scm_bignum (x)), SCM_REAL_VALUE (y));
else if (SCM_FRACTIONP (y))
return scm_i_exact_rational_floor_remainder (x, y);
else
@@ -1280,7 +1280,8 @@ scm_floor_divide (SCM x, SCM y, SCM *qp, SCM *rp)
else if (SCM_BIGP (y))
scm_integer_floor_divide_zz (scm_bignum (x), scm_bignum (y), qp, rp);
else if (SCM_REALP (y))
- scm_i_inexact_floor_divide (scm_i_big2dbl (x), SCM_REAL_VALUE (y),
+ scm_i_inexact_floor_divide (scm_integer_to_double_z (scm_bignum (x)),
+ SCM_REAL_VALUE (y),
qp, rp);
else if (SCM_FRACTIONP (y))
scm_i_exact_rational_floor_divide (x, y, qp, rp);
@@ -1380,7 +1381,7 @@ SCM_PRIMITIVE_GENERIC (scm_ceiling_quotient,
"ceiling-quotient", 2, 0, 0,
return scm_integer_ceiling_quotient_zz (scm_bignum (x), scm_bignum
(y));
else if (SCM_REALP (y))
return scm_i_inexact_ceiling_quotient
- (scm_i_big2dbl (x), SCM_REAL_VALUE (y));
+ (scm_integer_to_double_z (scm_bignum (x)), SCM_REAL_VALUE (y));
else if (SCM_FRACTIONP (y))
return scm_i_exact_rational_ceiling_quotient (x, y);
else
@@ -1476,7 +1477,7 @@ SCM_PRIMITIVE_GENERIC (scm_ceiling_remainder,
"ceiling-remainder", 2, 0, 0,
scm_bignum (y));
else if (SCM_REALP (y))
return scm_i_inexact_ceiling_remainder
- (scm_i_big2dbl (x), SCM_REAL_VALUE (y));
+ (scm_integer_to_double_z (scm_bignum (x)), SCM_REAL_VALUE (y));
else if (SCM_FRACTIONP (y))
return scm_i_exact_rational_ceiling_remainder (x, y);
else
@@ -1591,8 +1592,8 @@ scm_ceiling_divide (SCM x, SCM y, SCM *qp, SCM *rp)
else if (SCM_BIGP (y))
scm_integer_ceiling_divide_zz (scm_bignum (x), scm_bignum (y), qp, rp);
else if (SCM_REALP (y))
- scm_i_inexact_ceiling_divide (scm_i_big2dbl (x), SCM_REAL_VALUE (y),
- qp, rp);
+ scm_i_inexact_ceiling_divide (scm_integer_to_double_z (scm_bignum (x)),
+ SCM_REAL_VALUE (y), qp, rp);
else if (SCM_FRACTIONP (y))
scm_i_exact_rational_ceiling_divide (x, y, qp, rp);
else
@@ -1695,7 +1696,7 @@ SCM_PRIMITIVE_GENERIC (scm_truncate_quotient,
"truncate-quotient", 2, 0, 0,
scm_bignum (y));
else if (SCM_REALP (y))
return scm_i_inexact_truncate_quotient
- (scm_i_big2dbl (x), SCM_REAL_VALUE (y));
+ (scm_integer_to_double_z (scm_bignum (x)), SCM_REAL_VALUE (y));
else if (SCM_FRACTIONP (y))
return scm_i_exact_rational_truncate_quotient (x, y);
else
@@ -1791,7 +1792,7 @@ SCM_PRIMITIVE_GENERIC (scm_truncate_remainder,
"truncate-remainder", 2, 0, 0,
scm_bignum (y));
else if (SCM_REALP (y))
return scm_i_inexact_truncate_remainder
- (scm_i_big2dbl (x), SCM_REAL_VALUE (y));
+ (scm_integer_to_double_z (scm_bignum (x)), SCM_REAL_VALUE (y));
else if (SCM_FRACTIONP (y))
return scm_i_exact_rational_truncate_remainder (x, y);
else
@@ -1909,8 +1910,8 @@ scm_truncate_divide (SCM x, SCM y, SCM *qp, SCM *rp)
else if (SCM_BIGP (y))
scm_integer_truncate_divide_zz (scm_bignum (x), scm_bignum (y), qp,
rp);
else if (SCM_REALP (y))
- scm_i_inexact_truncate_divide (scm_i_big2dbl (x), SCM_REAL_VALUE (y),
- qp, rp);
+ scm_i_inexact_truncate_divide (scm_integer_to_double_z (scm_bignum (x)),
+ SCM_REAL_VALUE (y), qp, rp);
else if (SCM_FRACTIONP (y))
scm_i_exact_rational_truncate_divide (x, y, qp, rp);
else
@@ -2014,7 +2015,7 @@ SCM_PRIMITIVE_GENERIC (scm_centered_quotient,
"centered-quotient", 2, 0, 0,
scm_bignum (y));
else if (SCM_REALP (y))
return scm_i_inexact_centered_quotient
- (scm_i_big2dbl (x), SCM_REAL_VALUE (y));
+ (scm_integer_to_double_z (scm_bignum (x)), SCM_REAL_VALUE (y));
else if (SCM_FRACTIONP (y))
return scm_i_exact_rational_centered_quotient (x, y);
else
@@ -2115,7 +2116,7 @@ SCM_PRIMITIVE_GENERIC (scm_centered_remainder,
"centered-remainder", 2, 0, 0,
scm_bignum (y));
else if (SCM_REALP (y))
return scm_i_inexact_centered_remainder
- (scm_i_big2dbl (x), SCM_REAL_VALUE (y));
+ (scm_integer_to_double_z (scm_bignum (x)), SCM_REAL_VALUE (y));
else if (SCM_FRACTIONP (y))
return scm_i_exact_rational_centered_remainder (x, y);
else
@@ -2238,8 +2239,8 @@ scm_centered_divide (SCM x, SCM y, SCM *qp, SCM *rp)
else if (SCM_BIGP (y))
scm_integer_centered_divide_zz (scm_bignum (x), scm_bignum (y), qp,
rp);
else if (SCM_REALP (y))
- scm_i_inexact_centered_divide (scm_i_big2dbl (x), SCM_REAL_VALUE (y),
- qp, rp);
+ scm_i_inexact_centered_divide (scm_integer_to_double_z (scm_bignum (x)),
+ SCM_REAL_VALUE (y), qp, rp);
else if (SCM_FRACTIONP (y))
scm_i_exact_rational_centered_divide (x, y, qp, rp);
else
@@ -2346,7 +2347,7 @@ SCM_PRIMITIVE_GENERIC (scm_round_quotient,
"round-quotient", 2, 0, 0,
return scm_integer_round_quotient_zz (scm_bignum (x), scm_bignum (y));
else if (SCM_REALP (y))
return scm_i_inexact_round_quotient
- (scm_i_big2dbl (x), SCM_REAL_VALUE (y));
+ (scm_integer_to_double_z (scm_bignum (x)), SCM_REAL_VALUE (y));
else if (SCM_FRACTIONP (y))
return scm_i_exact_rational_round_quotient (x, y);
else
@@ -2443,7 +2444,7 @@ SCM_PRIMITIVE_GENERIC (scm_round_remainder,
"round-remainder", 2, 0, 0,
return scm_integer_round_remainder_zz (scm_bignum (x), scm_bignum (y));
else if (SCM_REALP (y))
return scm_i_inexact_round_remainder
- (scm_i_big2dbl (x), SCM_REAL_VALUE (y));
+ (scm_integer_to_double_z (scm_bignum (x)), SCM_REAL_VALUE (y));
else if (SCM_FRACTIONP (y))
return scm_i_exact_rational_round_remainder (x, y);
else
@@ -2564,8 +2565,8 @@ scm_round_divide (SCM x, SCM y, SCM *qp, SCM *rp)
else if (SCM_BIGP (y))
scm_integer_round_divide_zz (scm_bignum (x), scm_bignum (y), qp, rp);
else if (SCM_REALP (y))
- scm_i_inexact_round_divide (scm_i_big2dbl (x), SCM_REAL_VALUE (y),
- qp, rp);
+ scm_i_inexact_round_divide (scm_integer_to_double_z (scm_bignum (x)),
+ SCM_REAL_VALUE (y), qp, rp);
else if (SCM_FRACTIONP (y))
scm_i_exact_rational_round_divide (x, y, qp, rp);
else
@@ -6349,7 +6350,7 @@ SCM_PRIMITIVE_GENERIC (scm_exact_to_inexact,
"exact->inexact", 1, 0, 0,
if (SCM_I_INUMP (z))
return scm_i_from_double ((double) SCM_I_INUM (z));
else if (SCM_BIGP (z))
- return scm_i_from_double (scm_i_big2dbl (z));
+ return scm_i_from_double (scm_integer_to_double_z (scm_bignum (z)));
else if (SCM_FRACTIONP (z))
return scm_i_from_double (scm_i_fraction2double (z));
else if (SCM_INEXACTP (z))
@@ -6967,7 +6968,7 @@ scm_to_double (SCM val)
if (SCM_I_INUMP (val))
return SCM_I_INUM (val);
else if (SCM_BIGP (val))
- return scm_i_big2dbl (val);
+ return scm_integer_to_double_z (scm_bignum (val));
else if (SCM_FRACTIONP (val))
return scm_i_fraction2double (val);
else if (SCM_REALP (val))
- [Guile-commits] 47/69: Fix deprecated bit-count* when counting 0 bits, (continued)
- [Guile-commits] 47/69: Fix deprecated bit-count* when counting 0 bits, Andy Wingo, 2022/01/07
- [Guile-commits] 49/69: Reimplement scm_is_{un, }signed_integer for bignums, Andy Wingo, 2022/01/07
- [Guile-commits] 51/69: Reimplement scm_{to,from}_{int32,uint32}, Andy Wingo, 2022/01/07
- [Guile-commits] 45/69: Remove support for allowing exact numbers to be divided by zero, Andy Wingo, 2022/01/07
- [Guile-commits] 50/69: Reimplement scm_from_int8 etc, Andy Wingo, 2022/01/07
- [Guile-commits] 56/69: Reimplement exact-integer-sqrt with integers.[ch], Andy Wingo, 2022/01/07
- [Guile-commits] 55/69: scm_to_mpz uses integer lib, Andy Wingo, 2022/01/07
- [Guile-commits] 62/69: Remove last non-admin SCM_I_BIG_MPZ uses in numbers.c, Andy Wingo, 2022/01/07
- [Guile-commits] 61/69: Simplify scm_exact_integer_quotient, Andy Wingo, 2022/01/07
- [Guile-commits] 63/69: Simplify magnitude, angle, Andy Wingo, 2022/01/07
- [Guile-commits] 64/69: Use scm_integer_to_double_z in numbers.c instead of big2dbl,
Andy Wingo <=
- [Guile-commits] 67/69: Finish srfi-60 port off old scm mpz API, Andy Wingo, 2022/01/07
- [Guile-commits] 66/69: Start porting srfi-60 off the bad bignum interfaces, Andy Wingo, 2022/01/07
- [Guile-commits] 69/69: Bignums avoid both custom GMP allocator and finalizers, Andy Wingo, 2022/01/07
- [Guile-commits] 68/69: scm_to_ipv6 uses scm_to_mpz, Andy Wingo, 2022/01/07