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

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

Issue 11411188: Fix floating point issues on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Moved round() back to c99_support_win. Cleaned up the code, added comments. Created 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
Mads Ager (google) 2012/11/28 09:26:26 Just move your new implementation to c99_support_w
aam-me 2012/11/28 12:14:36 Done.
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.
4
5 #include <math.h>
6
7 #include "platform/c99_support_win.h"
8
9 double round(double x) {
10 if (!_finite(x)) {
11 return x;
12 }
13
14 double intpart;
15 double fractpart = modf(x, &intpart);
16
17 if (fractpart >= 0.5) {
18 return intpart + 1;
19 } else if (fractpart > -0.5) {
20 return intpart;
21 } else {
22 return intpart - 1;
23 }
24 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698