summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-07-13 20:32:34 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-07-13 20:32:34 +0900
commitbad807e7f072553b8e055c1c90baf60f181d718f (patch)
treef971ef6f054a6a562a316324cccaa0fa00081950
parent70e99d6b5725451c1d3fa8554e1195e22f1db44a (diff)
downloadmruby-bad807e7f072553b8e055c1c90baf60f181d718f.tar.gz
mruby-bad807e7f072553b8e055c1c90baf60f181d718f.zip
Use `floor()` to implement `round()` on WIN32 platform.
This change was suggested by Akira Kakuto.
-rw-r--r--mrbgems/mruby-time/src/time.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c
index bd72d3bbd..5e8624830 100644
--- a/mrbgems/mruby-time/src/time.c
+++ b/mrbgems/mruby-time/src/time.c
@@ -20,12 +20,7 @@
#if defined(_MSC_VER) && _MSC_VER < 1800
double round(double x) {
- if (x >= 0.0) {
- return (double)((int)(x + 0.5));
- }
- else {
- return (double)((int)(x - 0.5));
- }
+ return floor(x + 0.5);
}
#endif