Subversion Repositories Kolibri OS

Rev

Rev 1005 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1005 barsuk 1
#include 
2
#include "kosSyst.h"
3
extern "C" int _fltused = 0;
1764 clevermous 4
double __cdecl acos(double x)
1005 barsuk 5
{
6
	__asm {
7
		fld	qword ptr [esp+4]
8
		fld1
9
		fadd	st, st(1)
10
		fld1
11
		fsub	st, st(2)
12
		fmulp	st(1), st
13
		fsqrt
14
		fxch	st(1)
15
		fpatan
16
	}
17
}
1764 clevermous 18
double __cdecl asin(double x)
1005 barsuk 19
{
20
	__asm {
21
		fld	qword ptr [esp+4]
22
		fld1
23
		fadd	st, st(1)
24
		fld1
25
		fsub	st, st(2)
26
		fmulp	st(1), st
27
		fsqrt
28
		fpatan
29
		ret
30
	}
31
}
32
#if _MSC_VER <= 1200
33
extern "C" double _ftol(double x)
34
{
35
	__asm {
36
		fld	qword ptr [esp+4]
37
		push	1F3Fh
38
		fstcw	word ptr [esp+2]
39
		fldcw	word ptr [esp]
40
		frndint
41
		fldcw	word ptr [esp+2]
42
		add	esp, 4
43
	}
44
}
45
#endif
1764 clevermous 46
double __cdecl ceil(double x)
1005 barsuk 47
{
48
	__asm {
49
		fld	qword ptr [esp+4]
50
		push	1B3Fh
51
		fstcw	word ptr [esp+2]
52
		fldcw	word ptr [esp]
53
		frndint
54
		fldcw	word ptr [esp+2]
55
		add	esp, 4
56
	}
57
}
58
 
1764 clevermous 59
double __cdecl floor(double x)
1005 barsuk 60
{
61
	__asm {
62
		fld	qword ptr [esp+4]
63
		push	173Fh
64
		fstcw	word ptr [esp+2]
65
		fldcw	word ptr [esp]
66
		frndint
67
		fldcw	word ptr [esp+2]
68
		add	esp, 4
69
	}
70
}
71
 
1764 clevermous 72
double __cdecl round(double x)
1005 barsuk 73
{
74
	__asm {
75
		fld	qword ptr [esp+4]
76
		push	133Fh
77
		fstcw	word ptr [esp+2]
78
		fldcw	word ptr [esp]
79
		frndint
80
		fldcw	word ptr [esp+2]
81
		add	esp, 4
82
	}
83
}