Files
sics/nintf.c
cvs 3712dca74e - Added new napi files
- Port to Linux
2001-11-14 07:14:04 +00:00

27 lines
586 B
C

/*----------------------------------------------------------------------
Some systems, such as linux, miss nintf in the math library. This
is an implementation.
Mark Koennecke, February 2000
---------------------------------------------------------------------------*/
#include <math.h>
float nintf(float f)
{
double ip, rm, dVal;
float 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 (float) ip;
}