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 e5ce88c766cd83f58a0b4e3d0e99bdd24d92b86a (commit) via f9be60b19ca38fbbf34dc64bf5442f119afe2725 (commit) via aa05f53d8b1fa758d0768ccec0462a9ad9f1f601 (commit) via ebc07aeb9114976829a26667ac2b88ce7a49bdcb (commit) from 8a5b49ec0af3c4cad29a26e8dc3f9cee029fd67d (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 e5ce88c766cd83f58a0b4e3d0e99bdd24d92b86a Author: Raymond Toy toy.raymond@gmail.com Date: Sat Mar 1 08:43:49 2014 -0800
Regenerated.
diff --git a/src/i18n/locale/cmucl.pot b/src/i18n/locale/cmucl.pot index 2034dac..fdbb637 100644 --- a/src/i18n/locale/cmucl.pot +++ b/src/i18n/locale/cmucl.pot @@ -182,9 +182,9 @@ msgid "" " setf." msgstr ""
-#: src/code/reader.lisp src/code/format.lisp src/code/print.lisp -#: src/code/irrat-dd.lisp src/code/irrat.lisp src/code/float.lisp -#: src/code/numbers.lisp src/code/kernel.lisp +#: src/code/format.lisp src/code/print.lisp src/code/irrat-dd.lisp +#: src/code/irrat.lisp src/code/float.lisp src/code/numbers.lisp +#: src/code/kernel.lisp msgid "Argument ~A is not a ~S: ~S." msgstr ""
@@ -8553,7 +8553,7 @@ msgid "Underflow" msgstr ""
#: src/code/reader.lisp -msgid "Number not representable as ~S: ~S" +msgid "Number not representable as a ~S: ~S" msgstr ""
#: src/code/reader.lisp
commit f9be60b19ca38fbbf34dc64bf5442f119afe2725 Author: Raymond Toy toy.raymond@gmail.com Date: Sat Mar 1 08:43:26 2014 -0800
Fix ticket 93.
* Round the number to least-positive-foo-float when possible, but still throw an error if it's too small but not zero. * Update comments to mention CLHS 2.3.1.1.
diff --git a/src/code/reader.lisp b/src/code/reader.lisp index 27c18ae..b06230c 100644 --- a/src/code/reader.lisp +++ b/src/code/reader.lisp @@ -1839,15 +1839,15 @@ the end of the stream." least-positive-single-float) (double-float least-positive-double-float) + #+double-double (double-double-float - (kernel:make-double-double-float least-positive-double-float - 0d0))))) + ext:least-positive-double-double-float)))) (if (>= (* 2 ratio) float-limit) (setf result float-limit) (error _"Underflow")))) result)) (error () - (%reader-error stream _"Number not representable as ~S: ~S" + (%reader-error stream _"Number not representable as a ~S: ~S" float-format (/ number divisor)))))
commit aa05f53d8b1fa758d0768ccec0462a9ad9f1f601 Merge: ebc07ae 8a5b49e Author: Raymond Toy toy.raymond@gmail.com Date: Sat Mar 1 08:31:39 2014 -0800
Merge branch 'master' into rtoy-round-float-in-reader
commit ebc07aeb9114976829a26667ac2b88ce7a49bdcb Author: Raymond Toy toy.raymond@gmail.com Date: Fri Feb 28 19:49:04 2014 -0800
Fix ticket 93.
* src/code/reader.lisp: * Try to round really small numbers * Add somewhat more informative message when the number is not representable. * src/i18n/local/cmucl.pot: * Update * tests/trac.lisp: * Add test for ticket 93 * Add a few comments for test trac.87.
diff --git a/src/code/reader.lisp b/src/code/reader.lisp index 4eabc4e..27c18ae 100644 --- a/src/code/reader.lisp +++ b/src/code/reader.lisp @@ -1824,17 +1824,31 @@ the end of the stream." (defun make-float-aux (number divisor float-format stream) (handler-case (with-float-traps-masked (:underflow) - (let ((result (coerce (/ number divisor) float-format))) + (let* ((ratio (/ number divisor)) + (result (coerce ratio float-format))) (when (and (zerop result) (not (zerop number))) - ;; With underflow traps disabled, reading any number - ;; smaller than least-positive-foo-float will return zero. - ;; But we really want to indicate that we can't read it. - ;; So if we converted the number to zero, but the number - ;; wasn't actually zero, throw an error. - (error _"Underflow")) + ;; The number we've read is so small that it gets + ;; converted to 0.0, but is not actually zero. In this + ;; case, we want to round such small numbers to + ;; least-positive-foo-float. If it's still too small, we + ;; want to signal an error saying that we can't really + ;; convert it because the exponent is too small. + ;; See CLHS 2.3.1.1. + (let ((float-limit (ecase float-format + ((short-float single-float) + least-positive-single-float) + (double-float + least-positive-double-float) + (double-double-float + (kernel:make-double-double-float least-positive-double-float + 0d0))))) + (if (>= (* 2 ratio) float-limit) + (setf result float-limit) + (error _"Underflow")))) result)) (error () - (%reader-error stream _"Floating-point number not representable")))) + (%reader-error stream _"Number not representable as ~S: ~S" + float-format (/ number divisor)))))
(defun make-ratio (stream) diff --git a/src/i18n/locale/cmucl.pot b/src/i18n/locale/cmucl.pot index 8ae0b93..2034dac 100644 --- a/src/i18n/locale/cmucl.pot +++ b/src/i18n/locale/cmucl.pot @@ -182,9 +182,9 @@ msgid "" " setf." msgstr ""
-#: src/code/format.lisp src/code/print.lisp src/code/irrat-dd.lisp -#: src/code/irrat.lisp src/code/float.lisp src/code/numbers.lisp -#: src/code/kernel.lisp +#: src/code/reader.lisp src/code/format.lisp src/code/print.lisp +#: src/code/irrat-dd.lisp src/code/irrat.lisp src/code/float.lisp +#: src/code/numbers.lisp src/code/kernel.lisp msgid "Argument ~A is not a ~S: ~S." msgstr ""
@@ -8553,7 +8553,7 @@ msgid "Underflow" msgstr ""
#: src/code/reader.lisp -msgid "Floating-point number not representable" +msgid "Number not representable as ~S: ~S" msgstr ""
#: src/code/reader.lisp @@ -13084,7 +13084,11 @@ msgid "" " process changes. The function takes the process as an argument.\n" " :external-format -\n" " This is the external-format used for communication with the subproce" -"ss." +"ss.\n" +" :element-type -\n" +" When a stream is created for :input or :output, the stream\n" +" uses this element-type instead of the default 'BASE-CHAR type.\n" +"" msgstr ""
#: src/code/run-program.lisp diff --git a/tests/trac.lisp b/tests/trac.lisp index 87e3ca7..7fd9408 100644 --- a/tests/trac.lisp +++ b/tests/trac.lisp @@ -276,7 +276,9 @@
(define-test trac.87.output (:tag :trac) - (let ((path "/tmp/trac.87") + ;; Test that run-program accepts :element-type and produces the + ;; correct output. + (let ((path "/tmp/trac.87.output") (string "Hello")) (unwind-protect (progn @@ -297,7 +299,9 @@
(define-test trac.87.input (:tag :trac) - (let ((path "/tmp/trac.87") + ;; Test that run-program accepts :element-type and produces the + ;; correct input (and output). + (let ((path "/tmp/trac.87.input") (string "Hello")) (unwind-protect (progn @@ -328,3 +332,23 @@ 'double-float (third (kernel:%function-type f)))))
+(define-test trac.93 + (:tag :trac) + ;; These small values should read to least-positive-foo-float + ;; because that's the closest non-zero float. + (assert-eql least-positive-short-float + (values (read-from-string ".8s-45"))) + (assert-eql least-positive-single-float + (values (read-from-string ".8e-45"))) + (assert-eql least-positive-double-float + (values (read-from-string "4d-324"))) + (assert-eql (kernel:make-double-double-float least-positive-double-float 0d0) + (values (read-from-string "4w-324"))) + ;; These should signal reader errors because the numbers are not + ;; zero, but are too small to be represented by the corresponding + ;; float type. + (assert-error 'reader-error (read-from-string ".1s-45")) + (assert-error 'reader-error (read-from-string ".1e-45")) + (assert-error 'reader-error (read-from-string "1d-324")) + (assert-error 'reader-error (read-from-string "1w-324"))) + \ No newline at end of file
-----------------------------------------------------------------------
Summary of changes: src/code/reader.lisp | 30 ++++++++++++++++++++++-------- src/i18n/locale/cmucl.pot | 2 +- tests/trac.lisp | 28 ++++++++++++++++++++++++++-- 3 files changed, 49 insertions(+), 11 deletions(-)
hooks/post-receive