1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Incorrect parsing of NaN complex numbers

* libguile/numbers.c (mem2complex): modified
* test-suite/tests/reader.test: new complex NaN reader test
This commit is contained in:
Michael Gran 2010-09-25 09:07:21 -07:00
parent 038cb3428f
commit 23295dc35c
2 changed files with 4 additions and 1 deletions

View file

@ -2991,7 +2991,7 @@ mem2complex (SCM mem, unsigned int idx,
if (scm_is_false (imag))
imag = SCM_I_MAKINUM (sign);
else if (sign == -1 && scm_is_false (scm_nan_p (ureal)))
else if (sign == -1 && scm_is_false (scm_nan_p (imag)))
imag = scm_difference (imag, SCM_UNDEFINED);
if (idx == len)

View file

@ -65,6 +65,9 @@
(equal? (read-string "1+i+i") '1+i+i))
(pass-if "1+e10000i"
(equal? (read-string "1+e10000i") '1+e10000i))
(pass-if "-nan.0-1i"
(not (equal? (imag-part (read-string "-nan.0-1i"))
(imag-part (read-string "-nan.0+1i")))))
;; At one time the arg list for "Unknown # object: ~S" didn't make it out
;; of read.c. Check that `format' can be applied to this error.