This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMU Common Lisp".
The branch, master has been updated via 6f288c11cde92ce34b55d8c00df8095f00671be2 (commit) from 24c656a5824bfd4fb9d45dfd88a25f6015e56db4 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 6f288c11cde92ce34b55d8c00df8095f00671be2 Author: Raymond Toy toy.raymond@gmail.com Date: Wed Sep 24 20:27:54 2014 -0700
Fix type derivation of the exponent for DECODE-FLOAT.
The minimum exponent is from 0, it's from least-positive float.
* src/compiler/float-tran.lisp: * Derive the correct minimum exponent by using the exponent from the least-positive float value of the appropriate type. * tests/float-tran.lisp: * Add tests for the derived exponent type for DECODE-FLOAT.
diff --git a/src/compiler/float-tran.lisp b/src/compiler/float-tran.lisp index f474429..23aa93f 100644 --- a/src/compiler/float-tran.lisp +++ b/src/compiler/float-tran.lisp @@ -2084,13 +2084,13 @@ (when x (nth-value 1 (decode-float x)))) (min-exp () - ;; Use decode-float on 0 of the appropriate type to find - ;; the min exponent. If we don't know the actual number - ;; format, use double, which has the widest range - ;; (including double-double-float). - (if (numeric-type-format arg) - (nth-value 1 (decode-float (coerce 0 (numeric-type-format arg)))) - (nth-value 1 (decode-float (coerce 0 'double-float))))) + ;; Use decode-float on the least positive float of the + ;; appropriate type to find the min exponent. If we don't + ;; know the actual number format, use double, which has the + ;; widest range (including double-double-float). + (nth-value 1 (decode-float (if (eq 'single-float (numeric-type-format arg)) + least-positive-single-float + least-positive-double-float)))) (max-exp () ;; Use decode-float on the most postive number of the ;; appropriate type to find the max exponent. If we don't diff --git a/tests/float-tran.lisp b/tests/float-tran.lisp index 0c47dce..9b84659 100644 --- a/tests/float-tran.lisp +++ b/tests/float-tran.lisp @@ -17,6 +17,22 @@ (c::decode-float-sign-derive-type-aux (c::specifier-type '(single-float (0f0))))))
+(define-test decode-float-exp + "Test type derivation of the exponent from decode-float" + (assert-equalp (c::specifier-type '(integer -148 128)) + (c::decode-float-exp-derive-type-aux + (c::specifier-type 'single-float))) + (assert-equalp (c::specifier-type '(integer -1073 1024)) + (c::decode-float-exp-derive-type-aux + (c::specifier-type 'double-float))) + #+double-double + (assert-equalp (c::specifier-type '(integer -1073 1024)) + (c::decode-float-exp-derive-type-aux + (c::specifier-type 'double-double-float))) + (assert-equalp (c::specifier-type '(integer 2 8)) + (c::decode-float-exp-derive-type-aux + (c::specifier-type '(double-float 2d0 128d0))))) + (define-test log2-single-transform "Test tranform of (log x 2) to (kernel::log2 x)" (let ((test-fun
-----------------------------------------------------------------------
Summary of changes: src/compiler/float-tran.lisp | 14 +++++++------- tests/float-tran.lisp | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-)
hooks/post-receive