mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
Use floor() or ceil() based on sign for 'trunc' GIB math function.
This commit is contained in:
parent
0fd0bd5d96
commit
71a4ff6379
1 changed files with 1 additions and 3 deletions
|
@ -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]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue