ieee.h revision 1.5
11.5Skleink/*	$NetBSD: ieee.h,v 1.5 2003/10/26 20:55:31 kleink Exp $	*/
21.2Sderaadt
31.1Sderaadt/*
41.1Sderaadt * Copyright (c) 1992, 1993
51.1Sderaadt *	The Regents of the University of California.  All rights reserved.
61.1Sderaadt *
71.1Sderaadt * This software was developed by the Computer Systems Engineering group
81.1Sderaadt * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
91.1Sderaadt * contributed to Berkeley.
101.1Sderaadt *
111.1Sderaadt * All advertising materials mentioning features or use of this software
121.1Sderaadt * must display the following acknowledgement:
131.1Sderaadt *	This product includes software developed by the University of
141.1Sderaadt *	California, Lawrence Berkeley Laboratory.
151.1Sderaadt *
161.1Sderaadt * Redistribution and use in source and binary forms, with or without
171.1Sderaadt * modification, are permitted provided that the following conditions
181.1Sderaadt * are met:
191.1Sderaadt * 1. Redistributions of source code must retain the above copyright
201.1Sderaadt *    notice, this list of conditions and the following disclaimer.
211.1Sderaadt * 2. Redistributions in binary form must reproduce the above copyright
221.1Sderaadt *    notice, this list of conditions and the following disclaimer in the
231.1Sderaadt *    documentation and/or other materials provided with the distribution.
241.3Sagc * 3. Neither the name of the University nor the names of its contributors
251.1Sderaadt *    may be used to endorse or promote products derived from this software
261.1Sderaadt *    without specific prior written permission.
271.1Sderaadt *
281.1Sderaadt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
291.1Sderaadt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
301.1Sderaadt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
311.1Sderaadt * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
321.1Sderaadt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
331.1Sderaadt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
341.1Sderaadt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
351.1Sderaadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
361.1Sderaadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
371.1Sderaadt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
381.1Sderaadt * SUCH DAMAGE.
391.1Sderaadt *
401.1Sderaadt *	@(#)ieee.h	8.1 (Berkeley) 6/11/93
411.1Sderaadt */
421.1Sderaadt
431.1Sderaadt/*
441.1Sderaadt * ieee.h defines the machine-dependent layout of the machine's IEEE
451.1Sderaadt * floating point.  It does *not* define (yet?) any of the rounding
461.1Sderaadt * mode bits, exceptions, and so forth.
471.1Sderaadt */
481.1Sderaadt
491.5Skleink#include <sys/ieee754.h>
501.5Skleink
511.1Sderaadt/*
521.5Skleink * The SPARC architecture defines the following IEEE 754 compliant
531.5Skleink * 128-bit extended-precision format, which is supported only by the
541.5Skleink * v9 toolchain.
551.1Sderaadt */
561.1Sderaadt
571.5Skleink#ifdef __arch64__
581.1Sderaadt#define	EXT_EXPBITS	15
591.1Sderaadt#define	EXT_FRACBITS	112
601.1Sderaadt
611.1Sderaadtstruct ieee_ext {
621.1Sderaadt	u_int	ext_sign:1;
631.1Sderaadt	u_int	ext_exp:15;
641.1Sderaadt	u_int	ext_frach:16;
651.1Sderaadt	u_int	ext_frachm;
661.1Sderaadt	u_int	ext_fraclm;
671.1Sderaadt	u_int	ext_fracl;
681.1Sderaadt};
691.1Sderaadt
701.1Sderaadt/*
711.1Sderaadt * Floats whose exponent is in [1..INFNAN) (of whatever type) are
721.1Sderaadt * `normal'.  Floats whose exponent is INFNAN are either Inf or NaN.
731.1Sderaadt * Floats whose exponent is zero are either zero (iff all fraction
741.1Sderaadt * bits are zero) or subnormal values.
751.1Sderaadt *
761.1Sderaadt * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
771.1Sderaadt * high fraction; if the bit is set, it is a `quiet NaN'.
781.1Sderaadt */
791.1Sderaadt#define	EXT_EXP_INFNAN	32767
801.1Sderaadt
811.1Sderaadt#if 0
821.1Sderaadt#define	EXT_QUIETNAN	(1 << 15)
831.1Sderaadt#endif
841.1Sderaadt
851.1Sderaadt/*
861.1Sderaadt * Exponent biases.
871.1Sderaadt */
881.1Sderaadt#define	EXT_EXP_BIAS	16383
891.5Skleink#endif /* __arch64__ */
90