Revision 1464, 0.6 kB
(checked in by smidl, 13 years ago)
|
upravy choleskiho + nove qmath
|
Line | |
---|
1 | #include "math.h" |
---|
2 | #include "fixed.h" |
---|
3 | |
---|
4 | typedef short int int16 ; |
---|
5 | typedef int int32 ; |
---|
6 | |
---|
7 | /* sin (theta), theta=-32768..32768 -> -pi,pi*/ |
---|
8 | int16 qsin(int16 theta){ |
---|
9 | int16 t_sin; |
---|
10 | int32 tmp; |
---|
11 | tmp = prevod(sin(3.141593*(theta)/32768.),15); |
---|
12 | if (tmp>32767) t_sin =32767; else t_sin=tmp; |
---|
13 | return t_sin; |
---|
14 | } |
---|
15 | int16 qcos(int16 theta){ |
---|
16 | int16 t_cos; |
---|
17 | int32 tmp; |
---|
18 | tmp = prevod(cos(3.141593*(theta)/32768.),15); |
---|
19 | if (tmp>32767) t_cos =32767; else t_cos=tmp; |
---|
20 | return t_cos; |
---|
21 | } |
---|
22 | int16 qsqrt(int16 x){ |
---|
23 | int16 tmp; |
---|
24 | tmp = prevod(sqrt((double)x/32768.),15); |
---|
25 | } |
---|
26 | int16 qlog(int16 x){ |
---|
27 | if (x<=0) |
---|
28 | return -32768; |
---|
29 | else |
---|
30 | return prevod(log(x/32768.),15); |
---|
31 | } |
---|