xref: /csrg-svn/sys/tahoe/math/FP.h (revision 45761)
1*45761Sbostic /*-
2*45761Sbostic  * Copyright (c) 1985 The Regents of the University of California.
3*45761Sbostic  * All rights reserved.
4*45761Sbostic  *
5*45761Sbostic  * This code is derived from software contributed to Berkeley by
6*45761Sbostic  * Computer Consoles Inc.
7*45761Sbostic  *
8*45761Sbostic  * %sccs.include.redist.c%
9*45761Sbostic  *
10*45761Sbostic  *	@(#)FP.h	7.1 (Berkeley) 12/06/90
11*45761Sbostic  */
12*45761Sbostic 
1329976Smckusick /*
1429976Smckusick  * General definitions of the floating point stuff on Power 6/32.
1529976Smckusick  * The floating point format definition is:
1629976Smckusick  *
1729976Smckusick  *		S    (exp-128)
1829976Smckusick  *	    (-1)  * 2	       * F
1929976Smckusick  *
2029976Smckusick  *	Where exp is the exponent field and F is the binary
2129976Smckusick  *	mantissa following it, including the hidden bit.
2229976Smckusick  *	The hidden bit actually is 1/2, so F is known to
2329976Smckusick  *	satisfy the range:
2429976Smckusick  *		1/2 <= F < 1
2529976Smckusick  */
2629976Smckusick 
2729976Smckusick typedef struct {
2829976Smckusick 	unsigned	sign:1;
2929976Smckusick 	unsigned	exponent:8;
3029976Smckusick 	unsigned	mantissa:23;
3129976Smckusick } sp_format;
3229976Smckusick 
3329976Smckusick typedef struct {
3429976Smckusick 	unsigned	sign:1;
3529976Smckusick 	unsigned	exponent:8;
3629976Smckusick 	unsigned	mantissa:23;
3729976Smckusick 	unsigned	mantissa_lst;
3829976Smckusick } dp_format;
3929976Smckusick 
4029976Smckusick #define	EXP_BIAS	128		/* Exponent bias */
4129976Smckusick #define SIGN_BIT	0x80000000	/* S bit mask */
42