[doc] update clone urls to afify.dev/azan
[azan.git] / math.s
blob27ba4ec5fe7d4451737d39cf0d34f17e71594068
1 ; See LICENSE file for copyright and license details.
3 %ifndef MATH_S
4 %define MATH_S
6 %macro COS 1
7 movsd [tmp0], %1
8 fld qword [tmp0]
9 fcos
10 fstp qword [tmp0]
11 movsd %1, [tmp0]
12 %endmacro
14 %macro SIN 1
15 movsd [tmp0], %1
16 fld qword [tmp0]
17 fsin
18 fstp qword [tmp0]
19 movsd %1, [tmp0]
20 %endmacro
22 %macro ACOS 1 ;acos(x) = atan(sqrt((1-x*x)/(x*x)))
23 movsd [tmp0], %1
24 fld qword [tmp0]
25 fld st0
26 fmul st0, st1
27 fld1
28 fsubrp st1, st0
29 fsqrt
30 fxch
31 fpatan
32 fstp qword [tmp0]
33 movsd %1, [tmp0]
34 %endmacro
36 %macro ASIN 1 ;asin(x) = atan(sqrt(x*x/(1-x*x)))
37 movsd [tmp0], %1
38 fld qword [tmp0]
39 fld st0
40 fmul st0, st1
41 fld1
42 fsubrp st1, st0
43 fsqrt
44 fpatan
45 fstp qword [tmp0]
46 movsd %1, [tmp0]
47 %endmacro
49 %macro ATAN2 2
50 movsd [tmp0], %1
51 movsd [tmp1], %2
52 fld qword [tmp0] ;x
53 fld qword [tmp1] ;y
54 fpatan
55 fstp qword [tmp0]
56 movsd %1, [tmp0]
57 %endmacro
59 %endif ;MATH_S