- Reworked the connection object and the IO system
- Reworked the support for TRICS - Added a second generation motor
This commit is contained in:
21
nintf.c
21
nintf.c
@ -3,6 +3,8 @@
|
||||
is an implementation.
|
||||
|
||||
Mark Koennecke, February 2000
|
||||
|
||||
Added double version, Mark Koennecke, August 2008
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#include <math.h>
|
||||
@ -24,3 +26,22 @@
|
||||
}
|
||||
return (float) ip;
|
||||
}
|
||||
/*-------------------------------------------------------------------*/
|
||||
double nintd(double f)
|
||||
{
|
||||
double ip, rm, dVal;
|
||||
double fRes;
|
||||
|
||||
dVal = (double)f;
|
||||
rm = modf(dVal,&ip);
|
||||
if(rm < .0)rm = -rm;
|
||||
if(rm > .5)
|
||||
{
|
||||
if(ip < .0)
|
||||
ip -= 1.;
|
||||
else
|
||||
ip += 1.;
|
||||
|
||||
}
|
||||
return (double) ip;
|
||||
}
|
||||
|
Reference in New Issue
Block a user