[goffice] Complex: Fix cpow for negative first and real second argument.



commit 2d9c39ae095a227bab13c955715830cdd4c475a5
Author: Morten Welinder <terra gnome org>
Date:   Sat Dec 14 18:07:48 2013 -0500

    Complex: Fix cpow for negative first and real second argument.
    
    I got a little carried away previously in sending stuff to plain pow.

 goffice/math/go-complex.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/goffice/math/go-complex.c b/goffice/math/go-complex.c
index b93859f..7822e86 100644
--- a/goffice/math/go-complex.c
+++ b/goffice/math/go-complex.c
@@ -351,7 +351,8 @@ SUFFIX(mulmod1) (SUFFIX(GOQuad) *dst, SUFFIX(GOQuad) const *qa_, DOUBLE b)
 void
 SUFFIX(go_complex_pow) (COMPLEX *dst, COMPLEX const *a, COMPLEX const *b)
 {
-       if (SUFFIX(go_complex_real_p) (a) && SUFFIX(go_complex_real_p) (b)) {
+       if (SUFFIX(go_complex_real_p) (a) && a->re >= 0 &&
+           SUFFIX(go_complex_real_p) (b)) {
                SUFFIX(go_complex_init) (dst, pow (a->re, b->re), 0);
        } else if (SUFFIX(go_complex_real_p) (b)) {
                DOUBLE p = SUFFIX(fabs) (b->re);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]