[GiNaC-devel] [PATCH 2/2] integral::evalf(): don't attempt to ignore problems.
Alexei Sheplyakov
alexei.sheplyakov at gmail.com
Thu Aug 19 10:10:25 CEST 2010
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)
---
ginac/integral.cpp | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/ginac/integral.cpp b/ginac/integral.cpp
index 07670f3..f45d1ab 100644
--- a/ginac/integral.cpp
+++ b/ginac/integral.cpp
@@ -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)
--
1.7.1
More information about the GiNaC-devel
mailing list