This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=ca7b6f6869072a79175c2d2db1b63f706bdf9b25 The branch, stable-2.0 has been updated via ca7b6f6869072a79175c2d2db1b63f706bdf9b25 (commit) via 19374ad2dec5529cbe4c82faf26247a57d09ce4d (commit) via e1592f8a4068f116b88d210e85fc0676f001c61e (commit) via 8ba567480518fc333b662d12f52936866307aa90 (commit) from 48b6f151c71cdf22a2eda48429d9bb31143dc98b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ca7b6f6869072a79175c2d2db1b63f706bdf9b25 Author: Mark H Weaver <[email protected]> Date: Tue Aug 6 16:38:32 2013 -0400 VM: ash: Use SCM_SRS and handle large right shift in fast path. * libguile/vm-i-scheme.c (ash): Use SCM_SRS. Handle inum right shift by more than SCM_I_FIXNUM_BIT-1 bits in fast path. commit 19374ad2dec5529cbe4c82faf26247a57d09ce4d Author: Mark H Weaver <[email protected]> Date: Tue Aug 6 16:26:46 2013 -0400 Use Gnulib's 'isfinite' in numbers.c. * libguile/numbers.c (DOUBLE_IS_FINITE, DOUBLE_IS_POSITIVE_INFINITY, DOUBLE_IS_NEGATIVE_INFINITY): Remove. (scm_odd_p, scm_even_p, scm_finite_p, icmplx2str, scm_rational_p, scm_inexact_to_exact): Use 'isfinite' instead of 'DOUBLE_IS_FINITE'. commit e1592f8a4068f116b88d210e85fc0676f001c61e Author: Mark H Weaver <[email protected]> Date: Tue Aug 6 16:21:26 2013 -0400 Use Gnulib's 'copysign' in numbers.c. * libguile/numbers.c (double_is_non_negative_zero): Remove. (idbl2str, scm_max, scm_min, scm_angle, log_of_shifted_double, scm_log10): Use 'copysign' to check signs of zeroes, instead of 'double_is_non_negative_zero'. commit 8ba567480518fc333b662d12f52936866307aa90 Author: Mark H Weaver <[email protected]> Date: Tue Aug 6 15:56:32 2013 -0400 Import 'copysign' and 'isfinite' modules from Gnulib. * lib/Makefile.am: * m4/gnulib-cache.m4: * m4/gnulib-comp.m4: Add 'copysign' and 'isfinite' Gnulib modules. ----------------------------------------------------------------------- Summary of changes: lib/Makefile.am | 48 ++++++++++++++++++++++++++++++++++++++++++++++- libguile/numbers.c | 49 +++++++++++++++-------------------------------- libguile/vm-i-scheme.c | 11 ++++----- m4/gnulib-cache.m4 | 4 ++- m4/gnulib-comp.m4 | 42 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 113 insertions(+), 41 deletions(-) diff --git a/lib/Makefile.am b/lib/Makefile.am index 8857a90..2ba04b7 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap c-strcase canonicalize-lgpl ceil clock-time close connect dirfd duplocale environ extensions flock floor fpieee frexp fstat full-read full-write func gendocs getaddrinfo getlogin getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nl_langinfo nproc open pipe-posix pipe2 poll putenv recv recvfrom regex rename select send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat time times trunc verify vsnprintf warnings wchar +# Reproduce by: gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap c-strcase canonicalize-lgpl ceil clock-time close connect copysign dirfd duplocale environ extensions flock floor fpieee frexp fstat full-read full-write func gendocs getaddrinfo getlogin getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isfinite isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nl_langinfo nproc open pipe-posix pipe2 poll putenv recv recvfrom regex rename select send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat time times trunc verify vsnprintf warnings wchar AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects @@ -50,6 +50,7 @@ EXTRA_libgnu_la_SOURCES = libgnu_la_LDFLAGS = $(AM_LDFLAGS) libgnu_la_LDFLAGS += -no-undefined libgnu_la_LDFLAGS += $(CEIL_LIBM) +libgnu_la_LDFLAGS += $(COPYSIGN_LIBM) libgnu_la_LDFLAGS += $(FLOOR_LIBM) libgnu_la_LDFLAGS += $(FREXP_LIBM) libgnu_la_LDFLAGS += $(GETADDRINFO_LIB) @@ -312,6 +313,15 @@ EXTRA_libgnu_la_SOURCES += connect.c ## end gnulib module connect +## begin gnulib module copysign + + +EXTRA_DIST += copysign.c + +EXTRA_libgnu_la_SOURCES += copysign.c + +## end gnulib module copysign + ## begin gnulib module dirent BUILT_SOURCES += dirent.h @@ -753,6 +763,15 @@ EXTRA_libgnu_la_SOURCES += inet_pton.c ## end gnulib module inet_pton +## begin gnulib module isfinite + + +EXTRA_DIST += isfinite.c + +EXTRA_libgnu_la_SOURCES += isfinite.c + +## end gnulib module isfinite + ## begin gnulib module isinf @@ -789,6 +808,15 @@ EXTRA_libgnu_la_SOURCES += isnan.c isnanf.c ## end gnulib module isnanf +## begin gnulib module isnanf-nolibm + + +EXTRA_DIST += float+.h isnan.c isnanf-nolibm.h isnanf.c + +EXTRA_libgnu_la_SOURCES += isnan.c isnanf.c + +## end gnulib module isnanf-nolibm + ## begin gnulib module isnanl @@ -798,6 +826,15 @@ EXTRA_libgnu_la_SOURCES += isnan.c isnanl.c ## end gnulib module isnanl +## begin gnulib module isnanl-nolibm + + +EXTRA_DIST += float+.h isnan.c isnanl-nolibm.h isnanl.c + +EXTRA_libgnu_la_SOURCES += isnan.c isnanl.c + +## end gnulib module isnanl-nolibm + ## begin gnulib module langinfo BUILT_SOURCES += langinfo.h @@ -1734,6 +1771,15 @@ EXTRA_DIST += signal.in.h ## end gnulib module signal-h +## begin gnulib module signbit + + +EXTRA_DIST += float+.h signbitd.c signbitf.c signbitl.c + +EXTRA_libgnu_la_SOURCES += signbitd.c signbitf.c signbitl.c + +## end gnulib module signbit + ## begin gnulib module size_max libgnu_la_SOURCES += size_max.h diff --git a/libguile/numbers.c b/libguile/numbers.c index 71054ef..5d64b4a 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -91,15 +91,6 @@ verify (FLT_RADIX == 2); typedef scm_t_signed_bits scm_t_inum; #define scm_from_inum(x) (scm_from_signed_integer (x)) -/* Tests to see if a C double is neither infinite nor a NaN. - TODO: if it's available, use C99's isfinite(x) instead */ -#define DOUBLE_IS_FINITE(x) (!isinf(x) && !isnan(x)) - -/* On some platforms, isinf(x) returns 0, 1 or -1, indicating the sign - of the infinity, but other platforms return a boolean only. */ -#define DOUBLE_IS_POSITIVE_INFINITY(x) (isinf(x) && ((x) > 0)) -#define DOUBLE_IS_NEGATIVE_INFINITY(x) (isinf(x) && ((x) < 0)) - /* Test an inum to see if it can be converted to a double without loss of precision. Note that this will sometimes return 0 even when 1 could have been returned, e.g. for large powers of 2. It is designed @@ -654,14 +645,6 @@ scm_i_fraction2double (SCM z) SCM_FRACTION_DENOMINATOR (z)); } -static int -double_is_non_negative_zero (double x) -{ - static double zero = 0.0; - - return !memcmp (&x, &zero, sizeof(double)); -} - static SCM scm_i_from_double (double val) { @@ -737,7 +720,7 @@ SCM_PRIMITIVE_GENERIC (scm_odd_p, "odd?", 1, 0, 0, else if (SCM_REALP (n)) { double val = SCM_REAL_VALUE (n); - if (DOUBLE_IS_FINITE (val)) + if (isfinite (val)) { double rem = fabs (fmod (val, 2.0)); if (rem == 1.0) @@ -771,7 +754,7 @@ SCM_PRIMITIVE_GENERIC (scm_even_p, "even?", 1, 0, 0, else if (SCM_REALP (n)) { double val = SCM_REAL_VALUE (n); - if (DOUBLE_IS_FINITE (val)) + if (isfinite (val)) { double rem = fabs (fmod (val, 2.0)); if (rem == 1.0) @@ -791,7 +774,7 @@ SCM_PRIMITIVE_GENERIC (scm_finite_p, "finite?", 1, 0, 0, #define FUNC_NAME s_scm_finite_p { if (SCM_REALP (x)) - return scm_from_bool (DOUBLE_IS_FINITE (SCM_REAL_VALUE (x))); + return scm_from_bool (isfinite (SCM_REAL_VALUE (x))); else if (scm_is_real (x)) return SCM_BOOL_T; else @@ -5368,7 +5351,7 @@ idbl2str (double dbl, char *a, int radix) } else if (dbl == 0.0) { - if (!double_is_non_negative_zero (dbl)) + if (copysign (1.0, dbl) < 0.0) a[ch++] = '-'; strcpy (a + ch, "0.0"); return ch + 3; @@ -5580,7 +5563,7 @@ icmplx2str (double real, double imag, char *str, int radix) #endif /* Don't output a '+' for negative numbers or for Inf and NaN. They will provide their own sign. */ - if (sgn >= 0 && DOUBLE_IS_FINITE (imag)) + if (sgn >= 0 && isfinite (imag)) str[i++] = '+'; i += idbl2str (imag, &str[i], radix); str[i++] = 'i'; @@ -6520,7 +6503,7 @@ SCM_DEFINE (scm_rational_p, "rational?", 1, 0, 0, else if (SCM_REALP (x)) /* due to their limited precision, finite floating point numbers are rational as well. (finite means neither infinity nor a NaN) */ - return scm_from_bool (DOUBLE_IS_FINITE (SCM_REAL_VALUE (x))); + return scm_from_bool (isfinite (SCM_REAL_VALUE (x))); else return SCM_BOOL_F; } @@ -7272,10 +7255,10 @@ scm_max (SCM x, SCM y) else if (SCM_UNLIKELY (xx != yy)) return (xx != xx) ? x : y; /* Return the NaN */ /* xx == yy, but handle signed zeroes properly */ - else if (double_is_non_negative_zero (yy)) - return y; - else + else if (copysign (1.0, yy) < 0.0) return x; + else + return y; } else if (SCM_FRACTIONP (y)) { @@ -7431,10 +7414,10 @@ scm_min (SCM x, SCM y) else if (SCM_UNLIKELY (xx != yy)) return (xx != xx) ? x : y; /* Return the NaN */ /* xx == yy, but handle signed zeroes properly */ - else if (double_is_non_negative_zero (xx)) - return y; - else + else if (copysign (1.0, xx) < 0.0) return x; + else + return y; } else if (SCM_FRACTIONP (y)) { @@ -9295,7 +9278,7 @@ SCM_PRIMITIVE_GENERIC (scm_angle, "angle", 1, 0, 0, else if (SCM_REALP (z)) { double x = SCM_REAL_VALUE (z); - if (x > 0.0 || double_is_non_negative_zero (x)) + if (copysign (1.0, x) > 0.0) return flo0; else return scm_i_from_double (atan2 (0.0, -1.0)); @@ -9351,7 +9334,7 @@ SCM_PRIMITIVE_GENERIC (scm_inexact_to_exact, "inexact->exact", 1, 0, 0, else SCM_WTA_DISPATCH_1 (g_scm_inexact_to_exact, z, 1, s_scm_inexact_to_exact); - if (!SCM_LIKELY (DOUBLE_IS_FINITE (val))) + if (!SCM_LIKELY (isfinite (val))) SCM_OUT_OF_RANGE (1, z); else if (val == 0.0) return SCM_INUM0; @@ -9945,7 +9928,7 @@ log_of_shifted_double (double x, long shift) { double ans = log (fabs (x)) + shift * M_LN2; - if (x > 0.0 || double_is_non_negative_zero (x)) + if (copysign (1.0, x) > 0.0) return scm_i_from_double (ans); else return scm_c_make_rectangular (ans, M_PI); @@ -10061,7 +10044,7 @@ SCM_PRIMITIVE_GENERIC (scm_log10, "log10", 1, 0, 0, { double re = scm_to_double (z); double l = log10 (fabs (re)); - if (re > 0.0 || double_is_non_negative_zero (re)) + if (copysign (1.0, re) > 0.0) return scm_i_from_double (l); else return scm_c_make_rectangular (l, M_LOG10E * M_PI); diff --git a/libguile/vm-i-scheme.c b/libguile/vm-i-scheme.c index bcd8134..fc32ec5 100644 --- a/libguile/vm-i-scheme.c +++ b/libguile/vm-i-scheme.c @@ -486,12 +486,11 @@ VM_DEFINE_FUNCTION (159, ash, "ash", 2) if (SCM_I_INUMP (x) && SCM_I_INUMP (y)) { if (SCM_I_INUM (y) < 0) - { - /* Right shift, will be a fixnum. */ - if (SCM_I_INUM (y) > -SCM_I_FIXNUM_BIT) - RETURN (SCM_I_MAKINUM (SCM_I_INUM (x) >> -SCM_I_INUM (y))); - /* fall through */ - } + /* Right shift, will be a fixnum. */ + RETURN (SCM_I_MAKINUM + (SCM_SRS (SCM_I_INUM (x), + (-SCM_I_INUM (y) <= SCM_I_FIXNUM_BIT-1) + ? -SCM_I_INUM (y) : SCM_I_FIXNUM_BIT-1))); else /* Left shift. See comments in scm_ash. */ { diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 index a8ecb42..379f6b7 100644 --- a/m4/gnulib-cache.m4 +++ b/m4/gnulib-cache.m4 @@ -27,7 +27,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap c-strcase canonicalize-lgpl ceil clock-time close connect dirfd duplocale environ extensions flock floor fpieee frexp fstat full-read full-write func gendocs getaddrinfo getlogin getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nl_langinfo nproc open pipe-posix pipe2 poll putenv recv recvfrom regex rename select send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat time times trunc verify vsnprintf warnings wch ar +# gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap c-strcase canonicalize-lgpl ceil clock-time close connect copysign dirfd duplocale environ extensions flock floor fpieee frexp fstat full-read full-write func gendocs getaddrinfo getlogin getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isfinite isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nl_langinfo nproc open pipe-posix pipe2 poll putenv recv recvfrom regex rename select send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat time times trunc verify vsnp rintf warnings wchar # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([gnulib-local]) @@ -45,6 +45,7 @@ gl_MODULES([ clock-time close connect + copysign dirfd duplocale environ @@ -71,6 +72,7 @@ gl_MODULES([ iconv_open-utf inet_ntop inet_pton + isfinite isinf isnan ldexp diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 55c003a..8a1b801 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -61,6 +61,7 @@ AC_DEFUN([gl_EARLY], # Code from module close: # Code from module configmake: # Code from module connect: + # Code from module copysign: # Code from module dirent: # Code from module dirfd: # Code from module dirname-lgpl: @@ -108,12 +109,15 @@ AC_DEFUN([gl_EARLY], # Code from module inet_ntop: # Code from module inet_pton: # Code from module inline: + # Code from module isfinite: # Code from module isinf: # Code from module isnan: # Code from module isnand: # Code from module isnand-nolibm: # Code from module isnanf: + # Code from module isnanf-nolibm: # Code from module isnanl: + # Code from module isnanl-nolibm: # Code from module langinfo: # Code from module largefile: AC_REQUIRE([AC_SYS_LARGEFILE]) @@ -172,6 +176,7 @@ AC_DEFUN([gl_EARLY], # Code from module setsockopt: # Code from module shutdown: # Code from module signal-h: + # Code from module signbit: # Code from module size_max: # Code from module snippet/_Noreturn: # Code from module snippet/arg-nonnull: @@ -292,6 +297,11 @@ AC_SUBST([LTALLOCA]) AC_LIBOBJ([connect]) fi gl_SYS_SOCKET_MODULE_INDICATOR([connect]) + gl_FUNC_COPYSIGN + if test $HAVE_COPYSIGN = 0; then + AC_LIBOBJ([copysign]) + fi + gl_MATH_MODULE_INDICATOR([copysign]) gl_DIRENT_H gl_FUNC_DIRFD if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no; then @@ -415,6 +425,11 @@ AC_SUBST([LTALLOCA]) fi gl_ARPA_INET_MODULE_INDICATOR([inet_pton]) gl_INLINE + gl_ISFINITE + if test $REPLACE_ISFINITE = 1; then + AC_LIBOBJ([isfinite]) + fi + gl_MATH_MODULE_INDICATOR([isfinite]) gl_ISINF if test $REPLACE_ISINF = 1; then AC_LIBOBJ([isinf]) @@ -445,6 +460,11 @@ AC_SUBST([LTALLOCA]) gl_PREREQ_ISNANF fi gl_MATH_MODULE_INDICATOR([isnanf]) + gl_FUNC_ISNANF_NO_LIBM + if test $gl_func_isnanf_no_libm != yes; then + AC_LIBOBJ([isnanf]) + gl_PREREQ_ISNANF + fi gl_FUNC_ISNANL m4_ifdef([gl_ISNAN], [ AC_REQUIRE([gl_ISNAN]) @@ -454,6 +474,11 @@ AC_SUBST([LTALLOCA]) gl_PREREQ_ISNANL fi gl_MATH_MODULE_INDICATOR([isnanl]) + gl_FUNC_ISNANL_NO_LIBM + if test $gl_func_isnanl_no_libm != yes; then + AC_LIBOBJ([isnanl]) + gl_PREREQ_ISNANL + fi gl_LANGINFO_H AC_REQUIRE([gl_LARGEFILE]) gl_FUNC_LDEXP @@ -656,6 +681,13 @@ AC_SUBST([LTALLOCA]) fi gl_SYS_SOCKET_MODULE_INDICATOR([shutdown]) gl_SIGNAL_H + gl_SIGNBIT + if test $REPLACE_SIGNBIT = 1; then + AC_LIBOBJ([signbitf]) + AC_LIBOBJ([signbitd]) + AC_LIBOBJ([signbitl]) + fi + gl_MATH_MODULE_INDICATOR([signbit]) gl_SIZE_MAX gl_FUNC_SNPRINTF gl_STDIO_MODULE_INDICATOR([snprintf]) @@ -935,6 +967,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/close.c lib/config.charset lib/connect.c + lib/copysign.c lib/dirent.in.h lib/dirfd.c lib/dirname-lgpl.c @@ -976,11 +1009,14 @@ AC_DEFUN([gl_FILE_LIST], [ lib/iconveh.h lib/inet_ntop.c lib/inet_pton.c + lib/isfinite.c lib/isinf.c lib/isnan.c lib/isnand-nolibm.h lib/isnand.c + lib/isnanf-nolibm.h lib/isnanf.c + lib/isnanl-nolibm.h lib/isnanl.c lib/itold.c lib/langinfo.in.h @@ -1053,6 +1089,9 @@ AC_DEFUN([gl_FILE_LIST], [ lib/setsockopt.c lib/shutdown.c lib/signal.in.h + lib/signbitd.c + lib/signbitf.c + lib/signbitl.c lib/size_max.h lib/snprintf.c lib/socket.c @@ -1125,6 +1164,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/close.m4 m4/codeset.m4 m4/configmake.m4 + m4/copysign.m4 m4/dirent_h.m4 m4/dirfd.m4 m4/dirname.m4 @@ -1163,6 +1203,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/inline.m4 m4/intmax_t.m4 m4/inttypes_h.m4 + m4/isfinite.m4 m4/isinf.m4 m4/isnan.m4 m4/isnand.m4 @@ -1228,6 +1269,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/servent.m4 m4/setenv.m4 m4/signal_h.m4 + m4/signbit.m4 m4/size_max.m4 m4/snprintf.m4 m4/socketlib.m4 hooks/post-receive -- GNU Guile
