1 /*
2 Copyright (C) 2014 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.h"
13
14 void
acb_submul(acb_t z,const acb_t x,const acb_t y,slong prec)15 acb_submul(acb_t z, const acb_t x, const acb_t y, slong prec)
16 {
17 if (arb_is_zero(acb_imagref(y)))
18 {
19 arb_submul(acb_imagref(z), acb_imagref(x), acb_realref(y), prec);
20 arb_submul(acb_realref(z), acb_realref(x), acb_realref(y), prec);
21 }
22 else if (arb_is_zero(acb_imagref(x)))
23 {
24 arb_submul(acb_imagref(z), acb_imagref(y), acb_realref(x), prec);
25 arb_submul(acb_realref(z), acb_realref(y), acb_realref(x), prec);
26 }
27 else
28 {
29 acb_t t;
30 acb_init(t);
31 acb_mul(t, x, y, prec);
32 acb_sub(z, z, t, prec);
33 acb_clear(t);
34 }
35 }
36
37