fixed parsing of complex numbers in the form <float>+/-<cmpn>i

where the <float> is in scientific notation.
This commit is contained in:
Abdulaziz Ghuloum 2008-12-08 06:41:39 -05:00
parent a2e78a87d1
commit 8a277aa95a
3 changed files with 9 additions and 2 deletions

View File

@ -170,7 +170,11 @@
(let ([mag (do-dec-sn/ex sn ex (* ac (expt 10 (+ exp1 (* exp2 exp-sign)))))])
(next polar r mag ex))]
[(digit r) => d
(next exponent+digit r ex sn ac exp1 (+ (* exp2 r) d) exp-sign)])
(next exponent+digit r ex sn ac exp1 (+ (* exp2 r) d) exp-sign)]
[(#\i)
(let ([n (do-dec-sn/ex sn ex
(* ac (expt 10 (+ exp1 (* exp2 exp-sign)))))])
(next im:done (make-rectangular 0 n)))])
(polar (r mag ex)
[(digit r) => d

View File

@ -1 +1 @@
1705
1706

View File

@ -244,6 +244,9 @@
(test "-0.i" (make-rectangular 0.0 -0.0))
(test "#d#e-0.0f-0-.0s-0i" 0)
(test "+.234e4i" (make-rectangular 0 0.234e4))
(test "+.234e-5i" (make-rectangular 0 0.234e-5))
(test "+.234i" (make-rectangular 0 0.234))
)
)