summaryrefslogtreecommitdiff
path: root/libs/pbd/msvc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/pbd/msvc')
-rw-r--r--libs/pbd/msvc/msvc_pbd.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/libs/pbd/msvc/msvc_pbd.cc b/libs/pbd/msvc/msvc_pbd.cc
index 5b9c9d449a..ddef968569 100644
--- a/libs/pbd/msvc/msvc_pbd.cc
+++ b/libs/pbd/msvc/msvc_pbd.cc
@@ -241,6 +241,27 @@ round(double x)
return (floor(x));
}
+//***************************************************************
+//
+// trunc()
+//
+// Emulates trunc() using floor() and ceil().
+//
+// Returns:
+//
+// On Success: The largest integer whose magnitude is less
+// than or equal to 'x' (regardless of sign).
+// On Failure: None
+//
+LIBPBD_API double PBD_APICALLTYPE
+trunc(double x)
+{
+ if (x < 0)
+ return (ceil(x));
+
+ return (floor(x));
+}
+
namespace PBD {
//***************************************************************