X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=check%2Fexam_inifcns_nstdsums.cpp;h=7bf1efd1ed486a874a38dc7b66428c1418865929;hb=d722054bbb92b92b54b628d143824ff2f1b12821;hp=4d81233bc62404e066e3946340512b92ae9c04a3;hpb=67edef78ce992a8f6ad704bfac228b8dec6eacd2;p=ginac.git diff --git a/check/exam_inifcns_nstdsums.cpp b/check/exam_inifcns_nstdsums.cpp index 4d81233b..7bf1efd1 100644 --- a/check/exam_inifcns_nstdsums.cpp +++ b/check/exam_inifcns_nstdsums.cpp @@ -4,7 +4,7 @@ * functions. */ /* - * GiNaC Copyright (C) 1999-2010 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2011 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 @@ -80,7 +80,7 @@ static unsigned inifcns_test_S() int digitsbuf = Digits; // precision of data Digits = 22; - ex prec = 5 * pow(10, -(int)Digits); + ex prec = 5 * pow(10, -(ex)Digits); unsigned result = 0; @@ -125,9 +125,10 @@ static unsigned inifcns_test_S() static unsigned inifcns_test_HLi() { + using GiNaC::log; int digitsbuf = Digits; Digits = 17; - ex prec = 5 * pow(10, -(int)Digits); + ex prec = 5 * pow(10, -(ex)Digits); numeric almostone("0.999999999999999999"); unsigned result = 0; @@ -198,7 +199,7 @@ static unsigned inifcns_test_zeta() for (lst::const_iterator it = res.begin(); it != res.end(); it++) { Digits = 17; - ex prec = 5 * pow(10, -(int)Digits); + ex prec = 5 * pow(10, -(ex)Digits); ex diff = abs((*it).evalf()); if (diff > prec) { clog << *it << " seems to be wrong: " << diff << endl; @@ -207,7 +208,7 @@ static unsigned inifcns_test_zeta() } cout << "." << flush; Digits = 40; - prec = 5 * pow(10, -(int)Digits); + prec = 5 * pow(10, -(ex)Digits); diff = abs((*it).evalf()); if (diff > prec) { clog << *it << " seems to be wrong: " << diff << endl; @@ -234,7 +235,7 @@ static unsigned inifcns_test_LiG() { int digitsbuf = Digits; Digits = 17; - ex prec = 5 * pow(10, -(int)Digits); + ex prec = 5 * pow(10, -(ex)Digits); numeric almostone("0.99999999999999999999"); unsigned result = 0; @@ -300,7 +301,7 @@ static unsigned inifcns_test_LiG() static unsigned inifcns_test_legacy() { Digits = 17; - ex prec = 5 * pow(10, -(int)Digits); + ex prec = 5 * pow(10, -(ex)Digits); unsigned result = 0; @@ -327,7 +328,7 @@ static unsigned inifcns_test_legacy() } Digits = 100; - prec = 5 * pow(10, -(int)Digits); + prec = 5 * pow(10, -(ex)Digits); ex x0 = 1.; x1 = exp(Pi*I/3).evalf(); x2 = exp(2*Pi*I/3).evalf(); @@ -364,6 +365,33 @@ static unsigned inifcns_test_legacy() return result; } +static unsigned check_G_y_one_bug() +{ + exvector exprs; + exprs.push_back(G(lst(-1,-1, 1,-1, 0), 1)); + exprs.push_back(G(lst(-1, 0, 1,-1, 0), 1)); + exprs.push_back(G(lst(-1, 1,-1,-1, 0), 1)); + exprs.push_back(G(lst(-1, 1,-1, 0, 0), 1)); + exprs.push_back(G(lst(-1, 1,-1, 1, 0), 1)); + exprs.push_back(G(lst(-1, 1, 0,-1, 0), 1)); + exprs.push_back(G(lst(-1, 1, 1,-1, 0), 1)); + exprs.push_back(G(lst( 0,-1, 1,-1, 0), 1)); + exprs.push_back(G(lst( 0, 1, 1,-1, 0), 1)); + unsigned err = 0; + for (exvector::const_iterator ep = exprs.begin(); ep != exprs.end(); ++ep) { + try { + ex val = ep->evalf(); + if (!is_a(val)) { + clog << "evalf(" << *ep << ") is not a number: " << val << endl; + ++err; + } + } catch (std::exception& oops) { + clog << "evalf(" << *ep << "): got an exception" << oops.what() << endl; + ++err; + } + } + return err; +} unsigned exam_inifcns_nstdsums(void) { @@ -376,6 +404,7 @@ unsigned exam_inifcns_nstdsums(void) result += inifcns_test_HLi(); result += inifcns_test_LiG(); result += inifcns_test_legacy(); + result += check_G_y_one_bug(); return result; }