Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: src/third_party/fdlibm/fdlibm.cc

Issue 1425333002: Use inline constants instead of typed array for math constants. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/third_party/fdlibm/fdlibm.h ('k') | src/third_party/fdlibm/fdlibm.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // The following is adapted from fdlibm (http://www.netlib.org/fdlibm). 1 // The following is adapted from fdlibm (http://www.netlib.org/fdlibm).
2 // 2 //
3 // ==================================================== 3 // ====================================================
4 // Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 4 // Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 // 5 //
6 // Developed at SunSoft, a Sun Microsystems, Inc. business. 6 // Developed at SunSoft, a Sun Microsystems, Inc. business.
7 // Permission to use, copy, modify, and distribute this 7 // Permission to use, copy, modify, and distribute this
8 // software is freely granted, provided that this notice 8 // software is freely granted, provided that this notice
9 // is preserved. 9 // is preserved.
10 // ==================================================== 10 // ====================================================
(...skipping 11 matching lines...) Expand all
22 #include "src/base/macros.h" 22 #include "src/base/macros.h"
23 #include "src/double.h" 23 #include "src/double.h"
24 24
25 namespace v8 { 25 namespace v8 {
26 namespace fdlibm { 26 namespace fdlibm {
27 27
28 #ifdef _MSC_VER 28 #ifdef _MSC_VER
29 inline double scalbn(double x, int y) { return _scalb(x, y); } 29 inline double scalbn(double x, int y) { return _scalb(x, y); }
30 #endif // _MSC_VER 30 #endif // _MSC_VER
31 31
32 const double MathConstants::constants[] = {
33 6.36619772367581382433e-01, // invpio2 0
34 1.57079632673412561417e+00, // pio2_1 1
35 6.07710050650619224932e-11, // pio2_1t 2
36 6.07710050630396597660e-11, // pio2_2 3
37 2.02226624879595063154e-21, // pio2_2t 4
38 2.02226624871116645580e-21, // pio2_3 5
39 8.47842766036889956997e-32, // pio2_3t 6
40 -1.66666666666666324348e-01, // S1 7 coefficients for sin
41 8.33333333332248946124e-03, // 8
42 -1.98412698298579493134e-04, // 9
43 2.75573137070700676789e-06, // 10
44 -2.50507602534068634195e-08, // 11
45 1.58969099521155010221e-10, // S6 12
46 4.16666666666666019037e-02, // C1 13 coefficients for cos
47 -1.38888888888741095749e-03, // 14
48 2.48015872894767294178e-05, // 15
49 -2.75573143513906633035e-07, // 16
50 2.08757232129817482790e-09, // 17
51 -1.13596475577881948265e-11, // C6 18
52 3.33333333333334091986e-01, // T0 19 coefficients for tan
53 1.33333333333201242699e-01, // 20
54 5.39682539762260521377e-02, // 21
55 2.18694882948595424599e-02, // 22
56 8.86323982359930005737e-03, // 23
57 3.59207910759131235356e-03, // 24
58 1.45620945432529025516e-03, // 25
59 5.88041240820264096874e-04, // 26
60 2.46463134818469906812e-04, // 27
61 7.81794442939557092300e-05, // 28
62 7.14072491382608190305e-05, // 29
63 -1.85586374855275456654e-05, // 30
64 2.59073051863633712884e-05, // T12 31
65 7.85398163397448278999e-01, // pio4 32
66 3.06161699786838301793e-17, // pio4lo 33
67 6.93147180369123816490e-01, // ln2_hi 34
68 1.90821492927058770002e-10, // ln2_lo 35
69 6.666666666666666666e-01, // 2/3 36
70 6.666666666666735130e-01, // LP1 37 coefficients for log1p
71 3.999999999940941908e-01, // 38
72 2.857142874366239149e-01, // 39
73 2.222219843214978396e-01, // 40
74 1.818357216161805012e-01, // 41
75 1.531383769920937332e-01, // 42
76 1.479819860511658591e-01, // LP7 43
77 7.09782712893383973096e+02, // 44 overflow threshold for expm1
78 1.44269504088896338700e+00, // 1/ln2 45
79 -3.33333333333331316428e-02, // Q1 46 coefficients for expm1
80 1.58730158725481460165e-03, // 47
81 -7.93650757867487942473e-05, // 48
82 4.00821782732936239552e-06, // 49
83 -2.01099218183624371326e-07, // Q5 50
84 710.4758600739439, // 51 overflow threshold sinh, cosh
85 4.34294481903251816668e-01, // ivln10 52 coefficients for log10
86 3.01029995663611771306e-01, // log10_2hi 53
87 3.69423907715893078616e-13, // log10_2lo 54
88 5.99999999999994648725e-01, // L1 55 coefficients for log2
89 4.28571428578550184252e-01, // 56
90 3.33333329818377432918e-01, // 57
91 2.72728123808534006489e-01, // 58
92 2.30660745775561754067e-01, // 59
93 2.06975017800338417784e-01, // L6 60
94 9.61796693925975554329e-01, // cp 61 2/(3*ln(2))
95 9.61796700954437255859e-01, // cp_h 62
96 -7.02846165095275826516e-09, // cp_l 63
97 5.84962487220764160156e-01, // dp_h 64
98 1.35003920212974897128e-08 // dp_l 65
99 };
100
101 32
102 // Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi 33 // Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
103 static const int two_over_pi[] = { 34 static const int two_over_pi[] = {
104 0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, 0x95993C, 35 0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, 0x95993C,
105 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, 0x424DD2, 0xE00649, 36 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, 0x424DD2, 0xE00649,
106 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, 0xA73EE8, 0x8235F5, 0x2EBB44, 37 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, 0xA73EE8, 0x8235F5, 0x2EBB44,
107 0x84E99C, 0x7026B4, 0x5F7E41, 0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 38 0x84E99C, 0x7026B4, 0x5F7E41, 0x3991D6, 0x398353, 0x39F49C, 0x845F8B,
108 0xBDF928, 0x3B1FF8, 0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 39 0xBDF928, 0x3B1FF8, 0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D,
109 0x367ECF, 0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, 40 0x367ECF, 0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5,
110 0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, 0x560330, 41 0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, 0x560330,
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 int n = __kernel_rem_pio2(tx, y, e0, nx); 219 int n = __kernel_rem_pio2(tx, y, e0, nx);
289 if (hx < 0) { 220 if (hx < 0) {
290 y[0] = -y[0]; 221 y[0] = -y[0];
291 y[1] = -y[1]; 222 y[1] = -y[1];
292 return -n; 223 return -n;
293 } 224 }
294 return n; 225 return n;
295 } 226 }
296 } // namespace internal 227 } // namespace internal
297 } // namespace v8 228 } // namespace v8
OLDNEW
« no previous file with comments | « src/third_party/fdlibm/fdlibm.h ('k') | src/third_party/fdlibm/fdlibm.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698