When parsing a badly-formed number with a #i prefix, don't blindly
authorChris Hanson <org/chris-hanson/cph>
Fri, 27 Oct 1989 04:42:59 +0000 (04:42 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 27 Oct 1989 04:42:59 +0000 (04:42 +0000)
attempt to map the result to inexact; test to see if the number is
well-formed first.

v7/src/runtime/numpar.scm

index 8c0a61a5cb8eab803b34d8de5b1848cd6f2d94fd..5d6e41dfcdf7f2781eed1c899db3825587c8f9c2 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/numpar.scm,v 14.3 1989/10/26 06:50:33 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/numpar.scm,v 14.4 1989/10/27 04:42:59 cph Exp $
 
 Copyright (c) 1989 Massachusetts Institute of Technology
 
@@ -46,7 +46,9 @@ MIT in each case. |#
     (with-values (lambda () (parse-prefix (string->list string)))
       (lambda (chars radix-prefix exactness)
        ((if (eq? exactness 'INEXACT)
-            exact->inexact
+            (lambda (number)
+              (and number
+                   (exact->inexact number)))
             identity-procedure)
         (let ((radix (or radix-prefix radix-default)))
           (with-values (lambda () (parse-sign chars))