integral::evalf(): don't attempt to ignore problems.
authorAlexei Sheplyakov <alexei.sheplyakov@gmail.com>
Thu, 19 Aug 2010 08:10:25 +0000 (11:10 +0300)
committerJens Vollinga <jensv@nikhef.nl>
Mon, 23 Aug 2010 13:13:36 +0000 (15:13 +0200)
Don't ignore exceptions thrown by numerical integration routine.
In general, the code like this

try {
// blah-blah
} catch (std::exception& err) { }

is just plain evil. Case in the point:

fsolve((1/(sqrt(2*Pi)))*integral(t,0,x,exp(-1/2*t^2))==0.5,x,0,100)
(cherry picked from commit 515171f0bcd42099c266713c3d605cd92cedd2e2)

ginac/integral.cpp

index 07670f3..f45d1ab 100644 (file)
@@ -188,9 +188,7 @@ ex integral::evalf(int level) const
        // results after subsituting a number for the integration variable.
        if (is_exactly_a<numeric>(ea) && is_exactly_a<numeric>(eb) 
                        && is_exactly_a<numeric>(ef.subs(x==12.34).evalf())) {
-               try {
                        return adaptivesimpson(x, ea, eb, ef);
-               } catch (runtime_error &rte) {}
        }
 
        if (are_ex_trivially_equal(a, ea) && are_ex_trivially_equal(b, eb)