1 /*
2  * Polynomial coefficients and other constants for tgamma128.c.
3  *
4  * Copyright (c) 2006-2023, Arm Limited.
5  * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception
6  */
7 
8 /* The largest positive value for which 128-bit tgamma does not overflow. */
9 static const long double max_x =  0x1.b6e3180cd66a5c4206f128ba77f4p+10L;
10 
11 /* Coefficients of the polynomial used in the tgamma_large() subroutine */
12 static const long double coeffs_large[] = {
13      0x1.8535745aa79569579b9eec0f3bbcp+0L,
14      0x1.0378f83c6fb8f0e51269f2b4a973p-3L,
15      0x1.59f6a05094f69686c3380f4e2783p-8L,
16     -0x1.0b291dee952a82764a4859b081a6p-8L,
17     -0x1.6dd301b2205bf936b5a3eaad0dbbp-12L,
18      0x1.387a8b5f38dd77e7f139b1021e86p-10L,
19      0x1.bca46637f65b13750c728cc29e40p-14L,
20     -0x1.d80401c00aef998c9e303151a51cp-11L,
21     -0x1.49cb6bb09f935a2053ccc2cf3711p-14L,
22      0x1.4e950204437dcaf2be77f73a6f45p-10L,
23      0x1.cb711a2d65f188bf60110934d6bep-14L,
24     -0x1.7d7ff4bc95dc7faefc5e767f70f1p-9L,
25     -0x1.0305ab9760cddb0d833e73766836p-12L,
26      0x1.3ef6c84bf1cd5c3f65ac2693bb5bp-7L,
27      0x1.bb4144740ad9290123fdcea684aap-11L,
28     -0x1.72ab4e88272a229bfafd192450f0p-5L,
29      0x1.80c70ac6eb3b7a698983d25a62b8p-12L,
30      0x1.e222791c6743ce3e3cae220fb236p-3L,
31      0x1.1a2dca1c82a9326c52b465f7cb7ap-2L,
32     -0x1.9d204fa235a42cd901b123d2ad47p+1L,
33      0x1.55b56d1158f77ddb1c95fc44ab02p+0L,
34      0x1.37f900a11dbd892abd7dde533e2dp+5L,
35     -0x1.2da49f4188dd89cb958369ef2401p+7L,
36      0x1.fdae5ec3ec6eb7dffc09edbe6c14p+7L,
37     -0x1.61433cebe649098c9611c4c7774ap+7L,
38 };
39 
40 /* Coefficients of the polynomial used in the tgamma_tiny() subroutine */
41 static const long double coeffs_tiny[] = {
42      0x1.0000000000000000000000000000p+0L,
43      0x1.2788cfc6fb618f49a37c7f0201fep-1L,
44     -0x1.4fcf4026afa2dceb8490ade22796p-1L,
45     -0x1.5815e8fa27047c8f42b5d9217244p-5L,
46      0x1.5512320b43fbe5dfa771333518f7p-3L,
47     -0x1.59af103c340927bffdd44f954bfcp-5L,
48     -0x1.3b4af28483e210479657e5543366p-7L,
49      0x1.d919c527f6070bfce9b29c2ace9cp-8L,
50     -0x1.317112ce35337def3556a18aa178p-10L,
51     -0x1.c364fe77a6f27677b985b1fa2e1dp-13L,
52      0x1.0c8a7a19a3fd40fe1f7e867efe7bp-13L,
53     -0x1.51cf9f090b5dc398ba86305e3634p-16L,
54     -0x1.4e80f64c04a339740de06ca9fa4ap-20L,
55      0x1.241ddc2aef2ec20e58b08f2fda17p-20L,
56 };
57 
58 /* The location within the interval [1,2] where gamma has a minimum.
59  * Specified as the sum of two 128-bit values, for extra precision. */
60 static const long double min_x_hi =  0x1.762d86356be3f6e1a9c8865e0a4fp+0L;
61 static const long double min_x_lo =  0x1.ac54d7d218de21303a7c60f08840p-118L;
62 
63 /* The actual minimum value that gamma takes at that location.
64  * Again specified as the sum of two 128-bit values. */
65 static const long double min_y_hi =  0x1.c56dc82a74aee8d8851566d40f32p-1L;
66 static const long double min_y_lo =  0x1.8ed98685742c353ce55e5794686fp-114L;
67 
68 /* Coefficients of the polynomial used in the tgamma_central() subroutine
69  * for computing gamma on the interval [1,min_x] */
70 static const long double coeffs_central_neg[] = {
71      0x1.b6c53f7377b83839c8a292e43b69p-2L,
72      0x1.0bae9f40c7d09ed76e732045850ap-3L,
73      0x1.4981175e14d04c3530e51d01c5fep-3L,
74      0x1.79f77aaf032c948af3a9edbd2061p-4L,
75      0x1.1e97bd10821095a5b79fbfdfa1a3p-4L,
76      0x1.8071ce0935e4dcf0b33b0fbec7c1p-5L,
77      0x1.0b44c2f92982f887b55ec36dfdb0p-5L,
78      0x1.6df1de1e178ef72ca7bd63d40870p-6L,
79      0x1.f63f502bde27e81c0f5e13479b43p-7L,
80      0x1.57fd67d901f40ea011353ad89a0ap-7L,
81      0x1.d7151376eed187eb753e2273cafcp-8L,
82      0x1.427162b5c6ff1d904c71ef53e37cp-8L,
83      0x1.b954b8c3a56cf93e49ef6538928ap-9L,
84      0x1.2dff2ec26a3ae5cd3aaccae7a09ep-9L,
85      0x1.9d35250d9b9378d9b59df734537ap-10L,
86      0x1.1b2c0c48b9855a28f6dbd6fdff3cp-10L,
87      0x1.7e0db39bb99cdb52b028d9359380p-11L,
88      0x1.2164b5e1d364a0b5eaf97c436aa7p-11L,
89      0x1.27521cf5fd24dcdf43524e6add11p-13L,
90      0x1.06461d62243bf9a826b42349672fp-10L,
91     -0x1.2b852abead28209b4e0c756dc46ep-9L,
92      0x1.be673c11a72c826115ec6d286c14p-8L,
93     -0x1.fd9ce330c215c31fcd3cb53c42ebp-7L,
94      0x1.fa362bd2dc68f41abef2d8600acdp-6L,
95     -0x1.a21585b2f52f8b23855de8e452edp-5L,
96      0x1.1f234431ed032052fc92e64e0493p-4L,
97     -0x1.40d332476ca0199c60cdae3f9132p-4L,
98      0x1.1d45dc665d86012eba2eea199cefp-4L,
99     -0x1.8491016cdd08dc9be7ade9b5fef3p-5L,
100      0x1.7e7e2fbc6d49ad484300d6add324p-6L,
101     -0x1.e63fe3f874a37276a8d7d8b705ecp-8L,
102      0x1.30a2a73944f8c84998314d69c23fp-10L,
103 };
104 
105 /* Coefficients of the polynomial used in the tgamma_central() subroutine
106  * for computing gamma on the interval [min_x,2] */
107 static const long double coeffs_central_pos[] = {
108      0x1.b6c53f7377b83839c8a292e22aa2p-2L,
109     -0x1.0bae9f40c7d09ed76e72e1c955dep-3L,
110      0x1.4981175e14d04c3530ee5e1ecebcp-3L,
111     -0x1.79f77aaf032c948ac983d77f3e07p-4L,
112      0x1.1e97bd10821095ab7dc94936cc11p-4L,
113     -0x1.8071ce0935e4d7edef8cbf2a1cf1p-5L,
114      0x1.0b44c2f929837fafef7b5d9e80f1p-5L,
115     -0x1.6df1de1e175fe2a51faa25cddbb4p-6L,
116      0x1.f63f502be57d11aed2cfe90843ffp-7L,
117     -0x1.57fd67d852f230015b9f64770273p-7L,
118      0x1.d715138adc07e5fce81077070357p-8L,
119     -0x1.4271618e9fda8992a667adb15f4fp-8L,
120      0x1.b954d15d9eb772e80fdd760672d7p-9L,
121     -0x1.2dfe391241d3cb79c8c15182843dp-9L,
122      0x1.9d44396fcd48451c3ba924cee814p-10L,
123     -0x1.1ac195fb99739e341589e39803e6p-10L,
124      0x1.82e46127b68f002770826e25f146p-11L,
125     -0x1.089dacd90d9f41493119ac178359p-11L,
126      0x1.6993c007b20394a057d21f3d37f8p-12L,
127     -0x1.ec43a709f4446560c099dec8e31bp-13L,
128      0x1.4ba36322f4074e9add9450f003cap-13L,
129     -0x1.b3f83a977965ca1b7937bf5b34cap-14L,
130      0x1.10af346abc09cb25a6d9fe810b6ep-14L,
131     -0x1.38d8ea1188f242f50203edc395bdp-15L,
132      0x1.39add987a948ec56f62b721a4475p-16L,
133     -0x1.02a4e141f286c8a967e2df9bc9adp-17L,
134      0x1.433b50af22425f546e87113062d7p-19L,
135     -0x1.0c7b73cb0013f00aafc103e8e382p-21L,
136      0x1.b852de313ec38da2297f6deaa6b4p-25L,
137 };
138 
139 /* 128-bit float value of pi, used by the sin_pi_x_over_pi subroutine
140  */
141 static const long double pi =  0x1.921fb54442d18469898cc51701b8p+1L;
142