1 /*
2     Copyright (C) 2013 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_sin_pi(acb_t r,const acb_t z,slong prec)15 acb_sin_pi(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_sin_pi(acb_realref(r), a, prec);
22         arb_zero(acb_imagref(r));
23     }
24     else if (arb_is_zero(a))
25     {
26         arb_t t;
27         arb_init(t);
28         arb_const_pi(t, prec);
29         arb_mul(t, t, b, prec);
30         arb_sinh(acb_imagref(r), t, prec);
31         arb_zero(acb_realref(r));
32         arb_clear(t);
33     }
34     else
35     {
36         arb_t sa, ca, sb, cb;
37 
38         arb_init(sa);
39         arb_init(ca);
40         arb_init(sb);
41         arb_init(cb);
42 
43         arb_sin_cos_pi(sa, ca, a, prec);
44         arb_const_pi(cb, prec);
45         arb_mul(cb, cb, b, prec);
46         arb_sinh_cosh(sb, cb, cb, prec);
47 
48         arb_mul(acb_realref(r), sa, cb, prec);
49         arb_mul(acb_imagref(r), sb, ca, prec);
50 
51         arb_clear(sa);
52         arb_clear(ca);
53         arb_clear(sb);
54         arb_clear(cb);
55     }
56 #undef a
57 #undef b
58 }
59 
60