Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
apply trac 31645 handling of constant term in series
Browse files Browse the repository at this point in the history
commit 9aec019
Author: Dave Witte Morris <Dave.Morris@uleth.ca>
Date:   Sun Apr 11 12:09:48 2021 -0600

    trac 31645 handling of constant term in series
  • Loading branch information
dimpase committed Jun 25, 2021
1 parent d96393c commit 80269c5
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/sage/symbolic/ginac/useries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,16 @@ void symbol::useries(flint_series_t& fp, int order) const

void add::useries(flint_series_t& fp, int order) const
{
fmpq_poly_set_ui(fp.ft, 0);
const numeric& oc = overall_coeff;
if (oc.is_zero())
fmpq_poly_set_ui(fp.ft, 0);
else if (oc.is_long())
fmpq_poly_set_si(fp.ft, oc.to_long());
else if (oc.is_mpz())
fmpq_poly_set_mpz(fp.ft, oc.as_mpz());
else
fmpq_poly_set_mpq(fp.ft, oc.as_mpq());

for (const auto & elem : seq) {
const ex& t = recombine_pair_to_ex(elem);
flint_series_t fp1;
Expand All @@ -477,18 +486,6 @@ void add::useries(flint_series_t& fp, int order) const
}
fmpq_poly_add(fp.ft, fp.ft, fp1.ft);
}
const numeric& oc = overall_coeff;
if (oc.is_zero())
return;

flint_series_t fp1;
if (oc.is_long())
fmpq_poly_set_si(fp1.ft, oc.to_long());
else if (oc.is_mpz())
fmpq_poly_set_mpz(fp1.ft, oc.as_mpz());
else
fmpq_poly_set_mpq(fp1.ft, oc.as_mpq());
fmpq_poly_add(fp.ft, fp.ft, fp1.ft);
}

void mul::useries(flint_series_t& fp, int order) const
Expand Down

0 comments on commit 80269c5

Please sign in to comment.