[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 58/85: Remove dead bignum frexp code from numbers.c
From: |
Andy Wingo |
Subject: |
[Guile-commits] 58/85: Remove dead bignum frexp code from numbers.c |
Date: |
Thu, 13 Jan 2022 03:40:23 -0500 (EST) |
wingo pushed a commit to branch main
in repository guile.
commit c06fc3df545cd1dc3a418956112294c8db5254c6
Author: Andy Wingo <wingo@pobox.com>
AuthorDate: Fri Jan 7 10:37:29 2022 +0100
Remove dead bignum frexp code from numbers.c
* libguile/numbers.c (scm_i_big2dbl_2exp): Remove unused function.
---
libguile/numbers.c | 46 ----------------------------------------------
1 file changed, 46 deletions(-)
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 7eaac3dc4..98aff6e1f 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -338,52 +338,6 @@ scm_i_clonebig (SCM src_big, int same_sign_p)
return z;
}
-static SCM round_rsh (SCM n, SCM count);
-
-/* scm_i_big2dbl_2exp() is like frexp for bignums: it converts the
- bignum b into a normalized significand and exponent such that
- b = significand * 2^exponent and 1/2 <= abs(significand) < 1.
- The return value is the significand rounded to the closest
- representable double, and the exponent is placed into *expon_p.
- If b is zero, then the returned exponent and significand are both
- zero. */
-
-static double
-scm_i_big2dbl_2exp (SCM b, long *expon_p)
-{
- size_t bits = mpz_sizeinbase (SCM_I_BIG_MPZ (b), 2);
- size_t shift = 0;
-
- if (bits > DBL_MANT_DIG)
- {
- shift = bits - DBL_MANT_DIG;
- b = round_rsh (b, scm_from_size_t (shift));
- if (SCM_I_INUMP (b))
- {
- int expon;
- double signif = frexp (SCM_I_INUM (b), &expon);
- *expon_p = expon + shift;
- return signif;
- }
- }
-
- {
- long expon;
- double signif;
-#if SCM_ENABLE_MINI_GMP
- int iexpon;
- signif = mpz_get_d (SCM_I_BIG_MPZ (b));
- signif = frexp (signif, &iexpon);
- expon = (long) iexpon;
-#else
- signif = mpz_get_d_2exp (&expon, SCM_I_BIG_MPZ (b));
-#endif
- scm_remember_upto_here_1 (b);
- *expon_p = expon + shift;
- return signif;
- }
-}
-
/* scm_i_big2dbl() rounds to the closest representable double,
in accordance with R5RS exact->inexact. */
double
- [Guile-commits] 39/85: positive?, negative? use integer lib, (continued)
- [Guile-commits] 39/85: positive?, negative? use integer lib, Andy Wingo, 2022/01/13
- [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 <=
- [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, 2022/01/13
- [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