]> www.ginac.de Git - ginac.git/blobdiff - ginac/integral.cpp
A better return_type_tinfo() mechanism.
[ginac.git] / ginac / integral.cpp
index 2f54b503bb9ef5b160b60e1f9193faf0c89b30b0..220047568f160f36a9b522bb34dd6bb1f94f1040 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's symbolic  integral. */
 
 /*
- *  GiNaC Copyright (C) 1999-2006 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -223,7 +223,7 @@ struct error_and_integral
 
 struct error_and_integral_is_less
 {
-       bool operator()(const error_and_integral &e1,const error_and_integral &e2)
+       bool operator()(const error_and_integral &e1,const error_and_integral &e2) const
        {
                int c = e1.integral.compare(e2.integral);
                if(c < 0)
@@ -279,7 +279,7 @@ ex adaptivesimpson(const ex & x, const ex & a_in, const ex & b_in, const ex & f,
        fbvec[i] = subsvalue(x, b, f);
        svec[i] = hvec[i]*(favec[i]+4*fcvec[i]+fbvec[i])/3;
        lvec[i] = 1;
-       errorvec[i] = error*svec[i];
+       errorvec[i] = error*abs(svec[i]);
 
        while (i>0) {
                ex fd = subsvalue(x, avec[i]+hvec[i]/2, f);
@@ -292,7 +292,7 @@ ex adaptivesimpson(const ex & x, const ex & a_in, const ex & b_in, const ex & f,
                ex nu4 = fbvec[i];
                ex nu5 = hvec[i];
                // hopefully prevents a crash if the function is zero sometimes.
-               ex nu6 = max(errorvec[i], (s1+s2)*error);
+               ex nu6 = max(errorvec[i], abs(s1+s2)*error);
                ex nu7 = svec[i];
                int nu8 = lvec[i];
                --i;
@@ -436,7 +436,7 @@ unsigned integral::return_type() const
        return f.return_type();
 }
 
-const basic* integral::return_type_tinfo() const
+return_type_t integral::return_type_tinfo() const
 {
        return f.return_type_tinfo();
 }