kolibrios/programs/develop/libraries/libs_v2/include/math.c
pavelyakov befac9b242 source code library
git-svn-id: svn://kolibrios.org@5936 a494cfbc-eb01-0410-851d-a64ba20cac60
2015-11-27 09:20:48 +00:00

76 lines
902 B
C

//IO library
#ifndef INCLUDE_MATH_C
#define INCLUDE_MATH_C
static inline signed math_round(float x)
{
x+=0.6;
return x;
}
static inline signed math_ceil(float x)
{
long z = (long)x;
if(z<x) return ++z;
return z;
}
static inline float math_floor(float x)
{
signed long z = x;
if(z==x)return x;
if(z<0) return --z;
return z;
}
static inline float math_abs(float x)
{
if(x<0)return -x;
return x;
}
/*
static inline float math_cos(float x)
{
float r;
asm
{
fld x
fcos
fstp r
}
return r;
}
static inline float math_sin(float x)
{
float r;
asm
{
fld x
fsin
fstp r
}
return r;
}
static inline float math_sqrt(float x)
{
float r;
asm
{
fld x
fsqrt
fstp r
}
return r;
}
static inline float math_tan(float x)
{
float r;
asm
{
fld x
fld1
fpatan
fstp r
}
return r;
}
*/
#endif