FTRUNCATE return the wrong zero with a certain THE argument

Bug #1732009 reported by Paul F. Dietz on 2017-11-13
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Medium
Unassigned

Bug Description

(defun f17a (x)
  (ftruncate 0 x))

(defun f17b (x)
  (ftruncate 0 (the (member 1.0d0 -10.0d0) x)))

(defun f17c (x)
  (ftruncate 0 (the double-float x)))

(defun f17d (x)
  (declare (type (member 1.0d -10.0d0) x))
  (ftruncate 0 x))

(f17a -10.0d0) ==> -0.0d0, 0.0d0
(f17b -10.0d0) ==> 0.0d0, 0.0d0 ;; not the same as the others
(f17c -10.0d0) ==> -0.0d0, 0.0d0
(f17d -10.0d0) ==> -0.0d0, 0.0d0

Paul F. Dietz (paul-f-dietz) wrote :

It may be this is not actually a bug, since (= 0.0 -0.0) is true. Floating point operations can return slightly different values when inlined anyway.

Stas Boukarev (stassats) on 2017-11-13
Changed in sbcl:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Stas Boukarev (stassats)
Stas Boukarev (stassats) on 2017-11-13
Changed in sbcl:
assignee: Stas Boukarev (stassats) → nobody
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers