Use `floor()` to implement `round()` on WIN32 platform.
This change was suggested by Akira Kakuto.
#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
