Steel Bank Common Lisp

"The value 1.0d0 is not of type DOUBLE-FLOAT"

Reported by Stephen Bach on 2010-02-22
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Undecided
Unassigned

Bug Description

I get an odd type warning from evaluating the following piece of code:

  (defun always-one () 1)
  (let ((n (always-one)))
    (declare (fixnum n))
    (the double-float (expt n 1.0d0)))

Full error output:

  ; in: LAMBDA NIL
  ; (THE DOUBLE-FLOAT (EXPT N 1.0d0))
  ;
  ; note: deleting unreachable code
  ;
  ; caught WARNING:
  ; Asserted type DOUBLE-FLOAT conflicts with derived type
  ; (VALUES (OR RATIONAL SINGLE-FLOAT (COMPLEX SINGLE-FLOAT)) &OPTIONAL).
  ; See also:
  ; The SBCL Manual, Node "Handling of Types"
  ;
  ; compilation unit finished
  ; caught 1 WARNING condition
  ; printed 1 note

  debugger invoked on a TYPE-ERROR in thread #<THREAD "initial thread" {10024514B1}>:
    The value 1.0d0 is not of type DOUBLE-FLOAT.

The result of the EXPT call is obviously a double-float (it is even
printed that way). Removing the fixnum type declaration makes the
warning go away; using a constant 1 instead of the call to ALWAYS-ONE
makes the warning go away; using an flet instead of a defun makes the
warning go away; inlining ALWAYS-ONE makes the warning go away.

Tested on SBCL 1.0.35 and a couple older versions.

$ uname -a
2.6.26-2-amd64 #1 SMP Tue Jan 12 22:12:20 UTC 2010 x86_64 GNU/Linux

Nathan Froyd (froydnj) wrote :

Thanks, fix committed in 1.0.35.18.

Changed in sbcl:
status: New → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers