1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-05 06:50:21 +02:00

(exact->inexact): Test fractions big/big.

This commit is contained in:
Kevin Ryde 2006-05-09 00:31:48 +00:00
parent b80fcfc4ad
commit d8e59af349

View file

@ -2745,7 +2745,17 @@
(n (- (ash 1 (+ 2 dbl-mant-dig)) 1) (1- (* 2 n))) (n (- (ash 1 (+ 2 dbl-mant-dig)) 1) (1- (* 2 n)))
(want (+ (ash-flo 1.0 (+ 2 dbl-mant-dig)) 4.0) (* 2.0 want))) (want (+ (ash-flo 1.0 (+ 2 dbl-mant-dig)) 4.0) (* 2.0 want)))
((> i 100)) ((> i 100))
(try-i i n want)))) (try-i i n want)))
(pass-if "frac big/big"
(let ((big (ash 1 256)))
(= 1.0 (exact->inexact (/ (1+ big) big)))))
;; In guile 1.8.0 this failed, giving back "nan" because it tried to
;; convert the num and den to doubles, resulting in infs.
(pass-if "frac big/big, exceeding double"
(let ((big (ash 1 4096)))
(= 1.0 (exact->inexact (/ (1+ big) big))))))
;;; ;;;
;;; floor ;;; floor