Fix pow::info(info_flags::nonnegative).
authorVladimir Kisil <kisilv@maths.leeds.ac.uk>
Wed, 22 Apr 2015 21:06:56 +0000 (23:06 +0200)
committerRichard Kreckel <kreckel@ginac.de>
Wed, 22 Apr 2015 21:06:56 +0000 (23:06 +0200)
This function call was missing the case where a positive base is raised
to a real power (where pow::info(info_flags::positive) correctly returned
true).

ginac/power.cpp

index 82200d7..2dd6448 100644 (file)
@@ -243,7 +243,8 @@ bool power::info(unsigned inf) const
                case info_flags::positive:
                        return basis.info(info_flags::positive) && exponent.info(info_flags::real);
                case info_flags::nonnegative:
-                       return basis.info(info_flags::real) && exponent.info(info_flags::integer) && exponent.info(info_flags::even);
+                       return (basis.info(info_flags::positive) && exponent.info(info_flags::real)) ||
+                              (basis.info(info_flags::real) && exponent.info(info_flags::integer) && exponent.info(info_flags::even));
                case info_flags::has_indices: {
                        if (flags & status_flags::has_indices)
                                return true;