Defines | |
| #define | XY_mult(a, b) |
| Multiply two XY_fixed values. | |
| #define | XY_qdiv(a, b) |
| Divide one XY_fixed value by another. | |
| #define | XY_div(a, b) |
| Divide one XY_fixed value by another. | |
| #define | XY_FIXED_DIV_ZERO ((1 << XY_FIXED_SHIFT_HALF) - 1) |
| The maximum value that, when XY_div() is used to divide two digits, the denominator may be, and be considered zero (due to shifting to reduce precision loss. | |
| #define | XY_fpart(a) ((a) & (XY_FIXED_ONE - 1)) |
| Return the fractional part of 'a'. | |
| #define | XY_rfpart(a) (XY_FIXED_ONE - XY_fpart(a)) |
| Return one minus the fractional part of 'a'. | |
| #define | XY_ipart(a) ((a) - XY_fpart(a)) |
| Returns the integer (whole) part of 'a'. | |
| #define | XY_round(a) (XY_ipart((a) + (1 << (XY_FIXED_SHIFT - 1)))) |
| Rounds 'a' up to the nearest integer (whole). | |
| #define | XY_sin(degrees) (XY_cos(90 - (degrees))) |
| Returns sine() of 'degrees'. | |
Functions | |
| XY_fixed | XY_cos (int degrees) |
| Returns cosine() of 'degrees'. | |
| #define XY_mult | ( | a, | |||
| b | ) |
Value:
(((a) >> XY_FIXED_SHIFT_HALF) * \ ((b) >> XY_FIXED_SHIFT_HALF))
| a | multiplicand | |
| b | multiplicand |
| #define XY_qdiv | ( | a, | |||
| b | ) |
Value:
(((a) / \
((b) >> XY_FIXED_SHIFT_HALF)) \
<< XY_FIXED_SHIFT_HALF)
| a | numerator | |
| b | denominator |
| #define XY_div | ( | a, | |||
| b | ) |
Value:
(((b) >> XY_FIXED_SHIFT_HALF) == 0 ? \ XY_FIXED_NAN : XY_qdiv((a),(b)))
Returns Not-A-Number if denominator is (sufficient close to) zero.
| a | numerator | |
| b | denominator |
| #define XY_FIXED_DIV_ZERO ((1 << XY_FIXED_SHIFT_HALF) - 1) |
The maximum value that, when XY_div() is used to divide two digits, the denominator may be, and be considered zero (due to shifting to reduce precision loss.
)
| #define XY_fpart | ( | a | ) | ((a) & (XY_FIXED_ONE - 1)) |
Return the fractional part of 'a'.
| #define XY_rfpart | ( | a | ) | (XY_FIXED_ONE - XY_fpart(a)) |
Return one minus the fractional part of 'a'.
| #define XY_ipart | ( | a | ) | ((a) - XY_fpart(a)) |
Returns the integer (whole) part of 'a'.
| #define XY_round | ( | a | ) | (XY_ipart((a) + (1 << (XY_FIXED_SHIFT - 1)))) |
Rounds 'a' up to the nearest integer (whole).
| #define XY_sin | ( | degrees | ) | (XY_cos(90 - (degrees))) |
Returns sine() of 'degrees'.
('degrees' is a non-fixed-point value, in degrees. Values outside 0-359 are accounted for.)
| degrees | is an angle, in degrees (between 0 and 359). |
| XY_fixed XY_cos | ( | int | degrees | ) |
Returns cosine() of 'degrees'.
('degrees' is a non-fixed-point value, in degrees. Values outside 0-359 are accounted for.)
| degrees | is an angle, in degrees (between 0 and 359). |
1.5.5