f80constant.inc 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. { The code is translated from Bochs by Florian Klaempfl and contains
  2. the copyright notice below. The original filename is fpu_constant.h
  3. All changes to the code are copyrighted by the Free Pascal development team and
  4. released under the same license as the orginal code, see below.
  5. }
  6. {============================================================================
  7. This source file is an extension to the SoftFloat IEC/IEEE Floating-point
  8. Arithmetic Package, Release 2b, written for Bochs = x86 achitecture simulator);
  9. floating point emulation.
  10. THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has
  11. been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES
  12. RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
  13. AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES,
  14. COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE
  15. EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE
  16. INSTITUTE = possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR
  17. OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE.
  18. Derivative works are acceptable, even for commercial purposes, so long as
  19. (1) the source code for the derivative work includes prominent notice that
  20. the work is derivative, and = 2) the source code includes prominent notice with
  21. these four paragraphs for those parts of this code that are retained.
  22. =============================================================================}
  23. // Pentium CPU uses only 68-bit precision M_PI approximation
  24. // BETTER_THAN_PENTIUM
  25. {============================================================================
  26. * Written for Bochs = x86 achitecture simulator) by
  27. * Stanislav Shwartsman [sshwarts at sourceforge net]
  28. * ==========================================================================}
  29. { the pascal translation is based on https://github.com/lubomyr/bochs/blob/8e0b9abcd81cd24d4d9c68f7fdef2f53bc180d33/cpu/fpu/fpu_constant.h
  30. if you update it, please make a note here
  31. }
  32. //////////////////////////////
  33. // PI, PI/2, PI/4 constants
  34. //////////////////////////////
  35. const
  36. FLOATX80_PI_EXP = $4000;
  37. // 128-bit PI fraction
  38. {$ifdef BETTER_THAN_PENTIUM}
  39. FLOAT_PI_HI = QWord($c90fdaa22168c234);
  40. FLOAT_PI_LO = QWord($c4c6628b80dc1cd1);
  41. {$else}
  42. FLOAT_PI_HI = QWord($c90fdaa22168c234);
  43. FLOAT_PI_LO = QWord($C000000000000000);
  44. {$endif}
  45. {$ifdef dummy}
  46. FLOATX80_PI2_EXP = $3FFF);
  47. FLOATX80_PI4_EXP = $3FFE);
  48. //////////////////////////////
  49. // 3PI/4 constant
  50. //////////////////////////////
  51. FLOATX80_3PI4_EXP = $4000;
  52. // 128-bit 3PI/4 fraction
  53. {$ifdef BETTER_THAN_PENTIUM}
  54. FLOAT_3PI4_HI = QWord($96cbe3f9990e91a7);
  55. FLOAT_3PI4_LO = QWord($9394c9e8a0a5159c));
  56. {$else}
  57. FLOAT_3PI4_HI = QWord($96cbe3f9990e91a7);
  58. FLOAT_3PI4_LO = QWord($9000000000000000);
  59. {$endif}
  60. //////////////////////////////
  61. // 1/LN2 constant
  62. //////////////////////////////
  63. FLOAT_LN2INV_EXP = $3FFF);
  64. // 128-bit 1/LN2 fraction
  65. {$ifdef BETTER_THAN_PENTIUM}
  66. FLOAT_LN2INV_HI = QWord($b8aa3b295c17f0bb);
  67. FLOAT_LN2INV_LO = QWord($be87fed0691d3e89);
  68. {$else}
  69. FLOAT_LN2INV_HI = QWord($b8aa3b295c17f0bb);
  70. FLOAT_LN2INV_LO = QWord($C000000000000000);
  71. {$endif}
  72. {$endif dummy}