From 0df37933293eb7619d04654f51df0848b634bfff Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Wed, 11 Apr 2012 10:50:17 -0500 Subject: [PATCH] handle negative constants --- include/convert_to_biu.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/convert_to_biu.h b/include/convert_to_biu.h index 8fc2281fa9..2867c9abbe 100644 --- a/include/convert_to_biu.h +++ b/include/convert_to_biu.h @@ -18,7 +18,8 @@ inline int Mils2iu( int mils ) { #if defined( USE_PCBNEW_NANOMETRES ) - return int( mils * 25.4e3 + 0.5 ); + double x = mils * 25.4e3; + return int( x < 0 ? x - 0.5 : x + 0.5 ); #else return mils * 10; #endif @@ -28,11 +29,11 @@ inline int Mils2iu( int mils ) inline int DMils2iu( int dmils ) { #if defined( USE_PCBNEW_NANOMETRES ) - return int( dmils * 25.4e2 + 0.5 ); + double x = dmils * 25.4e2; + return int( x < 0 ? x - 0.5 : x + 0.5 ); #else return dmils; #endif } #endif // #define CONVERT_TO_BIU_H -