OLD | NEW |
---|---|
(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 } | |
OLD | NEW |