Commit 0df37933 authored by Dick Hollenbeck's avatar Dick Hollenbeck

handle negative constants

parent a2037257
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
inline int Mils2iu( int mils ) inline int Mils2iu( int mils )
{ {
#if defined( USE_PCBNEW_NANOMETRES ) #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 #else
return mils * 10; return mils * 10;
#endif #endif
...@@ -28,11 +29,11 @@ inline int Mils2iu( int mils ) ...@@ -28,11 +29,11 @@ inline int Mils2iu( int mils )
inline int DMils2iu( int dmils ) inline int DMils2iu( int dmils )
{ {
#if defined( USE_PCBNEW_NANOMETRES ) #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 #else
return dmils; return dmils;
#endif #endif
} }
#endif // #define CONVERT_TO_BIU_H #endif // #define CONVERT_TO_BIU_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment