[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-41-g620c13e
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=620c13e8fc02060e0af8fa38398ee4de745d41e9 The branch, stable-2.0 has been updated via 620c13e8fc02060e0af8fa38398ee4de745d41e9 (commit) from 824b9ad8b792ab42c5cc614d66462dfaab489075 (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 620c13e8fc02060e0af8fa38398ee4de745d41e9 Author: Mark H Weaver m...@netris.org Date: Sat Jul 20 12:29:02 2013 -0400 Rewrite 'rationalize' to fix bugs and improve efficiency. Fixes http://bugs.gnu.org/14905. Reported by Göran Weinholt go...@weinholt.se. * libguile/numbers.c (scm_rationalize): Rewrite. Previously an incorrect algorithm was used which failed in many cases. * test-suite/tests/numbers.test (rationalize): Add tests. --- Summary of changes: libguile/numbers.c| 247 + test-suite/tests/numbers.test | 29 + 2 files changed, 203 insertions(+), 73 deletions(-) diff --git a/libguile/numbers.c b/libguile/numbers.c index 5ee1fc7..b7b91ac 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -9391,89 +9391,190 @@ SCM_DEFINE (scm_rationalize, rationalize, 2, 0, 0, { SCM_ASSERT_TYPE (scm_is_real (x), x, SCM_ARG1, FUNC_NAME, real); SCM_ASSERT_TYPE (scm_is_real (eps), eps, SCM_ARG2, FUNC_NAME, real); - eps = scm_abs (eps); - if (scm_is_false (scm_positive_p (eps))) -{ - /* eps is either zero or a NaN */ - if (scm_is_true (scm_nan_p (eps))) - return scm_nan (); - else if (SCM_INEXACTP (eps)) - return scm_exact_to_inexact (x); - else - return x; -} - else if (scm_is_false (scm_finite_p (eps))) -{ - if (scm_is_true (scm_finite_p (x))) - return flo0; - else - return scm_nan (); -} - else if (scm_is_false (scm_finite_p (x))) /* checks for both inf and nan */ -return x; - else if (scm_is_false (scm_less_p (scm_floor (scm_sum (x, eps)), -scm_ceiling (scm_difference (x, eps) + + if (SCM_UNLIKELY (!scm_is_exact (eps) || !scm_is_exact (x))) { - /* There's an integer within range; we want the one closest to zero */ - if (scm_is_false (scm_less_p (eps, scm_abs (x - { - /* zero is within range */ - if (SCM_INEXACTP (x) || SCM_INEXACTP (eps)) - return flo0; - else - return SCM_INUM0; - } - else if (scm_is_true (scm_positive_p (x))) - return scm_ceiling (scm_difference (x, eps)); + if (SCM_UNLIKELY (scm_is_false (scm_finite_p (eps +{ + if (scm_is_false (scm_nan_p (eps)) scm_is_true (scm_finite_p (x))) +return flo0; + else +return scm_nan (); +} + else if (SCM_UNLIKELY (scm_is_false (scm_finite_p (x +return x; else - return scm_floor (scm_sum (x, eps)); -} - else -{ - /* Use continued fractions to find closest ratio. All -arithmetic is done with exact numbers. +return scm_exact_to_inexact + (scm_rationalize (scm_inexact_to_exact (x), +scm_inexact_to_exact (eps))); +} + else +{ + /* X and EPS are exact rationals. + + The code that follows is equivalent to the following Scheme code: + + (define (exact-rationalize x eps) + (let ((n1 (if (negative? x) -1 1)) + (x (abs x)) + (eps (abs eps))) + (let ((lo (- x eps)) + (hi (+ x eps))) + (if (= lo 0) + 0 + (let loop ((nlo (numerator lo)) (dlo (denominator lo)) + (nhi (numerator hi)) (dhi (denominator hi)) + (n1 n1) (d1 0) (n2 0) (d2 1)) + (let-values (((qlo rlo) (floor/ nlo dlo)) + ((qhi rhi) (floor/ nhi dhi))) + (let ((n0 (+ n2 (* n1 qlo))) + (d0 (+ d2 (* d1 qlo + (cond ((zero? rlo) (/ n0 d0)) + (( qlo qhi) (/ (+ n0 n1) (+ d0 d1))) + (else (loop dhi rhi dlo rlo n0 d0 n1 d1)) */ - SCM ex = scm_inexact_to_exact (x); - SCM int_part = scm_floor (ex); - SCM tt = SCM_INUM1; - SCM a1 = SCM_INUM0, a2 = SCM_INUM1, a = SCM_INUM0; - SCM b1 = SCM_INUM1, b2 = SCM_INUM0, b = SCM_INUM0; - SCM rx; - int i = 0; + int n1_init = 1; +
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-42-gd9e7774
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=d9e7774fda909306ebdaab175684043946b0931b The branch, stable-2.0 has been updated via d9e7774fda909306ebdaab175684043946b0931b (commit) from 620c13e8fc02060e0af8fa38398ee4de745d41e9 (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 d9e7774fda909306ebdaab175684043946b0931b Author: Mark H Weaver m...@netris.org Date: Sun Jul 21 07:20:03 2013 -0400 Fix minor formatting error in 'rationalize'. * libguile/numbers.c (scm_rationalize): Fix formatting. --- Summary of changes: libguile/numbers.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libguile/numbers.c b/libguile/numbers.c index b7b91ac..07bcaad 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -9528,8 +9528,8 @@ SCM_DEFINE (scm_rationalize, rationalize, 2, 0, 0, interval between the remainders NLO/DLO and NHI/DHI. There are two cases to consider: either NLO/DLO == QLO is an integer (indicated by RLO == 0), or QLO QHI. */ - if (mpz_sgn (rlo) == 0 || mpz_cmp (qlo, qhi) - != 0) break; + if (mpz_sgn (rlo) == 0 || mpz_cmp (qlo, qhi) != 0) +break; /* Efficiently shuffle variables around for the next iteration. First we shift the recent convergents. */ hooks/post-receive -- GNU Guile
[Guile-commits] Failed with output: Hydra job gnu:guile-2-0:coverage on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:coverage (on x86_64-linux) has changed from Failed to Failed with output. For details, see http://hydra.nixos.org/build/5568943 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed with output: Hydra job gnu:guile-2-0:build_enable_guile_debug on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:build_enable_guile_debug (on x86_64-linux) has changed from Success to Failed with output. For details, see http://hydra.nixos.org/build/5568978 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed with output: Hydra job gnu:guile-2-0:build_disable_deprecated_disable_discouraged on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:build_disable_deprecated_disable_discouraged (on x86_64-linux) has changed from Success to Failed with output. For details, see http://hydra.nixos.org/build/5568981 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed with output: Hydra job gnu:guile-2-0:build_without_threads on i686-linux
Hi, The status of Hydra job gnu:guile-2-0:build_without_threads (on i686-linux) has changed from Success to Failed with output. For details, see http://hydra.nixos.org/build/5568977 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed with output: Hydra job gnu:guile-2-0:build on i686-linux
Hi, The status of Hydra job gnu:guile-2-0:build (on i686-linux) has changed from Success to Failed with output. For details, see http://hydra.nixos.org/build/5568970 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed with output: Hydra job gnu:guile-2-0:build_without_threads on x86_64-darwin
Hi, The status of Hydra job gnu:guile-2-0:build_without_threads (on x86_64-darwin) has changed from Success to Failed with output. For details, see http://hydra.nixos.org/build/5568969 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed with output: Hydra job gnu:guile-2-0:build on x86_64-darwin
Hi, The status of Hydra job gnu:guile-2-0:build (on x86_64-darwin) has changed from Success to Failed with output. For details, see http://hydra.nixos.org/build/5568968 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed with output: Hydra job gnu:guile-2-0:build_CPPFLAGS=_DSCM_DEBUG_TYPING_STRICTNESS=2 on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:build_CPPFLAGS=_DSCM_DEBUG_TYPING_STRICTNESS=2 (on x86_64-linux) has changed from Success to Failed with output. For details, see http://hydra.nixos.org/build/5568959 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed with output: Hydra job gnu:guile-2-0:build_without_threads on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:build_without_threads (on x86_64-linux) has changed from Success to Failed with output. For details, see http://hydra.nixos.org/build/5568967 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed with output: Hydra job gnu:guile-2-0:build on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:build (on x86_64-linux) has changed from Success to Failed with output. For details, see http://hydra.nixos.org/build/5568966 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed with output: Hydra job gnu:guile-2-0:build_disable_networking on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:build_disable_networking (on x86_64-linux) has changed from Success to Failed with output. For details, see http://hydra.nixos.org/build/5568957 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed with output: Hydra job gnu:guile-2-0:build_CPPFLAGS=_DSCM_DEBUG=1 on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:build_CPPFLAGS=_DSCM_DEBUG=1 (on x86_64-linux) has changed from Success to Failed with output. For details, see http://hydra.nixos.org/build/5568974 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed with output: Hydra job gnu:guile-2-0:build_without_threads on x86_64-freebsd
Hi, The status of Hydra job gnu:guile-2-0:build_without_threads (on x86_64-freebsd) has changed from Success to Failed with output. For details, see http://hydra.nixos.org/build/5568972 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed with output: Hydra job gnu:guile-2-0:build on x86_64-freebsd
Hi, The status of Hydra job gnu:guile-2-0:build (on x86_64-freebsd) has changed from Success to Failed with output. For details, see http://hydra.nixos.org/build/5568976 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Success: Hydra job gnu:guile-2-0:build_enable_guile_debug on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:build_enable_guile_debug (on x86_64-linux) has changed from Failed with output to Success. For details, see http://hydra.nixos.org/build/5569025 Yay! Regards, The Hydra build daemon.
[Guile-commits] Success: Hydra job gnu:guile-2-0:build_without_threads on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:build_without_threads (on x86_64-linux) has changed from Failed with output to Success. For details, see http://hydra.nixos.org/build/5569018 Yay! Regards, The Hydra build daemon.
[Guile-commits] Success: Hydra job gnu:guile-2-0:build_gcc47 on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:build_gcc47 (on x86_64-linux) has changed from Failed with output to Success. For details, see http://hydra.nixos.org/build/5569029 Yay! Regards, The Hydra build daemon.
[Guile-commits] Success: Hydra job gnu:guile-2-0:build_CPPFLAGS=_DSCM_DEBUG_TYPING_STRICTNESS=2 on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:build_CPPFLAGS=_DSCM_DEBUG_TYPING_STRICTNESS=2 (on x86_64-linux) has changed from Failed with output to Success. For details, see http://hydra.nixos.org/build/5569010 Yay! Regards, The Hydra build daemon.
[Guile-commits] Success: Hydra job gnu:guile-2-0:build_without_threads on i686-linux
Hi, The status of Hydra job gnu:guile-2-0:build_without_threads (on i686-linux) has changed from Failed with output to Success. For details, see http://hydra.nixos.org/build/5569022 Yay! Regards, The Hydra build daemon.
[Guile-commits] Success: Hydra job gnu:guile-2-0:build_without_threads on x86_64-darwin
Hi, The status of Hydra job gnu:guile-2-0:build_without_threads (on x86_64-darwin) has changed from Failed with output to Success. For details, see http://hydra.nixos.org/build/5569023 Yay! Regards, The Hydra build daemon.
[Guile-commits] Success: Hydra job gnu:guile-2-0:build on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:build (on x86_64-linux) has changed from Failed with output to Success. For details, see http://hydra.nixos.org/build/5569020 Yay! Regards, The Hydra build daemon.
[Guile-commits] Success: Hydra job gnu:guile-2-0:build_CPPFLAGS=_DSCM_DEBUG=1 on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:build_CPPFLAGS=_DSCM_DEBUG=1 (on x86_64-linux) has changed from Failed with output to Success. For details, see http://hydra.nixos.org/build/5569030 Yay! Regards, The Hydra build daemon.
[Guile-commits] Success: Hydra job gnu:guile-2-0:build on x86_64-freebsd
Hi, The status of Hydra job gnu:guile-2-0:build (on x86_64-freebsd) has changed from Failed with output to Success. For details, see http://hydra.nixos.org/build/5569012 Yay! Regards, The Hydra build daemon.
[Guile-commits] Success: Hydra job gnu:guile-2-0:build_without_threads on x86_64-freebsd
Hi, The status of Hydra job gnu:guile-2-0:build_without_threads (on x86_64-freebsd) has changed from Failed with output to Success. For details, see http://hydra.nixos.org/build/5569031 Yay! Regards, The Hydra build daemon.
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-44-g93da406
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=93da406f331a1849f05e63387442b9aaf33f9540 The branch, stable-2.0 has been updated via 93da406f331a1849f05e63387442b9aaf33f9540 (commit) from eba5c07715f556d3c27b85afb01baa8a189d7849 (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 93da406f331a1849f05e63387442b9aaf33f9540 Author: Mark H Weaver m...@netris.org Date: Sun Jul 21 10:00:48 2013 -0400 Optimize R6RS bitwise operators. * module/rnrs/arithmetic/bitwise.scm (bitwise-if, bitwise-length, bitwise-first-bit-set, bitwise-bit-field, bitwise-reverse-bit-field): Replace these with aliases to the identical SRFI-60 operators 'bitwise-if', 'integer-length', 'first-set-bit', 'bit-field', and 'reverse-bit-field'. (bitwise-copy-bit, bitwise-copy-bit-field, bitwise-rotate-bit-field): Reimplement these based upon the similar SRFI-60 operators 'copy-bit', 'copy-bit-field', and 'rotate-bit-field'. * test-suite/tests/r6rs-arithmetic-bitwise.test (bitwise-copy-bit): Fix test to conform to the specification, which requires the third argument to be either 0 or 1. * test-suite/tests/r6rs-arithmetic-fixnums.test (fxcopy-bit): Fix test to conform to the specification, which requires the third argument to be either 0 or 1. --- Summary of changes: module/rnrs/arithmetic/bitwise.scm| 81 +++-- test-suite/tests/r6rs-arithmetic-bitwise.test |2 +- test-suite/tests/r6rs-arithmetic-fixnums.test |2 +- 3 files changed, 24 insertions(+), 61 deletions(-) diff --git a/module/rnrs/arithmetic/bitwise.scm b/module/rnrs/arithmetic/bitwise.scm index 0acbc8c..5f66cf1 100644 --- a/module/rnrs/arithmetic/bitwise.scm +++ b/module/rnrs/arithmetic/bitwise.scm @@ -41,6 +41,18 @@ bitwise-reverse-bit-field) (import (rnrs base (6)) (rnrs control (6)) + (rename (only (srfi srfi-60) bitwise-if + integer-length + first-set-bit + copy-bit + bit-field + copy-bit-field + rotate-bit-field + reverse-bit-field) + (integer-length bitwise-length) + (first-set-bit bitwise-first-bit-set) + (bit-field bitwise-bit-field) + (reverse-bit-field bitwise-reverse-bit-field)) (rename (only (guile) lognot logand logior @@ -60,70 +72,21 @@ (bitwise-not (logcount ei)) (logcount ei))) - (define (bitwise-if ei1 ei2 ei3) -(bitwise-ior (bitwise-and ei1 ei2) (bitwise-and (bitwise-not ei1) ei3))) - - (define (bitwise-length ei) -(do ((result 0 (+ result 1)) -(bits (if (negative? ei) (bitwise-not ei) ei) - (bitwise-arithmetic-shift bits -1))) - ((zero? bits) -result))) - - (define (bitwise-first-bit-set ei) -(define (bitwise-first-bit-set-inner bits count) - (cond ((zero? bits) -1) - ((logbit? 0 bits) count) - (else (bitwise-first-bit-set-inner - (bitwise-arithmetic-shift bits -1) (+ count 1) -(bitwise-first-bit-set-inner ei 0)) - (define (bitwise-bit-set? ei1 ei2) (logbit? ei2 ei1)) (define (bitwise-copy-bit ei1 ei2 ei3) -(bitwise-if (bitwise-arithmetic-shift-left 1 ei2) - (bitwise-arithmetic-shift-left ei3 ei2) - ei1)) - - (define (bitwise-bit-field ei1 ei2 ei3) -(bitwise-arithmetic-shift-right - (bitwise-and ei1 (bitwise-not (bitwise-arithmetic-shift-left -1 ei3))) - ei2)) +;; The specification states that ei3 should be either 0 or 1. +;; However, other values have been tolerated by both Guile 2.0.x and +;; the sample implementation given the R6RS library document, so for +;; backward compatibility we continue to permit it. +(copy-bit ei2 ei1 (logbit? 0 ei3))) (define (bitwise-copy-bit-field ei1 ei2 ei3 ei4) -(bitwise-if (bitwise-and (bitwise-arithmetic-shift-left -1 ei2) -(bitwise-not - (bitwise-arithmetic-shift-left -1 ei3))) - (bitwise-arithmetic-shift-left ei4 ei2) - ei1)) +(copy-bit-field ei1 ei4 ei2 ei3)) - (define bitwise-arithmetic-shift-left
[Guile-commits] Failed: Hydra job gnu:guile-2-0:coverage on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:coverage (on x86_64-linux) has changed from Failed with output to Failed. For details, see http://hydra.nixos.org/build/5568975 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed: Hydra job gnu:guile-2-0:coverage on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:coverage (on x86_64-linux) has changed from Failed with output to Failed. For details, see http://hydra.nixos.org/build/5569015 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed with output: Hydra job gnu:guile-2-0:coverage on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:coverage (on x86_64-linux) has changed from Failed to Failed with output. For details, see http://hydra.nixos.org/build/5569212 Go forth and fix it. Regards, The Hydra build daemon.
[Guile-commits] Failed: Hydra job gnu:guile-2-0:coverage on x86_64-linux
Hi, The status of Hydra job gnu:guile-2-0:coverage (on x86_64-linux) has changed from Failed with output to Failed. For details, see http://hydra.nixos.org/build/5570792 Go forth and fix it. Regards, The Hydra build daemon.