Add support for power::info(info_flags::real).
authorRichard Kreckel <kreckel@ginac.de>
Sun, 20 Dec 2015 03:44:01 +0000 (04:44 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Sun, 20 Dec 2015 15:44:52 +0000 (16:44 +0100)
(And, while at it, clean up the surrounding code a bit.)

ginac/power.cpp

index 8e62af8b5e4f98c6b5e59f786f8ddb05efc0bd36..b5feebe215030c7d7a93edb49042db9875d1e8cc 100644 (file)
@@ -229,18 +229,18 @@ bool power::info(unsigned inf) const
                case info_flags::cinteger_polynomial:
                case info_flags::rational_polynomial:
                case info_flags::crational_polynomial:
-                       return exponent.info(info_flags::nonnegint) &&
-                              basis.info(inf);
+                       return basis.info(inf) && exponent.info(info_flags::nonnegint);
                case info_flags::rational_function:
-                       return exponent.info(info_flags::integer) &&
-                              basis.info(inf);
+                       return basis.info(inf) && exponent.info(info_flags::integer);
+               case info_flags::real:
+                       return basis.info(inf) && exponent.info(info_flags::integer);
                case info_flags::expanded:
                        return (flags & status_flags::expanded);
                case info_flags::positive:
                        return basis.info(info_flags::positive) && exponent.info(info_flags::real);
                case info_flags::nonnegative:
                        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));
+                              (basis.info(info_flags::real) && exponent.info(info_flags::even));
                case info_flags::has_indices: {
                        if (flags & status_flags::has_indices)
                                return true;