]> git.sesse.net Git - pistorm/blob - softfloat/fpu_constant.h
FPU update as latest MAME
[pistorm] / softfloat / fpu_constant.h
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.
5
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.
14
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 =============================================================================*/
20
21 #ifndef _FPU_CONSTANTS_H_
22 #define _FPU_CONSTANTS_H_
23
24 // Pentium CPU uses only 68-bit precision M_PI approximation
25 #define BETTER_THAN_PENTIUM
26
27 /*============================================================================
28  * Written for Bochs (x86 achitecture simulator) by
29  *            Stanislav Shwartsman [sshwarts at sourceforge net]
30  * ==========================================================================*/
31
32 //////////////////////////////
33 // PI, PI/2, PI/4 constants
34 //////////////////////////////
35
36 #define FLOATX80_PI_EXP  (0x4000)
37
38 // 128-bit PI fraction
39 #ifdef BETTER_THAN_PENTIUM
40 #define FLOAT_PI_HI (0xc90fdaa22168c234U)
41 #define FLOAT_PI_LO (0xc4c6628b80dc1cd1U)
42 #else
43 #define FLOAT_PI_HI (0xc90fdaa22168c234U)
44 #define FLOAT_PI_LO (0xC000000000000000U)
45 #endif
46
47 #define FLOATX80_PI2_EXP  (0x3FFF)
48 #define FLOATX80_PI4_EXP  (0x3FFE)
49
50 //////////////////////////////
51 // 3PI/4 constant
52 //////////////////////////////
53
54 #define FLOATX80_3PI4_EXP (0x4000)
55
56 // 128-bit 3PI/4 fraction
57 #ifdef BETTER_THAN_PENTIUM
58 #define FLOAT_3PI4_HI (0x96cbe3f9990e91a7U)
59 #define FLOAT_3PI4_LO (0x9394c9e8a0a5159cU)
60 #else
61 #define FLOAT_3PI4_HI (0x96cbe3f9990e91a7U)
62 #define FLOAT_3PI4_LO (0x9000000000000000U)
63 #endif
64
65 //////////////////////////////
66 // 1/LN2 constant
67 //////////////////////////////
68
69 #define FLOAT_LN2INV_EXP  (0x3FFF)
70
71 // 128-bit 1/LN2 fraction
72 #ifdef BETTER_THAN_PENTIUM
73 #define FLOAT_LN2INV_HI (0xb8aa3b295c17f0bbU)
74 #define FLOAT_LN2INV_LO (0xbe87fed0691d3e89U)
75 #else
76 #define FLOAT_LN2INV_HI (0xb8aa3b295c17f0bbU)
77 #define FLOAT_LN2INV_LO (0xC000000000000000U)
78 #endif
79
80 #endif