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

Side by Side Diff: runtime/platform/floating_point_win.cc

Issue 353403004: Fixes Android build by using C++ math header instead of C one. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include <math.h> // NOLINT
9 #include <limits> // NOLINT 8 #include <limits> // NOLINT
10 9
11 // Taken from third_party/v8/src/platform-win32.cc 10 // Taken from third_party/v8/src/platform-win32.cc
12 double fmod_ieee(double x, double y) { 11 double fmod_ieee(double x, double y) {
13 // x is dividend, y is divisor. 12 // x is dividend, y is divisor.
14 // Work around MS fmod bugs. ISO Standard says: 13 // Work around MS fmod bugs. ISO Standard says:
15 // If dividend is finite and divisor is an infinity or 14 // If dividend is finite and divisor is an infinity or
16 // dividend is a zero and divisor is nonzero finite, 15 // dividend is a zero and divisor is nonzero finite,
17 // then dividend is returned. 16 // then dividend is returned.
18 if (!(_finite(x) && (!_finite(y) && !isnan(y))) && 17 if (!(_finite(x) && (!_finite(y) && !std::isnan(y))) &&
19 !(x == 0 && (y != 0 && _finite(y)))) { 18 !(x == 0 && (y != 0 && _finite(y)))) {
20 x = fmod(x, y); 19 x = fmod(x, y);
21 } 20 }
22 return x; 21 return x;
23 } 22 }
24 23
25 // Bring MSVC atan2 behavior in line with ISO standard. 24 // Bring MSVC atan2 behavior in line with ISO standard.
26 // MSVC atan2 returns NaN when x and y are either +infinity or -infinity. 25 // MSVC atan2 returns NaN when x and y are either +infinity or -infinity.
27 // Per ISO standard: 26 // Per ISO standard:
28 // - If y is +/-infinity and x is -infinity, +/-3*pi/4 is returned. 27 // - If y is +/-infinity and x is -infinity, +/-3*pi/4 is returned.
(...skipping 11 matching lines...) Expand all
40 static double atans_at_infinities[2][2] = 39 static double atans_at_infinities[2][2] =
41 { { atan2(1., 1.), atan2(1., -1.) }, 40 { { atan2(1., 1.), atan2(1., -1.) },
42 { atan2(-1., 1.), atan2(-1., -1.) } }; 41 { atan2(-1., 1.), atan2(-1., -1.) } };
43 return atans_at_infinities[index_x][index_y]; 42 return atans_at_infinities[index_x][index_y];
44 } else { 43 } else {
45 return atan2(x, y); 44 return atan2(x, y);
46 } 45 }
47 } 46 }
48 47
49 #endif // defined(TARGET_OS_WINDOWS) 48 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698