I keep trying to write my Gtk+ binding for Lisp.
SBCL at the start enables FPU exceptions which results in floating point errors manifesting as exceptions.
Recently I've seen a situation when these exceptions get in the way. It seems that Gtk+ is written with the assumption that the exceptions are not raised but instead that the result of such floating-point operations is just ±Inf
or NaN
. Gtk+ sometimes may trigger FPU exceptions that result in the arrival of the synchronous SIGFPE
signal which is handled by SBCL. Moreover, if the exception is raised, it could not be canceled in contrast to normal errors that usually have some reasonable restarts.
The page Floating Point at the sbcl-internals mentions functions SB-EXT::SET-FLOATING-POINT-MODES
and SB-EXT::GET-FLOATING-POINT-MODES
that control FPU exceptions.
It only takes to call the following to resolve this issue:
(sb-ext::set-floating-point-modes :traps nil)
It seems that SBCL has a lot of things that I might need at arm's reach.