1 /*
2 Copyright (C) 2012 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_exp(acb_t r,const acb_t z,slong prec)15 acb_exp(acb_t r, const acb_t z, slong prec)
16 {
17 #define a acb_realref(z)
18 #define b acb_imagref(z)
19 if (arb_is_zero(b))
20 {
21 arb_exp(acb_realref(r), a, prec);
22 arb_zero(acb_imagref(r));
23 }
24 else if (arb_is_zero(a))
25 {
26 arb_sin_cos(acb_imagref(r), acb_realref(r), b, prec);
27 }
28 else
29 {
30 arb_t t, u, v;
31
32 arb_init(t);
33 arb_init(u);
34 arb_init(v);
35
36 arb_exp(t, a, prec);
37 arb_sin_cos(u, v, b, prec);
38
39 arb_mul(acb_realref(r), t, v, prec);
40 arb_mul(acb_imagref(r), t, u, prec);
41
42 arb_clear(t);
43 arb_clear(u);
44 arb_clear(v);
45 }
46 #undef a
47 #undef b
48 }
49
50