160484Sobrien/*- 2218822Sdim * Copyright (c) 2017 Steven G. Kargl 3218822Sdim * All rights reserved. 460484Sobrien * 560484Sobrien * Redistribution and use in source and binary forms, with or without 660484Sobrien * modification, are permitted provided that the following conditions 760484Sobrien * are met: 860484Sobrien * 1. Redistributions of source code must retain the above copyright 960484Sobrien * notice unmodified, this list of conditions, and the following 1060484Sobrien * disclaimer. 1160484Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1260484Sobrien * notice, this list of conditions and the following disclaimer in the 1360484Sobrien * documentation and/or other materials provided with the distribution. 1460484Sobrien * 1560484Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1660484Sobrien * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1760484Sobrien * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1860484Sobrien * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1960484Sobrien * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20218822Sdim * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2160484Sobrien * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2260484Sobrien * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2360484Sobrien * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2460484Sobrien * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2560484Sobrien */ 2660484Sobrien 2760484Sobrien/* 2860484Sobrien * See ../src/k_cospi.c for implementation details. 2960484Sobrien */ 3060484Sobrien 3160484Sobrienstatic inline long double 3260484Sobrien__kernel_cospil(long double x) 3360484Sobrien{ 3460484Sobrien long double hi, lo; 3560484Sobrien 3660484Sobrien hi = (float)x; 3760484Sobrien lo = x - hi; 3860484Sobrien lo = lo * (pi_lo + pi_hi) + hi * pi_lo; 3960484Sobrien hi *= pi_hi; 4060484Sobrien _2sumF(hi, lo); 4160484Sobrien return (__kernel_cosl(hi, lo)); 4260484Sobrien} 4360484Sobrien