handling complex negation with a zero real part

This commit is contained in:
Alex Shinn 2012-07-11 23:03:43 +09:00
parent 386b798b35
commit afacac6127

6
sexp.c
View file

@ -2851,7 +2851,11 @@ sexp sexp_read_raw (sexp ctx, sexp in) {
#endif
#if SEXP_USE_COMPLEX
if (sexp_complexp(res)) {
sexp_negate(sexp_complex_real(res));
if (sexp_complex_real(res) == SEXP_ZERO) {
sexp_negate(sexp_complex_imag(res));
} else {
sexp_negate(sexp_complex_real(res));
}
} else
#endif
res = sexp_fx_mul(res, SEXP_NEG_ONE);