]> www.ginac.de Git - ginac.git/blobdiff - ginac/power.cpp
Add Markowitz-ordered Gaussian elimination algorithm.
[ginac.git] / ginac / power.cpp
index 2619492805b58ad5d635f2d8fd67bfa0706c1281..62fc3a8ddf070bd5c02a3fe0e2b75ad0006330e6 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's symbolic exponentiation (basis^exponent). */
 
 /*
- *  GiNaC Copyright (C) 1999-2017 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2018 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -669,7 +669,8 @@ ex power::real_part() const
        // basis == a+I*b, exponent == c+I*d
        const ex a = basis.real_part();
        const ex c = exponent.real_part();
-       if (basis.is_equal(a) && exponent.is_equal(c)) {
+       if (basis.is_equal(a) && exponent.is_equal(c) &&
+           (a.info(info_flags::nonnegative) || c.info(info_flags::integer))) {
                // Re(a^c)
                return *this;
        }
@@ -704,7 +705,8 @@ ex power::imag_part() const
        // basis == a+I*b, exponent == c+I*d
        const ex a = basis.real_part();
        const ex c = exponent.real_part();
-       if (basis.is_equal(a) && exponent.is_equal(c)) {
+       if (basis.is_equal(a) && exponent.is_equal(c) &&
+           (a.info(info_flags::nonnegative) || c.info(info_flags::integer))) {
                // Im(a^c)
                return 0;
        }