Rev 1612 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1612 | Rev 1775 | ||
---|---|---|---|
Line 9... | Line 9... | ||
9 | /* |
9 | /* |
10 | * Fix-point decimal scaling: Number of units for 1 (so if sin(something) |
10 | * Fix-point decimal scaling: Number of units for 1 (so if sin(something) |
11 | * returns UNIT_FACTOR * 0.8, the result is to be understood as 0.8) |
11 | * returns UNIT_FACTOR * 0.8, the result is to be understood as 0.8) |
12 | * a * sin(b) = (a * int_sin(b * DRG_FACTOR)) / UNIT_FACTOR |
12 | * a * sin(b) = (a * int_sin(b * DRG_FACTOR)) / UNIT_FACTOR |
13 | */ |
13 | */ |
14 | #define MATH_UNIT_FACTOR 8192 |
14 | //#define MATH_UNIT_FACTOR 8192 |
- | 15 | // Changed: We want to be able to multiply 2 sines/cosines and still stay comfortably (factor 100) within 31 bits. |
|
- | 16 | // 4096 = 12 bits, square = 24 bits, 7 bits to spare. |
|
- | 17 | #define MATH_UNIT_FACTOR 4096 |
|
Line 15... | Line 18... | ||
15 | 18 | ||
16 | int16_t int_sin(int32_t arg); |
19 | int16_t int_sin(int32_t arg); |
17 | int16_t int_cos(int32_t arg); |
20 | int16_t int_cos(int32_t arg); |