Fixed Point Arithmetic
0
Fixed-point math library.
|
Functions | |
frac | f_add (frac a, frac b) |
Add two single precision fractional numbers - may overflow. More... | |
frac | f_sub (frac a, frac b) |
Substract two single precision fractional numbers - may overflow. More... | |
dfrac | df_add (dfrac a, dfrac b) |
Add two double precision fractional numbers - may overflow. More... | |
dfrac | df_sub (dfrac a, dfrac b) |
Substract two double precision fractional numbers - may overflow. More... | |
efrac | ef_add (efrac a, efrac b) |
Add two extended precision fractional numbers - may overflow. More... | |
efrac | ef_sub (efrac a, efrac b) |
Substract two extended precision fractional numbers - may overflow. More... | |
efrac | ef_f_add (efrac a, frac b) |
Add a single precision fractional to an extended precision fractional. More... | |
frac | f_neg (frac a) |
Negate single precision fractional. More... | |
dfrac | df_neg (dfrac a) |
Negate double precision fractional. More... | |
efrac | ef_neg (efrac a) |
Negate extended precision fractional. More... | |
frac | f_mul (frac a, frac b) |
Multiply single precision, yield single precision. More... | |
dfrac | f_mul_df (frac a, frac b) |
Multiply single precision, yield double precision. More... | |
efrac | f_mf_mul_ef (frac a, mfrac b) |
Multiply single precision by mixed fractional, yield extended precision,. More... | |
frac | f_imul (frac a, int16_t b) |
Multiply single precision by integer, yield single precision. More... | |
int | f_imul_i (frac a, int b) |
Multiply single precision by integer, yield integer. More... | |
efrac | f_imul_ef (frac a, int16_t b) |
Multiply single precision by integer, yield extended precision. More... | |
dfrac | df_imul (dfrac a, int16_t b) |
Multiply double precision by integer, yield double precision. More... | |
efrac | ef_imul (efrac a, int16_t b) |
Multiply extended precision by integer, yield extended precision. More... | |
frac | f_idiv (frac a, int16_t b) |
Divide single precision by integer, yield single precision. More... | |
dfrac | df_idiv (dfrac a, int16_t b) |
Divide double precision by integer, yield double precision. More... | |
efrac | ef_idiv (efrac a, int16_t b) |
Divide extended precision by integer, yield extended precision. More... | |
dfrac | df_shiftl (dfrac a, int16_t b) |
Arithmetic shift left a double precision fractional. More... | |
dfrac | df_shiftr (dfrac a, int16_t b) |
Arithmetic shift right a double precision fractional. More... | |
frac | df_to_f (dfrac x) |
Truncate to single precision. More... | |
dfrac | f_to_df (frac x) |
Extend a single precision number to double precision. More... | |
efrac | f_to_ef (frac x) |
Extend a single precision fractional to an extended-fractional. More... | |
efrac | f_ef_div (frac dividend, efrac divisor) |
Divide a frac by an efrac and return an efrac. More... | |
frac | ef_to_f (efrac x) |
Saturate an extended fractional to yield a fractional. More... | |
frac | f_clip (frac x, frac limit) |
Clip a number to lie between -limit and limit. More... | |
dfrac | df_addsat (dfrac x1, dfrac x2) |
Add with saturation. More... | |
dfrac | f_macs_df (frac x, frac y, dfrac z) |
Multiply-accumulate with saturation. More... | |
Add two double precision fractional numbers - may overflow.
Definition at line 165 of file fixed_point.h.
Add with saturation.
Definition at line 492 of file fixed_point.h.
Divide double precision by integer, yield double precision.
2.30 / 16.0 => 2.30.
a | Operands, fractional. |
b | Operand, integer. |
Definition at line 346 of file fixed_point.h.
Multiply double precision by integer, yield double precision.
2.30 x 16.0 => 2.30.
a | Operands, fractional. |
b | Operand, integer. |
Definition at line 301 of file fixed_point.h.
Negate double precision fractional.
Definition at line 191 of file fixed_point.h.
Arithmetic shift left a double precision fractional.
a | Operands, fractional. |
b | Operand, integer. |
Definition at line 375 of file fixed_point.h.
Arithmetic shift right a double precision fractional.
a | Operands, fractional. |
b | Operand, integer. |
Definition at line 389 of file fixed_point.h.
Substract two double precision fractional numbers - may overflow.
Definition at line 168 of file fixed_point.h.
Truncate to single precision.
Removes (truncates) excess fractional bits from a double precision number and saturates the result to fit in tha range of fracs.
x | Double precision fractional |
Definition at line 406 of file fixed_point.h.
Add two extended precision fractional numbers - may overflow.
Definition at line 171 of file fixed_point.h.
Add a single precision fractional to an extended precision fractional.
Definition at line 177 of file fixed_point.h.
Divide extended precision by integer, yield extended precision.
17.15 / 16.0 => 17.15.
a | Operands, fractional. |
b | Operand, integer. |
Definition at line 361 of file fixed_point.h.
Multiply extended precision by integer, yield extended precision.
17.15 x 16.0 => 17.15.
a | Operands, fractional. |
b | Operand, integer. |
Definition at line 316 of file fixed_point.h.
Negate extended precision fractional.
Definition at line 198 of file fixed_point.h.
Substract two extended precision fractional numbers - may overflow.
Definition at line 174 of file fixed_point.h.
Saturate an extended fractional to yield a fractional.
Note that the precision of efracs and fracs is the same.
Definition at line 460 of file fixed_point.h.
Add two single precision fractional numbers - may overflow.
Definition at line 159 of file fixed_point.h.
Clip a number to lie between -limit and limit.
x | number to be clipped |
limit | limit for clipping. Must be positive and strictly less than one. |
Definition at line 478 of file fixed_point.h.
Divide a frac by an efrac and return an efrac.
Definition at line 444 of file fixed_point.h.
Divide single precision by integer, yield single precision.
1.15 / 16.0 => 1.15.
a | Operands, fractional. |
b | Operand, integer. |
Definition at line 331 of file fixed_point.h.
Multiply single precision by integer, yield single precision.
1.15 x 16.0 => 1.15.
a | Operands, fractional. |
b | Operand, integer. |
Definition at line 257 of file fixed_point.h.
Multiply single precision by integer, yield extended precision.
1.15 x 16.0 => 17.15.
a | Operands, fractional. |
b | Operand, integer. |
Definition at line 286 of file fixed_point.h.
int f_imul_i | ( | frac | a, |
int | b | ||
) |
Multiply single precision by integer, yield integer.
1.15 x 16.0 => 16.0.
a | Operands, fractional. |
b | Operand, integer. |
Definition at line 272 of file fixed_point.h.
Multiply-accumulate with saturation.
Use a dfrac as accumulator.
Performs z + x*y.
x | Factor |
y | Factor |
z | Sumand / Accumulator |
Definition at line 518 of file fixed_point.h.
Multiply single precision by mixed fractional, yield extended precision,.
1.15 x 8.8 => 17.15
a,b | Operands |
Definition at line 242 of file fixed_point.h.
Multiply single precision, yield single precision.
1.15 x 1.15 => 1.15.
a,b | Operands |
Definition at line 214 of file fixed_point.h.
Multiply single precision, yield double precision.
1.15 x 1.15 => 2.30
a,b | Operands |
Definition at line 228 of file fixed_point.h.
Negate single precision fractional.
Definition at line 184 of file fixed_point.h.
Substract two single precision fractional numbers - may overflow.
Definition at line 162 of file fixed_point.h.
Extend a single precision number to double precision.
x | Single precision fractional |
Definition at line 426 of file fixed_point.h.
Extend a single precision fractional to an extended-fractional.
Definition at line 435 of file fixed_point.h.