Use floor() or ceil() based on sign for 'trunc' GIB math function.

This commit is contained in:
Brian Koropoff 2003-02-23 22:53:36 +00:00
parent 0fd0bd5d96
commit 71a4ff6379

View file

@ -19,8 +19,6 @@
*/ */
#define _ISOC99_SOURCE
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
@ -197,5 +195,5 @@ Func_Rand (double *oplist, unsigned int numops)
double double
Func_Trunc (double *oplist, unsigned int numops) Func_Trunc (double *oplist, unsigned int numops)
{ {
return (double) ((long int) oplist[0]); return oplist[0] < 0.0 ? ceil (oplist[0]) : floor (oplist[0]);
} }