mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-24 15:46:49 +03:00
fb06cf5f79
git-svn-id: svn://kolibrios.org@5276 a494cfbc-eb01-0410-851d-a64ba20cac60
87 lines
1.2 KiB
C++
87 lines
1.2 KiB
C++
#include <math.h>
|
|
#include "kosSyst.h"
|
|
extern "C" int _fltused = 0;
|
|
|
|
#define M_PI 3.14159265358979323846
|
|
|
|
double __cdecl acos(double x)
|
|
{
|
|
__asm {
|
|
fld qword ptr [esp+4]
|
|
fld1
|
|
fadd st, st(1)
|
|
fld1
|
|
fsub st, st(2)
|
|
fmulp st(1), st
|
|
fsqrt
|
|
fxch st(1)
|
|
fpatan
|
|
}
|
|
}
|
|
double __cdecl asin(double x)
|
|
{
|
|
__asm {
|
|
fld qword ptr [esp+4]
|
|
fld1
|
|
fadd st, st(1)
|
|
fld1
|
|
fsub st, st(2)
|
|
fmulp st(1), st
|
|
fsqrt
|
|
fpatan
|
|
ret
|
|
}
|
|
}
|
|
#if _MSC_VER <= 1200
|
|
extern "C" double _ftol(double x)
|
|
{
|
|
__asm {
|
|
fld qword ptr [esp+4]
|
|
push 1F3Fh
|
|
fstcw word ptr [esp+2]
|
|
fldcw word ptr [esp]
|
|
frndint
|
|
fldcw word ptr [esp+2]
|
|
add esp, 4
|
|
}
|
|
}
|
|
#endif
|
|
/*
|
|
double __cdecl ceil(double x)
|
|
{
|
|
__asm {
|
|
fld qword ptr [esp+4]
|
|
push 1B3Fh
|
|
fstcw word ptr [esp+2]
|
|
fldcw word ptr [esp]
|
|
frndint
|
|
fldcw word ptr [esp+2]
|
|
add esp, 4
|
|
}
|
|
}
|
|
*/
|
|
double __cdecl floor(double x)
|
|
{
|
|
__asm {
|
|
fld qword ptr [esp+4]
|
|
push 173Fh
|
|
fstcw word ptr [esp+2]
|
|
fldcw word ptr [esp]
|
|
frndint
|
|
fldcw word ptr [esp+2]
|
|
add esp, 4
|
|
}
|
|
}
|
|
|
|
double __cdecl round(double x)
|
|
{
|
|
__asm {
|
|
fld qword ptr [esp+4]
|
|
push 133Fh
|
|
fstcw word ptr [esp+2]
|
|
fldcw word ptr [esp]
|
|
frndint
|
|
fldcw word ptr [esp+2]
|
|
add esp, 4
|
|
}
|
|
} |