1129040Sstefanf/*- 2129040Sstefanf * Copyright (c) 2004 Stefan Farfeleder 3129040Sstefanf * All rights reserved. 4129040Sstefanf * 5129040Sstefanf * Redistribution and use in source and binary forms, with or without 6129040Sstefanf * modification, are permitted provided that the following conditions 7129040Sstefanf * are met: 8129040Sstefanf * 1. Redistributions of source code must retain the above copyright 9129040Sstefanf * notice, this list of conditions and the following disclaimer. 10129040Sstefanf * 2. Redistributions in binary form must reproduce the above copyright 11129040Sstefanf * notice, this list of conditions and the following disclaimer in the 12129040Sstefanf * documentation and/or other materials provided with the distribution. 13129040Sstefanf * 14129040Sstefanf * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15129040Sstefanf * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16129040Sstefanf * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17129040Sstefanf * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 18129040Sstefanf * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19129040Sstefanf * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20129040Sstefanf * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21129040Sstefanf * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22129040Sstefanf * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23129040Sstefanf * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24129040Sstefanf * SUCH DAMAGE. 25129040Sstefanf * 26129040Sstefanf * $FreeBSD: releng/10.2/lib/msun/src/s_copysignl.c 129040 2004-05-07 18:56:31Z stefanf $ 27129040Sstefanf */ 28129040Sstefanf 29129040Sstefanf#include <math.h> 30129040Sstefanf 31129040Sstefanf#include "fpmath.h" 32129040Sstefanf 33129040Sstefanflong double 34129040Sstefanfcopysignl(long double x, long double y) 35129040Sstefanf{ 36129040Sstefanf union IEEEl2bits ux, uy; 37129040Sstefanf 38129040Sstefanf ux.e = x; 39129040Sstefanf uy.e = y; 40129040Sstefanf ux.bits.sign = uy.bits.sign; 41129040Sstefanf return (ux.e); 42129040Sstefanf} 43