IEEE 754-2008 supports four rounding modes, which determine the answer given by a floating-point computation when the exact result lies between two floating-point numbers but is not a floating-point number itself:
Round to the nearest floating-point number. If there are two equidistant ones, choose the one whose least significant digit is even. Also known as “round-to-nearest/ties-to-even”.
Round to the floating-point number closest to zero.
Round to the greatest floating-point number below.
Round to the least floating-point number above.
Warning: Not all procedures in MIT/GNU Scheme respect the rounding mode. Only the basic arithmetic operations — +, -, *, /, and sqrt — will reliably respect it. The main purpose of changing the rounding mode is to diagnose numerical instability by injecting small perturbations throughout the computation.
Bug: It would be nice if we had “round-to-odd”, where any inexact result is rounded to the nearest odd floating-point number, for implementing “doubled”-precision algorithms. But we don’t. Sorry.
Returns a symbol for the default rounding mode, which is always
Returns a list of the supported rounding modes as symbols.
Gets or sets the current rounding mode as a symbol, entering a per-thread environment.
Call thunk in a per-thread environment with the rounding mode set to mode. On return, the floating-point environment, including rounding mode, is restored to what it was before.
Non-local exit from and re-entrance to thunk behaves as if the
call is surrounded by
(see Floating-Point Environment).