Commit 67e3cdfa authored by Paolo Bosetti's avatar Paolo Bosetti

Implemented round(double) function within mruby-time gem, for it is missing on

VisualStudio compilers where _MSC_ver < 1800
parent 9a41db6f
...@@ -11,6 +11,16 @@ ...@@ -11,6 +11,16 @@
#include <mruby/class.h> #include <mruby/class.h>
#include <mruby/data.h> #include <mruby/data.h>
#if _MSC_VER < 1800
double round(double x) {
if (x >= 0.0) {
return (double)((int)(x + 0.5));
} else {
return (double)((int)(x - 0.5));
}
}
#endif
#if !defined(__MINGW64__) && defined(_WIN32) #if !defined(__MINGW64__) && defined(_WIN32)
# define llround(x) round(x) # define llround(x) round(x)
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment