xref: /netbsd-src/lib/libm/src/s_cospil.c (revision d0129385d65d459bf80799085708a1b3f8bd8b70)
1*d0129385Schristos /* 	$NetBSD: s_cospil.c,v 1.3 2024/02/24 15:16:53 christos Exp $	*/
2cfe182f3Schristos 
3cfe182f3Schristos /*-
4cfe182f3Schristos  * Copyright (c) 2023 The NetBSD Foundation, Inc.
5cfe182f3Schristos  * All rights reserved.
6cfe182f3Schristos  *
7cfe182f3Schristos  * This code is derived from software contributed to The NetBSD Foundation
8cfe182f3Schristos  * by Christos Zoulas.
9cfe182f3Schristos  *
10cfe182f3Schristos  * Redistribution and use in source and binary forms, with or without
11cfe182f3Schristos  * modification, are permitted provided that the following conditions
12cfe182f3Schristos  * are met:
13cfe182f3Schristos  * 1. Redistributions of source code must retain the above copyright
14cfe182f3Schristos  *    notice, this list of conditions and the following disclaimer.
15cfe182f3Schristos  * 2. Redistributions in binary form must reproduce the above copyright
16cfe182f3Schristos  *    notice, this list of conditions and the following disclaimer in the
17cfe182f3Schristos  *    documentation and/or other materials provided with the distribution.
18cfe182f3Schristos  *
19cfe182f3Schristos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20cfe182f3Schristos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21cfe182f3Schristos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22cfe182f3Schristos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23cfe182f3Schristos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24cfe182f3Schristos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25cfe182f3Schristos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26cfe182f3Schristos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27cfe182f3Schristos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28cfe182f3Schristos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29cfe182f3Schristos  * POSSIBILITY OF SUCH DAMAGE.
30cfe182f3Schristos  */
31cfe182f3Schristos #include <sys/cdefs.h>
32cfe182f3Schristos #if defined(LIBM_SCCS) && !defined(lint)
33*d0129385Schristos __RCSID("$NetBSD: s_cospil.c,v 1.3 2024/02/24 15:16:53 christos Exp $");
34cfe182f3Schristos #endif
35cfe182f3Schristos 
36cfe182f3Schristos #include "namespace.h"
37cfe182f3Schristos #include "math.h"
38cfe182f3Schristos #include <machine/float.h>
393f3b0dedSchristos #include <machine/ieee.h>
40cfe182f3Schristos 
41cfe182f3Schristos #ifdef __weak_alias
42cfe182f3Schristos __weak_alias(cospil,_cospil)
43cfe182f3Schristos #endif
44cfe182f3Schristos 
45*d0129385Schristos #ifdef __HAVE_LONG_DOUBLE
46*d0129385Schristos 
47*d0129385Schristos 
48cfe182f3Schristos #if LDBL_MANT_DIG == 64
49cfe182f3Schristos #include "../ld80/s_cospil.c"
50cfe182f3Schristos #elif LDBL_MANT_DIG == 113
51cfe182f3Schristos #include "../ld128/s_cospil.c"
52cfe182f3Schristos #else
53cfe182f3Schristos #error "Unsupported long double format"
54cfe182f3Schristos #endif
55cfe182f3Schristos 
56cfe182f3Schristos #else
57cfe182f3Schristos 
58*d0129385Schristos long double
59*d0129385Schristos cospil(long double x)
60*d0129385Schristos {
61*d0129385Schristos 	return cospi(x);
62*d0129385Schristos }
63cfe182f3Schristos 
64cfe182f3Schristos #endif
65