diff options
author | Andy Wingo <wingo@pobox.com> | 2022-01-05 21:12:01 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2022-01-13 09:37:16 +0100 |
commit | 7c53325c31b86198b6c021c5c2b62c3742363619 (patch) | |
tree | b608179140e6f2c8b9b70cc387fbb8700648db36 /libguile/numbers.h | |
parent | f2390e510fb9f5273b007a90270b5226115e5352 (diff) | |
download | guile-7c53325c31b86198b6c021c5c2b62c3742363619.tar.gz |
Fix scm_integer_to_double_z to always round; clean ups
* libguile/integers.c (scm_integer_to_double_z): Doubles that can't be
exactly represented as integers should round.
(bignum_frexp_z): New helper.
(scm_integer_from_mpz, scm_integer_from_double): New internal functions.
* libguile/numbers.h:
* libguile/numbers.c (scm_i_bigcmp, scm_i_dbl2big, scm_i_dbl2num):
Remove unused internal functions.
(scm_inexact_to_exact): Rework to avoid scm_i_dbl2big.
(scm_bigequal): Move here, from eq.c.
(scm_integer_to_double_z): Use the new helper.
(scm_i_big2dbl): Use scm_integer_to_double_z.
Diffstat (limited to 'libguile/numbers.h')
-rw-r--r-- | libguile/numbers.h | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/libguile/numbers.h b/libguile/numbers.h index df5c9110c..f5cfe221e 100644 --- a/libguile/numbers.h +++ b/libguile/numbers.h @@ -1,7 +1,7 @@ #ifndef SCM_NUMBERS_H #define SCM_NUMBERS_H -/* Copyright 1995-1996,1998,2000-2006,2008-2011,2013-2014,2016-2018,2021 +/* Copyright 1995-1996,1998,2000-2006,2008-2011,2013-2014,2016-2018,2021,2022 Free Software Foundation, Inc. This file is part of Guile. @@ -349,9 +349,6 @@ SCM_INTERNAL SCM scm_i_exact_integer_sqrt (SCM k); /* bignum internal functions */ SCM_INTERNAL SCM scm_i_mkbig (void); SCM_API /* FIXME: not internal */ SCM scm_i_normbig (SCM x); -SCM_INTERNAL int scm_i_bigcmp (SCM a, SCM b); -SCM_INTERNAL SCM scm_i_dbl2big (double d); -SCM_INTERNAL SCM scm_i_dbl2num (double d); SCM_API /* FIXME: not internal */ double scm_i_big2dbl (SCM b); SCM_API /* FIXME: not internal */ SCM scm_i_long2big (long n); SCM_API /* FIXME: not internal */ SCM scm_i_ulong2big (unsigned long n); |