aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/common/util.c b/src/common/util.c
index ee0acbbb07..de1ca3684d 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -334,10 +334,12 @@ tor_mathlog(double d)
long
tor_lround(double d)
{
-#ifdef _MSC_VER
- return (long)(d > 0 ? d + 0.5 : ceil(d - 0.5));
-#else
+#if defined(HAVE_LROUND)
return lround(d);
+#elif defined(HAVE_RINT)
+ return (long)rint(d);
+#else
+ return (long)(d > 0 ? d + 0.5 : ceil(d - 0.5));
#endif
}