/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 1992, 19934* The Regents of the University of California. All rights reserved.5*6* This software was developed by the Computer Systems Engineering group7* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and8* contributed to Berkeley.9*10* All advertising materials mentioning features or use of this software11* must display the following acknowledgement:12* This product includes software developed by the University of13* California, Lawrence Berkeley Laboratory.14*15* Redistribution and use in source and binary forms, with or without16* modification, are permitted provided that the following conditions17* are met:18* 1. Redistributions of source code must retain the above copyright19* notice, this list of conditions and the following disclaimer.20* 2. Redistributions in binary form must reproduce the above copyright21* notice, this list of conditions and the following disclaimer in the22* documentation and/or other materials provided with the distribution.23* 3. Neither the name of the University nor the names of its contributors24* may be used to endorse or promote products derived from this software25* without specific prior written permission.26*27* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND28* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE29* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE30* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE31* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL32* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS33* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)34* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT35* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY36* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF37* SUCH DAMAGE.38* from: NetBSD: ieee.h,v 1.1.1.1 1998/06/20 04:58:51 eeh Exp39*/4041#ifndef _MACHINE_IEEE_H_42#define _MACHINE_IEEE_H_4344/*45* ieee.h defines the machine-dependent layout of the machine's IEEE46* floating point. It does *not* define (yet?) any of the rounding47* mode bits, exceptions, and so forth.48*/4950/*51* Define the number of bits in each fraction and exponent.52*53* k k+154* Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented55*56* (-exp_bias+1)57* as fractions that look like 0.fffff x 2 . This means that58*59* -12660* the number 0.10000 x 2 , for instance, is the same as the normalized61*62* -127 -12863* float 1.0 x 2 . Thus, to represent 2 , we need one leading zero64*65* -12966* in the fraction; to represent 2 , we need two, and so on. This67*68* (-exp_bias-fracbits+1)69* implies that the smallest denormalized number is 270*71* for whichever format we are talking about: for single precision, for72*73* -126 -14974* instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and75*76* -149 == -127 - 23 + 1.77*/78#define SNG_EXPBITS 879#define SNG_FRACBITS 238081#define DBL_EXPBITS 1182#define DBL_FRACBITS 528384#ifdef notyet85#define E80_EXPBITS 1586#define E80_FRACBITS 6487#endif8889#define EXT_EXPBITS 1590#define EXT_FRACBITS 1129192struct ieee_single {93u_int sng_sign:1;94u_int sng_exp:8;95u_int sng_frac:23;96};9798struct ieee_double {99u_int dbl_sign:1;100u_int dbl_exp:11;101u_int dbl_frach:20;102u_int dbl_fracl;103};104105struct ieee_ext {106u_int ext_sign:1;107u_int ext_exp:15;108u_int ext_frach:16;109u_int ext_frachm;110u_int ext_fraclm;111u_int ext_fracl;112};113114/*115* Floats whose exponent is in [1..INFNAN) (of whatever type) are116* `normal'. Floats whose exponent is INFNAN are either Inf or NaN.117* Floats whose exponent is zero are either zero (iff all fraction118* bits are zero) or subnormal values.119*120* A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its121* high fraction; if the bit is set, it is a `quiet NaN'.122*/123#define SNG_EXP_INFNAN 255124#define DBL_EXP_INFNAN 2047125#define EXT_EXP_INFNAN 32767126127#if 0128#define SNG_QUIETNAN (1 << 22)129#define DBL_QUIETNAN (1 << 19)130#define EXT_QUIETNAN (1 << 15)131#endif132133/*134* Exponent biases.135*/136#define SNG_EXP_BIAS 127137#define DBL_EXP_BIAS 1023138#define EXT_EXP_BIAS 16383139140#endif141142143