1132382Sdas/*- 2132382Sdas * Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org> 3132382Sdas * All rights reserved. 4132382Sdas * 5132382Sdas * Redistribution and use in source and binary forms, with or without 6132382Sdas * modification, are permitted provided that the following conditions 7132382Sdas * are met: 8132382Sdas * 1. Redistributions of source code must retain the above copyright 9132382Sdas * notice, this list of conditions and the following disclaimer. 10132382Sdas * 2. Redistributions in binary form must reproduce the above copyright 11132382Sdas * notice, this list of conditions and the following disclaimer in the 12132382Sdas * documentation and/or other materials provided with the distribution. 13132382Sdas * 14132382Sdas * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15132382Sdas * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16132382Sdas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17132382Sdas * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18132382Sdas * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19132382Sdas * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20132382Sdas * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21132382Sdas * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22132382Sdas * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23132382Sdas * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24132382Sdas * SUCH DAMAGE. 25132382Sdas * 26132382Sdas * $FreeBSD$ 27132382Sdas */ 28132382Sdas 29132382Sdas#include <math.h> 30132382Sdas 31132382Sdas#include "fpmath.h" 32132382Sdas 33132382Sdasint 34132382Sdas__signbit(double d) 35132382Sdas{ 36132382Sdas union IEEEd2bits u; 37132382Sdas 38132382Sdas u.d = d; 39132382Sdas return (u.bits.sign); 40132382Sdas} 41132382Sdas 42132382Sdasint 43132382Sdas__signbitf(float f) 44132382Sdas{ 45132382Sdas union IEEEf2bits u; 46132382Sdas 47132382Sdas u.f = f; 48132382Sdas return (u.bits.sign); 49132382Sdas} 50132382Sdas 51132382Sdasint 52132382Sdas__signbitl(long double e) 53132382Sdas{ 54132382Sdas union IEEEl2bits u; 55132382Sdas 56132382Sdas u.e = e; 57132382Sdas return (u.bits.sign); 58132382Sdas} 59