[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 63/85: Use scm_integer_to_double_z in numbers.c instead
From: |
Andy Wingo |
Subject: |
[Guile-commits] 63/85: Use scm_integer_to_double_z in numbers.c instead of big2dbl |
Date: |
Thu, 13 Jan 2022 03:40:24 -0500 (EST) |
wingo pushed a commit to branch main
in repository guile.
commit 0c502a4d3c75aab1ff40439ccd7bc77de7319abb
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] 43/85: Simplify scm_product, use integer lib, (continued)
- [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
- [Guile-commits] 53/85: Remove unused conv-{u,}integer.i.c, Andy Wingo, 2022/01/13
- [Guile-commits] 63/85: Use scm_integer_to_double_z in numbers.c instead of big2dbl,
Andy Wingo <=
- [Guile-commits] 66/85: Finish srfi-60 port off old scm mpz API, Andy Wingo, 2022/01/13
- [Guile-commits] 74/85: Less pessimal scm_integer_sub_zi, Andy Wingo, 2022/01/13
- [Guile-commits] 76/85: Avoid bignum clone in scm_integer_sub_zz, Andy Wingo, 2022/01/13
- [Guile-commits] 79/85: Optimize scm_integer_mul_ii, Andy Wingo, 2022/01/13
- [Guile-commits] 80/85: Optimize integer-expt for fixnums, Andy Wingo, 2022/01/13
- [Guile-commits] 81/85: Optimize logand against a positive inum, Andy Wingo, 2022/01/13
- [Guile-commits] 82/85: Simplify scm_abs for the real case, Andy Wingo, 2022/01/13
- [Guile-commits] 09/85: Implement ceiling-divide with new integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 08/85: Implement ceiling-remainder with new integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 11/85: Implement truncate-remainder with new integer lib, Andy Wingo, 2022/01/13