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

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

Issue 864803002: Remove deprecated v8::base::OS::nan_value(). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix invalid test expectation. Created 5 years, 11 months 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/runtime/runtime-numbers.cc ('k') | src/types.cc » ('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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 y[1] = (ih == 0) ? fw : -fw; 257 y[1] = (ih == 0) ? fw : -fw;
258 return n & 7; 258 return n & 7;
259 } 259 }
260 260
261 261
262 int rempio2(double x, double* y) { 262 int rempio2(double x, double* y) {
263 int32_t hx = static_cast<int32_t>(internal::double_to_uint64(x) >> 32); 263 int32_t hx = static_cast<int32_t>(internal::double_to_uint64(x) >> 32);
264 int32_t ix = hx & 0x7fffffff; 264 int32_t ix = hx & 0x7fffffff;
265 265
266 if (ix >= 0x7ff00000) { 266 if (ix >= 0x7ff00000) {
267 *y = base::OS::nan_value(); 267 *y = std::numeric_limits<double>::quiet_NaN();
268 return 0; 268 return 0;
269 } 269 }
270 270
271 int32_t e0 = (ix >> 20) - 1046; 271 int32_t e0 = (ix >> 20) - 1046;
272 uint64_t zi = internal::double_to_uint64(x) & 0xFFFFFFFFu; 272 uint64_t zi = internal::double_to_uint64(x) & 0xFFFFFFFFu;
273 zi |= static_cast<uint64_t>(ix - (e0 << 20)) << 32; 273 zi |= static_cast<uint64_t>(ix - (e0 << 20)) << 32;
274 double z = internal::uint64_to_double(zi); 274 double z = internal::uint64_to_double(zi);
275 275
276 double tx[3]; 276 double tx[3];
277 for (int i = 0; i < 2; i++) { 277 for (int i = 0; i < 2; i++) {
278 tx[i] = static_cast<double>(static_cast<int32_t>(z)); 278 tx[i] = static_cast<double>(static_cast<int32_t>(z));
279 z = (z - tx[i]) * two24; 279 z = (z - tx[i]) * two24;
280 } 280 }
281 tx[2] = z; 281 tx[2] = z;
282 282
283 int nx = 3; 283 int nx = 3;
284 while (tx[nx - 1] == zero) nx--; 284 while (tx[nx - 1] == zero) nx--;
285 int n = __kernel_rem_pio2(tx, y, e0, nx); 285 int n = __kernel_rem_pio2(tx, y, e0, nx);
286 if (hx < 0) { 286 if (hx < 0) {
287 y[0] = -y[0]; 287 y[0] = -y[0];
288 y[1] = -y[1]; 288 y[1] = -y[1];
289 return -n; 289 return -n;
290 } 290 }
291 return n; 291 return n;
292 } 292 }
293 } 293 }
294 } // namespace v8::internal 294 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime-numbers.cc ('k') | src/types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698