[Git][cmucl/cmucl][issue-461-cdiv-use-4-doubles] 4 commits: Fix bug in deftransform / of complex floats
Raymond Toy pushed to branch issue-461-cdiv-use-4-doubles at cmucl / cmucl Commits: 3353b960 by Raymond Toy at 2026-01-19T16:36:43-08:00 Fix bug in deftransform / of complex floats We forgot to quote the body of the code that is the expansion of the deftransform. This doesn't show up until you try to compile some code that calls the deftransform. - - - - - 96037b55 by Raymond Toy at 2026-01-19T16:37:59-08:00 Need to make cdiv-single-float take 4 floats instead of 2 complex - - - - - 3f733bae by Raymond Toy at 2026-01-19T16:54:46-08:00 Fix critical typo in deftransform for / for complex floats We inadvertently left off the quote for the code that the deftransform is supposed to use. Without that the compiler produces an error when the deftransform would be applicable. This bug was introduced when the MR for #459 was landed. - - - - - f7c31886 by Raymond Toy at 2026-01-19T16:56:53-08:00 Merge branch 'master' into issue-461-cdiv-use-4-doubles - - - - - 2 changed files: - src/code/numbers.lisp - src/compiler/float-tran.lisp Changes: ===================================== src/code/numbers.lisp ===================================== @@ -811,13 +811,13 @@ ;; Smith's algorithm for complex division for (complex single-float). ;; We convert the parts to double-floats before computing the result. -(defun cdiv-single-float (x y) +(defun cdiv-single-float (xr xi yr yi) "Accurate division of complex single-float numbers x and y." - (declare (type (complex single-float) x y)) - (let ((a (float (realpart x) 1d0)) - (b (float (imagpart x) 1d0)) - (c (float (realpart y) 1d0)) - (d (float (imagpart y) 1d0))) + (declare (single-float xr xi yr yi)) + (let ((a (float xr 1d0)) + (b (float xi 1d0)) + (c (float yr 1d0)) + (d (float yi 1d0))) (cond ((< (abs c) (abs d)) (let* ((r (/ c d)) (denom (+ (* c r) d)) @@ -858,7 +858,10 @@ (((complex single-float) (foreach (complex rational) (complex single-float))) - (cdiv-single-float x (coerce y '(complex single-float)))) + (cdiv-single-float (realpart x) + (imagpart x) + (coerce (realpart y) 'single-float) + (coerce (imagpart y) 'single-float))) (((complex double-float) (foreach (complex rational) (complex single-float) (complex double-float))) (cdiv-double-float (realpart x) @@ -868,8 +871,10 @@ (((foreach integer ratio single-float (complex rational)) (complex single-float)) - (cdiv-single-float (coerce x '(complex single-float)) - y)) + (cdiv-single-float (coerce (realpart x) 'single-float) + (coerce (imagpart x) 'single-float) + (realpart y) + (imagpart y))) (((foreach integer ratio single-float double-float (complex rational) (complex single-float)) ===================================== src/compiler/float-tran.lisp ===================================== @@ -1807,10 +1807,10 @@ (macrolet ((frob (type name) `(deftransform / ((x y) ((complex ,type) (complex ,type)) *) - (,name (realpart x) - (imagpart x) - (realpart y) - (imagpart y))))) + '(,name (realpart x) + (imagpart x) + (realpart y) + (imagpart y))))) (frob double-float kernel::cdiv-double-float) (frob single-float kernel::cdiv-single-float)) View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/fae66d26c66d2632e670b8c... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/fae66d26c66d2632e670b8c... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)