1dce5f3abSSteve Kargl /*-
2dce5f3abSSteve Kargl * Copyright (c) 2017 Steven G. Kargl
3dce5f3abSSteve Kargl * All rights reserved.
4dce5f3abSSteve Kargl *
5dce5f3abSSteve Kargl * Redistribution and use in source and binary forms, with or without
6dce5f3abSSteve Kargl * modification, are permitted provided that the following conditions
7dce5f3abSSteve Kargl * are met:
8dce5f3abSSteve Kargl * 1. Redistributions of source code must retain the above copyright
9dce5f3abSSteve Kargl * notice unmodified, this list of conditions, and the following
10dce5f3abSSteve Kargl * disclaimer.
11dce5f3abSSteve Kargl * 2. Redistributions in binary form must reproduce the above copyright
12dce5f3abSSteve Kargl * notice, this list of conditions and the following disclaimer in the
13dce5f3abSSteve Kargl * documentation and/or other materials provided with the distribution.
14dce5f3abSSteve Kargl *
15dce5f3abSSteve Kargl * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16dce5f3abSSteve Kargl * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17dce5f3abSSteve Kargl * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18dce5f3abSSteve Kargl * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19dce5f3abSSteve Kargl * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20dce5f3abSSteve Kargl * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21dce5f3abSSteve Kargl * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22dce5f3abSSteve Kargl * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23dce5f3abSSteve Kargl * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24dce5f3abSSteve Kargl * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25dce5f3abSSteve Kargl */
26dce5f3abSSteve Kargl
27dce5f3abSSteve Kargl /*
28dce5f3abSSteve Kargl * See ../src/k_sinpi.c for implementation details.
29dce5f3abSSteve Kargl */
30dce5f3abSSteve Kargl
31dce5f3abSSteve Kargl static inline long double
__kernel_sinpil(long double x)32dce5f3abSSteve Kargl __kernel_sinpil(long double x)
33dce5f3abSSteve Kargl {
34dce5f3abSSteve Kargl long double hi, lo;
35dce5f3abSSteve Kargl
36dce5f3abSSteve Kargl hi = (double)x;
37dce5f3abSSteve Kargl lo = x - hi;
38dce5f3abSSteve Kargl lo = lo * (pi_lo + pi_hi) + hi * pi_lo;
39dce5f3abSSteve Kargl hi *= pi_hi;
40dce5f3abSSteve Kargl _2sumF(hi, lo);
41dce5f3abSSteve Kargl return (__kernel_sinl(hi, lo, 1));
42dce5f3abSSteve Kargl }
43