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

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

Issue 786823003: Implement Math.log2 via ported extract from fdlibm. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 7.09782712893383973096e+02, // 45 overflow threshold for expm1 75 7.09782712893383973096e+02, // 45 overflow threshold for expm1
76 1.44269504088896338700e+00, // 1/ln2 46 76 1.44269504088896338700e+00, // 1/ln2 46
77 -3.33333333333331316428e-02, // Q1 47 coefficients for expm1 77 -3.33333333333331316428e-02, // Q1 47 coefficients for expm1
78 1.58730158725481460165e-03, // 48 78 1.58730158725481460165e-03, // 48
79 -7.93650757867487942473e-05, // 49 79 -7.93650757867487942473e-05, // 49
80 4.00821782732936239552e-06, // 50 80 4.00821782732936239552e-06, // 50
81 -2.01099218183624371326e-07, // Q5 51 81 -2.01099218183624371326e-07, // Q5 51
82 710.4758600739439, // 52 overflow threshold sinh, cosh 82 710.4758600739439, // 52 overflow threshold sinh, cosh
83 4.34294481903251816668e-01, // ivln10 53 coefficients for log10 83 4.34294481903251816668e-01, // ivln10 53 coefficients for log10
84 3.01029995663611771306e-01, // log10_2hi 54 84 3.01029995663611771306e-01, // log10_2hi 54
85 3.69423907715893078616e-13 // log10_2lo 55 85 3.69423907715893078616e-13, // log10_2lo 55
86 5.99999999999994648725e-01, // L1 56 coefficients for log2
87 4.28571428578550184252e-01, // 57
88 3.33333329818377432918e-01, // 58
89 2.72728123808534006489e-01, // 59
90 2.30660745775561754067e-01, // 60
91 2.06975017800338417784e-01, // L6 61
92 9.61796693925975554329e-01, // cp 62 2/(3*ln(2))
93 9.61796700954437255859e-01, // cp_h 63
94 -7.02846165095275826516e-09, // cp_l 64
95 5.84962487220764160156e-01, // dp_h 65
96 1.35003920212974897128e-08 // dp_l 66
86 }; 97 };
87 98
88 99
89 // Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi 100 // Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
90 static const int two_over_pi[] = { 101 static const int two_over_pi[] = {
91 0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, 0x95993C, 102 0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, 0x95993C,
92 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, 0x424DD2, 0xE00649, 103 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, 0x424DD2, 0xE00649,
93 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, 0xA73EE8, 0x8235F5, 0x2EBB44, 104 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, 0xA73EE8, 0x8235F5, 0x2EBB44,
94 0x84E99C, 0x7026B4, 0x5F7E41, 0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 105 0x84E99C, 0x7026B4, 0x5F7E41, 0x3991D6, 0x398353, 0x39F49C, 0x845F8B,
95 0xBDF928, 0x3B1FF8, 0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 106 0xBDF928, 0x3B1FF8, 0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D,
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 int n = __kernel_rem_pio2(tx, y, e0, nx); 286 int n = __kernel_rem_pio2(tx, y, e0, nx);
276 if (hx < 0) { 287 if (hx < 0) {
277 y[0] = -y[0]; 288 y[0] = -y[0];
278 y[1] = -y[1]; 289 y[1] = -y[1];
279 return -n; 290 return -n;
280 } 291 }
281 return n; 292 return n;
282 } 293 }
283 } 294 }
284 } // namespace v8::internal 295 } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698