Skip to content
Snippets Groups Projects
Commit 8e0c67d0 authored by Raymond Toy's avatar Raymond Toy
Browse files

Return -infinity for %log2 and %log10 of +0.

parent 4d3255aa
No related branches found
No related tags found
No related merge requests found
...@@ -1379,6 +1379,9 @@ pi/4 11001001000011111101101010100010001000010110100011000 010001101001100010 ...@@ -1379,6 +1379,9 @@ pi/4 11001001000011111101101010100010001000010110100011000 010001101001100010
(declare (type double-double-float x) (declare (type double-double-float x)
(optimize (speed 3) (space 0) (optimize (speed 3) (space 0)
(inhibit-warnings 3))) (inhibit-warnings 3)))
(when (eql x 0w0)
;; log2(+0) = -infinity
(return-from dd-%log2 (/ -1 x)))
(multiple-value-bind (e x y z) (multiple-value-bind (e x y z)
(compute-log x) (compute-log x)
;; Multiply log of fraction by log2(e) and base 2 exponent by 1 ;; Multiply log of fraction by log2(e) and base 2 exponent by 1
...@@ -1395,6 +1398,9 @@ pi/4 11001001000011111101101010100010001000010110100011000 010001101001100010 ...@@ -1395,6 +1398,9 @@ pi/4 11001001000011111101101010100010001000010110100011000 010001101001100010
(declare (type double-double-float x) (declare (type double-double-float x)
(optimize (speed 3) (space 0) (optimize (speed 3) (space 0)
(inhibit-warnings 3))) (inhibit-warnings 3)))
(when (eql x 0w0)
;; log2(+0) = -infinity
(return-from dd-%log10 (/ -1 x)))
(multiple-value-bind (e x y z) (multiple-value-bind (e x y z)
(compute-log x) (compute-log x)
;; Multiply log of fraction by log10(e) and base 2 exponent by log10(2). ;; Multiply log of fraction by log10(e) and base 2 exponent by log10(2).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment