From: Richard Kreckel Date: Sun, 21 Apr 2019 19:43:45 +0000 (+0200) Subject: Fix bug in mul::series() about asymptotic order term. X-Git-Tag: release_1-7-6~1 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=709e61093f43462b5816f859a32a31cc00758da8 Fix bug in mul::series() about asymptotic order term. This reverts db81420a6195 and adds a test case. Thanks to Feng Feng for reporting this. --- diff --git a/check/exam_pseries.cpp b/check/exam_pseries.cpp index 3752a1f1..e59026c4 100644 --- a/check/exam_pseries.cpp +++ b/check/exam_pseries.cpp @@ -141,6 +141,10 @@ static unsigned exam_series1() d = pow(a, b) + (pow(a, b)*b/a)*x + (pow(a, b)*b*b/a/a/2 - pow(a, b)*b/a/a/2)*pow(x, 2) + Order(pow(x, 3)); result += check_series(e, 0, d, 3); + e = a * (1 / (x * sin(x)) - sin(x) / x); + d = a * pow(x, -2) + Order(pow(x, -1)); + result += check_series(e, 0, d, -1); + return result; } diff --git a/ginac/pseries.cpp b/ginac/pseries.cpp index e7462206..4dba5129 100644 --- a/ginac/pseries.cpp +++ b/ginac/pseries.cpp @@ -959,9 +959,8 @@ ex mul::series(const relational & r, int order, unsigned options) const int degsum = std::accumulate(ldegrees.begin(), ldegrees.end(), 0); - if (degsum >= order) { - epvector epv { expair(Order(_ex1), order) }; - return dynallocate(r, std::move(epv)); + if (degsum > order) { + return dynallocate(r, epvector{{Order(_ex1), order}}); } // Multiply with remaining terms