From afacac6127937de035ed655986fecd83624399c2 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Wed, 11 Jul 2012 23:03:43 +0900 Subject: [PATCH] handling complex negation with a zero real part --- sexp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sexp.c b/sexp.c index 00534ad2..edba159a 100644 --- a/sexp.c +++ b/sexp.c @@ -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);