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