next up previous contents
Next: 2.1.4 Characters Up: 2.1.3 Floats Previous: Warning:

2.1.3.6 Accessing the Floating Point Modes

These functions can be used to modify or read the floating point modes:

[Function]
extensions:set-floating-point-modes &key :traps :rounding-mode :fast-mode :accrued-exceptions :current-exceptions
extensions:get-floating-point-modes

The keyword arguments to set-floating-point-modes set various modes controlling how floating point arithmetic is done:

:traps
A list of the exception conditions that should cause traps. Possible exceptions are :underflow, :overflow, :inexact, :invalid and :divide-by-zero. Initially all traps except :inexact are enabled. See section 2.1.3.4.

:rounding-mode
The rounding mode to use when the result is not exact. Possible values are :nearest, :positive-infinity, :negative-infinity and :zero. Initially, the rounding mode is :nearest. See the warning in section 2.1.3.5 about use of other rounding modes.

:current-exceptions, :accrued-exceptions
Lists of exception keywords used to set the exception flags. The current-exceptions are the exceptions for the previous operation, so setting it is not very useful. The accrued-exceptions are a cumulative record of the exceptions that occurred since the last time these flags were cleared. Specifying () will clear any accrued exceptions.

:fast-mode
Set the hardware's ``fast mode'' flag, if any. When set, IEEE conformance or debuggability may be impaired. Some machines may not have this feature, in which case the value is always nil. No currently supported machines have a fast mode.

If a keyword argument is not supplied, then the associated state is not changed.

get-floating-point-modes returns a list representing the state of the floating point modes. The list is in the same format as the keyword arguments to set-floating-point-modes, so apply could be used with set-floating-point-modes to restore the modes in effect at the time of the call to get-floating-point-modes.



Raymond Toy
Mon Jul 14 09:11:27 EDT 1997