Skip to content

Compilation fails with ARITHMETIC-ERROR on arithmetic comparison

The following code fails on compilation

(use-package :cl)

(defun a ()
  (let ((neg-inf ext:single-float-negative-infinity))
    (= 0.0 neg-inf)))

Exchanging the = for any other arithmetic comparison operator also fails. Substituting eq instead allows the code to compile. The variable binding of ext:single-float-negative-infinity is important. Exchanging the body of a for the following works as intended:

(= 0.0 ext:single-float-negative-infinity)

Expected behaviour is that both alternatives should compile and produce the same result.