fix bug parsing polar notation conbined with #e

svn: r14878
This commit is contained in:
Matthew Flatt 2009-05-20 00:18:15 +00:00
parent af94e11d19
commit de5bbaff40
3 changed files with 14 additions and 5 deletions

View File

@ -2060,6 +2060,10 @@
(test #t symbol? '1+ei) (test #t symbol? '1+ei)
(test #t symbol? '|1/0|) (test #t symbol? '|1/0|)
(test #t inexact? (string->number "4@5"))
(test #f inexact? (string->number "#e4@5"))
(test #f inexact? (string->number "#e4.0@5.0"))
(arity-test string->number 1 2) (arity-test string->number 1 2)
(arity-test number->string 1 2) (arity-test number->string 1 2)

View File

@ -105,7 +105,7 @@
(5000.0 "1#/2#e4") (5000.0 "1#/2#e4")
(500000000.0 "1/2#e10") (500000000.0 "1/2#e10")
(500000000 "#e1/2#e10") (500000000 "#e1/2#e10")
(1.6140901064495858e+019-50176.0i "#e#x+e#s+e@-e#l-e") (16140901064495857664-50176i "#e#x+e#s+e@-e#l-e")
(#f "d") (#f "d")
(D "D") (D "D")

View File

@ -876,12 +876,17 @@ Scheme_Object *scheme_read_number(const mzchar *str, long len,
#ifdef MZ_USE_SINGLE_FLOATS #ifdef MZ_USE_SINGLE_FLOATS
if (SCHEME_FLTP(n1) && SCHEME_FLTP(n2)) if (SCHEME_FLTP(n1) && SCHEME_FLTP(n2))
return scheme_make_complex(scheme_make_float((float)r1), n1 = scheme_make_complex(scheme_make_float((float)r1),
scheme_make_float((float)r2)); scheme_make_float((float)r2));
else
#endif #endif
n1 = scheme_make_complex(scheme_make_double(r1),
scheme_make_double(r2));
return scheme_make_complex(scheme_make_double(r1), if (is_not_float)
scheme_make_double(r2)); n1 = scheme_inexact_to_exact(1, &n1);
return n1;
} }
has_decimal = has_slash = has_hash = has_hash_since_slash = has_expt = 0; has_decimal = has_slash = has_hash = has_hash_since_slash = has_expt = 0;