fpc/rtl/inc/f80constant.inc
florian a90d7cd444 * as Nikolai proposed, start of translation of
transcendent helpers functions of Bochs for use in the softfloat unit
2022-01-16 20:32:53 +01:00

92 lines
3.2 KiB
PHP

{ The code is translated from Bochs by Florian Klaempfl and contains
the copyright notice below. The original filename is fpu_constant.h
All changes to the code are copyrighted by the Free Pascal development team and
released under the same license as the orginal code, see below.
}
{============================================================================
This source file is an extension to the SoftFloat IEC/IEEE Floating-point
Arithmetic Package, Release 2b, written for Bochs = x86 achitecture simulator);
floating point emulation.
THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has
been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES
RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES,
COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE
EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE
INSTITUTE = possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR
OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE.
Derivative works are acceptable, even for commercial purposes, so long as
(1) the source code for the derivative work includes prominent notice that
the work is derivative, and = 2) the source code includes prominent notice with
these four paragraphs for those parts of this code that are retained.
=============================================================================}
// Pentium CPU uses only 68-bit precision M_PI approximation
// BETTER_THAN_PENTIUM
{============================================================================
* Written for Bochs = x86 achitecture simulator) by
* Stanislav Shwartsman [sshwarts at sourceforge net]
* ==========================================================================}
{ the pascal translation is based on https://github.com/lubomyr/bochs/blob/8e0b9abcd81cd24d4d9c68f7fdef2f53bc180d33/cpu/fpu/fpu_constant.h
if you update it, please make a note here
}
//////////////////////////////
// PI, PI/2, PI/4 constants
//////////////////////////////
const
FLOATX80_PI_EXP = $4000;
// 128-bit PI fraction
{$ifdef BETTER_THAN_PENTIUM}
FLOAT_PI_HI = QWord($c90fdaa22168c234);
FLOAT_PI_LO = QWord($c4c6628b80dc1cd1);
{$else}
FLOAT_PI_HI = QWord($c90fdaa22168c234);
FLOAT_PI_LO = QWord($C000000000000000);
{$endif}
{$ifdef dummy}
FLOATX80_PI2_EXP = $3FFF);
FLOATX80_PI4_EXP = $3FFE);
//////////////////////////////
// 3PI/4 constant
//////////////////////////////
FLOATX80_3PI4_EXP = $4000;
// 128-bit 3PI/4 fraction
{$ifdef BETTER_THAN_PENTIUM}
FLOAT_3PI4_HI = QWord($96cbe3f9990e91a7);
FLOAT_3PI4_LO = QWord($9394c9e8a0a5159c));
{$else}
FLOAT_3PI4_HI = QWord($96cbe3f9990e91a7);
FLOAT_3PI4_LO = QWord($9000000000000000);
{$endif}
//////////////////////////////
// 1/LN2 constant
//////////////////////////////
FLOAT_LN2INV_EXP = $3FFF);
// 128-bit 1/LN2 fraction
{$ifdef BETTER_THAN_PENTIUM}
FLOAT_LN2INV_HI = QWord($b8aa3b295c17f0bb);
FLOAT_LN2INV_LO = QWord($be87fed0691d3e89);
{$else}
FLOAT_LN2INV_HI = QWord($b8aa3b295c17f0bb);
FLOAT_LN2INV_LO = QWord($C000000000000000);
{$endif}
{$endif dummy}