mirror of
git://git.code.sf.net/p/sbcl/sbcl
synced 2026-09-10 07:26:40 -04:00
Make the cross float sqrt work on -0.0
This commit is contained in:
parent
c76b206937
commit
d526dd1968
|
|
@ -336,9 +336,14 @@
|
|||
(%%sqrt rational (cl:/ (isqrt (numerator rational)) (isqrt (denominator rational))))))
|
||||
|
||||
(defun sb-xc:sqrt (arg)
|
||||
(let ((format (if (rationalp arg) 'single-float (type-of arg))))
|
||||
(with-memoized-math-op (sqrt arg)
|
||||
(flonum-from-rational (%sqrt (rational arg)) format))))
|
||||
(cond ((eql arg 0)
|
||||
0.0)
|
||||
((sb-xc:= arg 0)
|
||||
arg)
|
||||
(t
|
||||
(let ((format (if (rationalp arg) 'single-float (type-of arg))))
|
||||
(with-memoized-math-op (sqrt arg)
|
||||
(flonum-from-rational (%sqrt (rational arg)) format))))))
|
||||
|
||||
;;; There seems to be no portable way to mask float traps, so right
|
||||
;;; now we ignore them and hardcode special cases.
|
||||
|
|
|
|||
Loading…
Reference in a new issue