From bad807e7f072553b8e055c1c90baf60f181d718f Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 13 Jul 2017 20:32:34 +0900 Subject: Use `floor()` to implement `round()` on WIN32 platform. This change was suggested by Akira Kakuto. --- mrbgems/mruby-time/src/time.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'mrbgems/mruby-time/src') 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 -- cgit v1.2.3