mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-20 14:19:18 +02:00
They can be close()d explicitly with close-file-descriptor, and will close() on gc, but only explicitly closing the last port on them will close the fileno. Notably needed for network sockets where we open separate input and output ports on the same socket.
23 lines
656 B
Scheme
23 lines
656 B
Scheme
;;;; these will fail when compiled either without flonums or trig funcs
|
|
|
|
(cond-expand
|
|
(modules (import (only (chibi test) test-begin test-assert test test-end)))
|
|
(else #f))
|
|
|
|
(test-begin "floating point")
|
|
|
|
(test-assert (= -5 (floor -4.3)))
|
|
(test-assert (= -4 (ceiling -4.3)))
|
|
(test-assert (= -4 (truncate -4.3)))
|
|
(test-assert (= -4 (round -4.3)))
|
|
(test-assert (= 3 (floor 3.5)))
|
|
(test-assert (= 4 (ceiling 3.5)))
|
|
(test-assert (= 3 (truncate 3.5)))
|
|
(test-assert (= 4 (round 3.5)))
|
|
|
|
(test 1124378190243790143.0 (exact->inexact 1124378190243790143))
|
|
|
|
;; (test "1124378190243790143.0"
|
|
;; (number->string (exact->inexact 1124378190243790143)))
|
|
|
|
(test-end)
|