This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home. For a version of this page that may be more recent, see MitSchemeFloatingPoint in WG2's repo for R7RS-large.

Mit­Scheme­Floating­Point

aag
2012-03-29 12:32:34
3Added mention of `eqv?` on !NaN values.history
source

MIT Scheme now has support for positive and negative infinities and for signaling (the default) and non-signaling NaNs. I'm documenting this here because the MIT Scheme manual doesn't yet describe these features, and having them here might be useful if we discuss this stuff in WG2.

The printed representations are #[+inf], #[-inf], and #[NaN], and are not readable.

To disable signaling: (flo:ignoring-exception-traps thunk). For example:

(flo:ignoring-exception-traps (lambda () (let* ((i (* 1.0e200 1.0e200)) (n (- i i))) (list i (- i) n)))) ;Value 13: (#[+inf] #[-inf] #[NaN])

Different NaN values are not eqv?.

These procedures are available for manipulating the floating-point environment:

flo:nan? flo:raise-exceptions! flo:restore-exception-flags! flo:rounding-mode flo:rounding-modes flo:save-exception-flags flo:set-environment! flo:set-rounding-mode! flo:set-trapped-exceptions! flo:significand-digits-base-2 flo:significand-digits-base-10 flo:supported-exceptions flo:test-exception-flags flo:test-exceptions flo:trap-exceptions! flo:trappable-exceptions flo:trapped-exceptions flo:untrap-exceptions! flo:update-environment! flo:with-default-environment flo:with-exceptions-trapped flo:with-exceptions-untrapped flo:with-rounding-mode flo:with-trapped-exceptions