+++ /dev/null
-/* $NetBSD: ieee754.h,v 1.6.24.1 2007/05/07 19:49:10 pavel Exp $ */\r
-\r
-/*\r
- * Copyright (c) 1992, 1993\r
- * The Regents of the University of California. All rights reserved.\r
- *\r
- * This software was developed by the Computer Systems Engineering group\r
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and\r
- * contributed to Berkeley.\r
- *\r
- * All advertising materials mentioning features or use of this software\r
- * must display the following acknowledgement:\r
- * This product includes software developed by the University of\r
- * California, Lawrence Berkeley Laboratory.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * 1. Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright\r
- * notice, this list of conditions and the following disclaimer in the\r
- * documentation and/or other materials provided with the distribution.\r
- * 3. Neither the name of the University nor the names of its contributors\r
- * may be used to endorse or promote products derived from this software\r
- * without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
- * SUCH DAMAGE.\r
- *\r
- * @(#)ieee.h 8.1 (Berkeley) 6/11/93\r
- */\r
-#ifndef _SYS_IEEE754_H_\r
-#define _SYS_IEEE754_H_\r
-\r
-/*\r
- * NOTICE: This is not a standalone file. To use it, #include it in\r
- * your port's ieee.h header.\r
- */\r
-\r
-#include <machine/endian.h>\r
-\r
-/*\r
- * <sys/ieee754.h> defines the layout of IEEE 754 floating point types.\r
- * Only single-precision and double-precision types are defined here;\r
- * extended types, if available, are defined in the machine-dependent\r
- * header.\r
- */\r
-\r
-/*\r
- * Define the number of bits in each fraction and exponent.\r
- *\r
- * k k+1\r
- * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented\r
- *\r
- * (-exp_bias+1)\r
- * as fractions that look like 0.fffff x 2 . This means that\r
- *\r
- * -126\r
- * the number 0.10000 x 2 , for instance, is the same as the normalized\r
- *\r
- * -127 -128\r
- * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero\r
- *\r
- * -129\r
- * in the fraction; to represent 2 , we need two, and so on. This\r
- *\r
- * (-exp_bias-fracbits+1)\r
- * implies that the smallest denormalized number is 2\r
- *\r
- * for whichever format we are talking about: for single precision, for\r
- *\r
- * -126 -149\r
- * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and\r
- *\r
- * -149 == -127 - 23 + 1.\r
- */\r
-#define SNG_EXPBITS 8\r
-#define SNG_FRACBITS 23\r
-\r
-struct ieee_single {\r
-#if _BYTE_ORDER == _BIG_ENDIAN\r
- u_int sng_sign:1;\r
- u_int sng_exp:SNG_EXPBITS;\r
- u_int sng_frac:SNG_FRACBITS;\r
-#else\r
- u_int sng_frac:SNG_FRACBITS;\r
- u_int sng_exp:SNG_EXPBITS;\r
- u_int sng_sign:1;\r
-#endif\r
-};\r
-\r
-#define DBL_EXPBITS 11\r
-#define DBL_FRACHBITS 20\r
-#define DBL_FRACLBITS 32\r
-#define DBL_FRACBITS (DBL_FRACHBITS + DBL_FRACLBITS)\r
-\r
-struct ieee_double {\r
-#if _BYTE_ORDER == _BIG_ENDIAN\r
- u_int dbl_sign:1;\r
- u_int dbl_exp:DBL_EXPBITS;\r
- u_int dbl_frach:DBL_FRACHBITS;\r
- u_int dbl_fracl:DBL_FRACLBITS;\r
-#else\r
- u_int dbl_fracl:DBL_FRACLBITS;\r
- u_int dbl_frach:DBL_FRACHBITS;\r
- u_int dbl_exp:DBL_EXPBITS;\r
- u_int dbl_sign:1;\r
-#endif\r
-};\r
-\r
-/*\r
- * Floats whose exponent is in [1..INFNAN) (of whatever type) are\r
- * `normal'. Floats whose exponent is INFNAN are either Inf or NaN.\r
- * Floats whose exponent is zero are either zero (iff all fraction\r
- * bits are zero) or subnormal values.\r
- *\r
- * At least one `signalling NaN' and one `quiet NaN' value must be\r
- * implemented. It is left to the architecture to specify how to\r
- * distinguish between these.\r
- */\r
-#define SNG_EXP_INFNAN 255\r
-#define DBL_EXP_INFNAN 2047\r
-\r
-/*\r
- * Exponent biases.\r
- */\r
-#define SNG_EXP_BIAS 127\r
-#define DBL_EXP_BIAS 1023\r
-\r
-/*\r
- * Convenience data structures.\r
- */\r
-union ieee_single_u {\r
- float sngu_f;\r
- struct ieee_single sngu_sng;\r
-};\r
-\r
-union ieee_double_u {\r
- double dblu_d;\r
- struct ieee_double dblu_dbl;\r
-};\r
-#endif /* _SYS_IEEE754_H_ */\r