You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
437 B
30 lines
437 B
#include "mymath.h"
|
|
|
|
#ifdef NEEDCEILF
|
|
|
|
float ceilf( float x )
|
|
{
|
|
if( x < 0 ) {
|
|
float nx = -x;
|
|
int ix = (int) nx;
|
|
return (float) -ix;
|
|
} else {
|
|
int ix = (int) x;
|
|
if( x == (float) ix ) return x;
|
|
return (float) (ix+1);
|
|
}
|
|
}
|
|
|
|
float floorf( float x )
|
|
{
|
|
if( x < 0 ) {
|
|
float nx = -x;
|
|
int ix = (int) nx;
|
|
if( nx == (float) ix ) return x;
|
|
return (float) -(ix+1);
|
|
} else {
|
|
int ix = (int) x;
|
|
return (float) ix;
|
|
}
|
|
}
|
|
#endif
|