mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-28 16:00:22 +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:
parent
038cb3428f
commit
23295dc35c
2 changed files with 4 additions and 1 deletions
|
@ -2991,7 +2991,7 @@ mem2complex (SCM mem, unsigned int idx,
|
||||||
|
|
||||||
if (scm_is_false (imag))
|
if (scm_is_false (imag))
|
||||||
imag = SCM_I_MAKINUM (sign);
|
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);
|
imag = scm_difference (imag, SCM_UNDEFINED);
|
||||||
|
|
||||||
if (idx == len)
|
if (idx == len)
|
||||||
|
|
|
@ -65,6 +65,9 @@
|
||||||
(equal? (read-string "1+i+i") '1+i+i))
|
(equal? (read-string "1+i+i") '1+i+i))
|
||||||
(pass-if "1+e10000i"
|
(pass-if "1+e10000i"
|
||||||
(equal? (read-string "1+e10000i") '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
|
;; 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.
|
;; of read.c. Check that `format' can be applied to this error.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue