xref: /openbsd-src/lib/libm/src/s_copysignl.c (revision 2f2c00629eff6a304ebffb255fc56f4fa7a1833b)
1*2f2c0062Sguenther /*	$OpenBSD: s_copysignl.c,v 1.2 2016/09/12 19:47:02 guenther Exp $	*/
2390c8400Smartynas /*
3390c8400Smartynas  * Copyright (c) 2008 Martynas Venckus <martynas@openbsd.org>
4390c8400Smartynas  *
5390c8400Smartynas  * Permission to use, copy, modify, and distribute this software for any
6390c8400Smartynas  * purpose with or without fee is hereby granted, provided that the above
7390c8400Smartynas  * copyright notice and this permission notice appear in all copies.
8390c8400Smartynas  *
9390c8400Smartynas  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10390c8400Smartynas  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11390c8400Smartynas  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12390c8400Smartynas  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13390c8400Smartynas  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14390c8400Smartynas  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15390c8400Smartynas  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16390c8400Smartynas  */
17390c8400Smartynas 
18390c8400Smartynas #include <sys/types.h>
19390c8400Smartynas #include <machine/ieee.h>
20390c8400Smartynas #include <math.h>
21390c8400Smartynas 
22390c8400Smartynas long double
copysignl(long double x,long double y)23390c8400Smartynas copysignl(long double x, long double y)
24390c8400Smartynas {
25390c8400Smartynas 	struct ieee_ext *px = (struct ieee_ext *)&x;
26390c8400Smartynas 	struct ieee_ext *py = (struct ieee_ext *)&y;
27390c8400Smartynas 
28390c8400Smartynas 	px->ext_sign = py->ext_sign;
29390c8400Smartynas 
30390c8400Smartynas 	return x;
31390c8400Smartynas }
32*2f2c0062Sguenther DEF_STD(copysignl);
33