1 /*============================================================================
2 This source file is an extension to the SoftFloat IEC/IEEE Floating-point
3 Arithmetic Package, Release 2b, written for Bochs (x86 achitecture simulator)
4 floating point emulation.
6 THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has
7 been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES
8 RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
9 AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES,
10 COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE
11 EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE
12 INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR
13 OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE.
15 Derivative works are acceptable, even for commercial purposes, so long as
16 (1) the source code for the derivative work includes prominent notice that
17 the work is derivative, and (2) the source code includes prominent notice with
18 these four paragraphs for those parts of this code that are retained.
19 =============================================================================*/
21 #ifndef _FPU_CONSTANTS_H_
22 #define _FPU_CONSTANTS_H_
26 // Pentium CPU uses only 68-bit precision M_PI approximation
27 // #define BETTER_THAN_PENTIUM
29 /*============================================================================
30 * Written for Bochs (x86 achitecture simulator) by
31 * Stanislav Shwartsman [sshwarts at sourceforge net]
32 * ==========================================================================*/
34 //////////////////////////////
35 // PI, PI/2, PI/4 constants
36 //////////////////////////////
38 #define FLOATX80_PI_EXP (0x4000)
40 // 128-bit PI fraction
41 #ifdef BETTER_THAN_PENTIUM
42 #define FLOAT_PI_HI (BX_CONST64(0xc90fdaa22168c234))
43 #define FLOAT_PI_LO (BX_CONST64(0xc4c6628b80dc1cd1))
45 #define FLOAT_PI_HI (BX_CONST64(0xc90fdaa22168c234))
46 #define FLOAT_PI_LO (BX_CONST64(0xC000000000000000))
49 #define FLOATX80_PI2_EXP (0x3FFF)
50 #define FLOATX80_PI4_EXP (0x3FFE)
52 //////////////////////////////
54 //////////////////////////////
56 #define FLOATX80_3PI4_EXP (0x4000)
58 // 128-bit 3PI/4 fraction
59 #ifdef BETTER_THAN_PENTIUM
60 #define FLOAT_3PI4_HI (BX_CONST64(0x96cbe3f9990e91a7))
61 #define FLOAT_3PI4_LO (BX_CONST64(0x9394c9e8a0a5159c))
63 #define FLOAT_3PI4_HI (BX_CONST64(0x96cbe3f9990e91a7))
64 #define FLOAT_3PI4_LO (BX_CONST64(0x9000000000000000))
67 //////////////////////////////
69 //////////////////////////////
71 #define FLOAT_LN2INV_EXP (0x3FFF)
73 // 128-bit 1/LN2 fraction
74 #ifdef BETTER_THAN_PENTIUM
75 #define FLOAT_LN2INV_HI (BX_CONST64(0xb8aa3b295c17f0bb))
76 #define FLOAT_LN2INV_LO (BX_CONST64(0xbe87fed0691d3e89))
78 #define FLOAT_LN2INV_HI (BX_CONST64(0xb8aa3b295c17f0bb))
79 #define FLOAT_LN2INV_LO (BX_CONST64(0xC000000000000000))