From b5ba30d9cdeab128fdc0518459817d0a811c56e2 Mon Sep 17 00:00:00 2001 From: MarkRivers Date: Tue, 2 Oct 2012 21:09:13 +0000 Subject: [PATCH] Add definition of rint for _WIN32 --- motorApp/SmarActMCSSrc/smarActMCSMotorDriver.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/motorApp/SmarActMCSSrc/smarActMCSMotorDriver.cpp b/motorApp/SmarActMCSSrc/smarActMCSMotorDriver.cpp index f4978274..d2e29975 100644 --- a/motorApp/SmarActMCSSrc/smarActMCSMotorDriver.cpp +++ b/motorApp/SmarActMCSSrc/smarActMCSMotorDriver.cpp @@ -34,6 +34,22 @@ #define HOLD_NEVER 0 #define FAR_AWAY 1000000000 /*nm*/ +// Windows does not have rint() +#ifdef _WIN32 +double rint(double x) +{ + //middle value point test + if (ceil(x+0.5) == floor(x+0.5)) + { + int a = (int)ceil(x); + if (a%2 == 0) return ceil(x); + else return floor(x); + } + else return floor(x+0.5); +} +#endif + + /* The asyn motor driver apparently can't cope with exceptions */ #undef ASYN_CANDO_EXCEPTIONS /* Define this if exceptions should be thrown and it is OK to abort the application */