mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-16 16:50:21 +02:00
(inexact->exact): New tests.
This commit is contained in:
parent
2be24db4d7
commit
1259cb26f7
1 changed files with 18 additions and 0 deletions
|
@ -2072,6 +2072,24 @@
|
||||||
;;; inexact->exact
|
;;; inexact->exact
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
|
(with-test-prefix "inexact->exact"
|
||||||
|
|
||||||
|
(pass-if-exception exception:numerical-overflow "+inf"
|
||||||
|
(inexact->exact +.inf))
|
||||||
|
|
||||||
|
(pass-if-exception exception:numerical-overflow "-inf"
|
||||||
|
(inexact->exact -.inf))
|
||||||
|
|
||||||
|
(pass-if-exception exception:numerical-overflow "nan"
|
||||||
|
(inexact->exact +.nan))
|
||||||
|
|
||||||
|
(with-test-prefix "2.0**i to exact and back"
|
||||||
|
(do ((i 0 (1+ i))
|
||||||
|
(n 1.0 (* 2.0 n)))
|
||||||
|
((> i 100))
|
||||||
|
(pass-if (list i n)
|
||||||
|
(= n (inexact->exact (exact->inexact n)))))))
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; integer-length
|
;;; integer-length
|
||||||
;;;
|
;;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue