]> www.ginac.de Git - ginac.git/blobdiff - ginac/integral.cpp
* Fix static initialization order fiasco.
[ginac.git] / ginac / integral.cpp
index 467cf2909a6aa02f702586d1c1db82151ec4b502..419e08282735d657dab7a24f5a01d1237d4e79a5 100644 (file)
@@ -203,7 +203,7 @@ ex integral::evalf(int level) const
 }
 
 int integral::max_integration_level = 15;
-ex integral::relative_integration_error = power(10,-8).evalf();
+ex integral::relative_integration_error = 1e-8;
 
 ex subsvalue(const ex & var, const ex & value, const ex & fun)
 {
@@ -319,30 +319,34 @@ ex integral::op(size_t i) const
 {
        GINAC_ASSERT(i<4);
 
-       switch(i) {
-               case(0):
+       switch (i) {
+               case 0:
                        return x;
-               case(1):
+               case 1:
                        return a;
-               case(2):
+               case 2:
                        return b;
-               case(3):
+               case 3:
                        return f;
+               default:
+                       throw (std::out_of_range("integral::op() out of range"));
        }
 }
 
 ex & integral::let_op(size_t i)
 {
        ensure_if_modifiable();
-       switch(i) {
-               case(0):
+       switch (i) {
+               case 0:
                        return x;
-               case(1):
+               case 1:
                        return a;
-               case(2):
+               case 2:
                        return b;
-               case(3):
+               case 3:
                        return f;
+               default:
+                       throw (std::out_of_range("integral::let_op() out of range"));
        }
 }
 
@@ -390,7 +394,8 @@ ex integral::expand(unsigned options) const
 }
 
 ex integral::derivative(const symbol & s) const
-{      if (s==x)
+{
+       if (s==x)
                throw(logic_error("differentiation with respect to dummy variable"));
        return b.diff(s)*f.subs(x==b)-a.diff(s)*f.subs(x==a)+integral(x, a, b, f.diff(s));
 }