using floor and ceil from math lib for rounding and truncation

This commit is contained in:
dwarning 2009-11-08 09:25:56 +00:00
parent 15883a251d
commit 306291f426
1 changed files with 9 additions and 8 deletions

View File

@ -10,6 +10,7 @@
#include <ctype.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include "config.h"
#ifdef HAS_WINDOWS
@ -1122,11 +1123,11 @@ ival (char *s, int *err)
return z;
}
#ifndef _MATH_H
#ifndef HAVE_LIBM
long
np_round (double x)
/* using <math.h>, it would be simpler: floor(x+0.5) */
/* using <math.h>, it would be simpler: floor(x+0.5), see below */
{
double u;
long z;
@ -1207,4 +1208,4 @@ intp (double x) /* integral part */
return ceil (x);
}
#endif /* _MATH_H */
#endif