Fixed-Point Integer macros. More...

Macros

#define FPI_ONE (( gos_fpi_word_t )(1ULL*FPI_PERCISION))
Constant for 1.0.
#define FPI_ONE_HALF ( FPI_ONE >> 1)
Constant for 0.5.
#define FPI_TWO ( FPI_ONE + FPI_ONE )
Constant for 2.0.
#define FPI_PI fpi_rconst (3.1415926535)
Constant for PI.
#define FPI_E fpi_rconst (2.7182818280)
Constant for e.
#define fpi_rconst (R)   ((( gos_fpi_word_t )((float)R * (float) FPI_ONE )))
Create constant for number.
#define fpi_toint (F)   (( gos_fpi_word_t )(F) / FPI_PERCISION)
Convert FPI type to integer type.
#define fpi_fromint (I)   (( gos_fpi_word_t )(I) * FPI_PERCISION)
Convert integer type to FPI type.
#define fpi_add (A, B)   ((A) + (B))
Add two fpi types.
#define fpi_sub (A, B)   ((A) - (B))
Subtract two fpi types.
#define fpi_fracpart (A)   (( gos_fpi_word_t )(A) % FPI_PERCISION)
Get the fractional part of an fpi.
#define fpi_abs (A)   ((A) < 0 ? -(A) : (A))
Get the absolute value of an fpi.
#define fpi_mul (x, y, res) gos_fpi_multiply (&(x), &(y), &res)
Multiple two fpi types.
#define fpi_div (x, y, res) gos_fpi_divide (&(x), &(y), &res)
Divide two fpi types.
#define fpi_to_str (buffer, x) gos_fpi_to_str_with_padding (buffer, x, FPI_DEFAULT_MAX_DECIMALS, 1)
Convert fpi to string.
#define fpi_int_to_str (buffer, integer, divisor, max_decimals)
Divide integer and return fpi string representation.
#define fpi_int_to_str2 (buffer, integer)
Return integer as fpi string representation.

Detailed Description

Fixed-Point Integer macros.