]> www.ginac.de Git - ginac.git/blobdiff - ginac/power.cpp
- input parser recognizes "sqrt()", which is also used in the output
[ginac.git] / ginac / power.cpp
index 58913a8bcfd1a786f377c2b667e1cc0be4209292..78c9c9696d14303b468a4f3b1c69b460560a314a 100644 (file)
@@ -238,8 +238,10 @@ int power::degree(const ex & s) const
                        return ex_to<numeric>(exponent).to_int();
                else
                        return basis.degree(s) * ex_to<numeric>(exponent).to_int();
-       }
-       return 0;
+       } else if (basis.has(s))
+               throw(std::runtime_error("power::degree(): undefined degree because of non-integer exponent"));
+       else
+               return 0;
 }
 
 int power::ldegree(const ex & s) const 
@@ -249,8 +251,10 @@ int power::ldegree(const ex & s) const
                        return ex_to<numeric>(exponent).to_int();
                else
                        return basis.ldegree(s) * ex_to<numeric>(exponent).to_int();
-       }
-       return 0;
+       } else if (basis.has(s))
+               throw(std::runtime_error("power::ldegree(): undefined degree because of non-integer exponent"));
+       else
+               return 0;
 }
 
 ex power::coeff(const ex & s, int n) const