X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=check%2Fexam_paranoia.cpp;h=81dda8537772c5480d67862bd309e6794adde4a2;hp=711c64a67c8472805d59eaa992fdbc0d2c1ff940;hb=83b067d5b1a232b56039f227a9445cea3dd3225a;hpb=2639812c0ba4e1f9620660bbba1f12bf5b865e29 diff --git a/check/exam_paranoia.cpp b/check/exam_paranoia.cpp index 711c64a6..81dda853 100644 --- a/check/exam_paranoia.cpp +++ b/check/exam_paranoia.cpp @@ -468,16 +468,26 @@ static unsigned exam_paranoia17() } // Bug in add::eval() could result in numeric terms not being collected into -// the overall coefficient. Fixed on Sep 22, 2010 +// the overall coefficient. Fixed first on Sep 22, 2010 and again on Dec 17 2015 static unsigned exam_paranoia18() { + unsigned result = 0; + ex sqrt2 = sqrt(ex(2)); - ex e = 1+2*(sqrt2+1)*(sqrt2-1); - if ( e.real_part() != 3 ) { + ex e = 1 + 2*(sqrt2+1)*(sqrt2-1); + if (e.real_part() != 3) { clog << "real_part(1+2*(sqrt(2)+1)*(sqrt(2)-1)) failed to evaluate to 3\n"; - return 1; + ++result; } - return 0; + + ex sqrt3 = sqrt(ex(3)); + ex f = 2 + 2*(sqrt2+1)*(sqrt2-1) - 2*(sqrt3+1)*(sqrt3-1); + if (f.real_part() != 0) { + clog << "real_part(2+2*(sqrt(2)+1)*(sqrt(2)-1)-3*(sqrt(3)+1)*(sqrt(3)-1)) failed to evaluate to 0\n"; + ++result; + } + + return result; } // Bug in mul::conjugate when factors are evaluated at branch cuts, reported as