using floor and ceil from math lib for rounding and truncation
This commit is contained in:
parent
15883a251d
commit
306291f426
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue