Fix (/ real complex) float contagion

This commit is contained in:
Stas Boukarev 2026-02-13 01:24:27 +03:00
parent d44029f2dd
commit f96e614006
4 changed files with 16 additions and 6 deletions

View file

@ -1457,12 +1457,12 @@
(if (vop-existsp :translate sb-vm::swap-complex)
(let ((real (csubtypep (lvar-type x) (specifier-type 'real))))
`(let* (,@(if real
'((x (coerce x ',type))))
'((x (coerce x 'float))))
(cs ,(if real
'(complex ,(coerce 0 type) (%negate x))
'(complex 0 (%negate x))
'(conjugate (sb-vm::swap-complex x))))
,@(if real
'((x (complex x ,(coerce 0 type)))))
'((x (complex x 0))))
(ry (realpart y))
(iy (imagpart y)))
(if (> (abs ry) (abs iy))

View file

@ -2412,7 +2412,13 @@
(/ (- a) (- b)))
((#c(0.0 3.0) #c(0.0 3.0))
(/ (opaque-identity (- #c(0.0 3.0)))
(opaque-identity (- #c(0.0 3.0)))))))
(opaque-identity (- #c(0.0 3.0))))))
(checked-compile-and-assert
()
`(lambda (n)
(declare (double-float n))
(/ n #C(1.0 2.0)))
((5d0) #C(1.0d0 -2.0d0))))
(with-test (:name :truncate+/+complex)
(checked-compile-and-assert

View file

@ -1,6 +1,10 @@
(pop *posix-argv*)
(require :sb-posix)
#-sparc (push :test-sprof *features*)
(if (find "--no-sprof" *posix-argv* :test #'equal)
(setf *posix-argv* (remove "--no-sprof" *posix-argv* :test #'equal))
#-sparc (push :test-sprof *features*))
#+test-sprof (require :sb-sprof)
;; (push :tlsf-stress *features*)

View file

@ -260,7 +260,7 @@
"Type" "string"
"Value" ""
"KeyPath" "yes")))))
("Directory" ("Id" #+x86 "ProgramFilesFolder"
("Directory" ("Id" #+x86 "ProgramFilesFolder"
#+64-bit "ProgramFiles64Folder"
"Name" "PFiles")
("Directory" ("Id" "BaseFolder"