1 /*
2 Copyright (C) 2016 Fredrik Johansson
3
4 This file is part of Arb.
5
6 Arb is free software: you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License (LGPL) as published
8 by the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version. See <http://www.gnu.org/licenses/>.
10 */
11
12 #include "acb_poly.h"
13
14 void
acb_poly_add_series(acb_poly_t res,const acb_poly_t poly1,const acb_poly_t poly2,slong len,slong prec)15 acb_poly_add_series(acb_poly_t res, const acb_poly_t poly1,
16 const acb_poly_t poly2, slong len, slong prec)
17 {
18 slong len1, len2;
19
20 len1 = poly1->length;
21 len2 = poly2->length;
22
23 len1 = FLINT_MIN(len1, len);
24 len2 = FLINT_MIN(len2, len);
25 len = FLINT_MAX(len1, len2);
26
27 acb_poly_fit_length(res, len);
28 _acb_poly_add(res->coeffs, poly1->coeffs, len1, poly2->coeffs, len2, prec);
29 _acb_poly_set_length(res, len);
30 _acb_poly_normalise(res);
31 }
32
33