mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Implemented round(double) function within mruby-time gem, for it is missing on
VisualStudio compilers where _MSC_ver < 1800
This commit is contained in:
@@ -11,6 +11,16 @@
|
||||
#include <mruby/class.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)
|
||||
# define llround(x) round(x)
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user