#include <aversive.h>
Go to the source code of this file.
Data Structures | |
struct | fixed_16 |
Defines | |
#define | f16_decimal u.s.decimal |
#define | f16_integer u.s.integer |
#define | F16_ZERO |
#define | F16_NAN |
#define | F16_IS_GT(x, y) (f16_to_s16(x) > f16_to_s16(y)) |
#define | F16_IS_LT(x, y) (f16_to_s16(x) < f16_to_s16(y)) |
#define | F16_IS_GE(x, y) (f16_to_s16(x) >= f16_to_s16(y)) |
#define | F16_IS_LE(x, y) (f16_to_s16(x) <= f16_to_s16(y)) |
#define | F16_IS_EQ(x, y) (f16_to_s16(x) == f16_to_s16(y)) |
#define | F16_IS_NE(x, y) (f16_to_s16(x) != f16_to_s16(y)) |
#define | F16_IS_NEG(x) ((x).f16_integer < 0) |
#define | F16_IS_ZERO(x) ((x).f16_integer == 0 && (x).f16_decimal == 0) |
Typedefs | |
typedef struct fixed_16 | f16 |
Functions | |
f16 | f16_from_double (double f) |
double | f16_to_double (f16 fix) |
f16 | f16_from_integer (int8_t i, uint8_t d) |
f16 | f16_from_msb (int8_t i) |
f16 | f16_from_lsb (int8_t i) |
f16 | f16_neg (f16 f) |
f16 | f16_add (f16 a, f16 b) |
f16 | f16_sub (f16 a, f16 b) |
f16 | f16_inv (f16 f) |
f16 | f16_mul (f16 a, f16 b) |
f16 | f16_mul_msb (f16 a, f16 b) |
f16 | f16_div (f16 a, f16 b) |
f16 | f16_sqrt (f16 f) |
void | f16_print (f16 fix) |
#define F16_IS_EQ | ( | x, | |||
y | ) | (f16_to_s16(x) == f16_to_s16(y)) |
#define F16_IS_NEG | ( | x | ) | ((x).f16_integer < 0) |
#define F16_IS_ZERO | ( | x | ) | ((x).f16_integer == 0 && (x).f16_decimal == 0) |
#define F16_NAN |
Value:
Definition at line 62 of file f16.h.
Referenced by f16_div(), f16_inv(), f16_print(), and f16_sqrt().
#define F16_ZERO |
f16 f16_from_double | ( | double | f | ) |
convert a double to a f16
Definition at line 31 of file f16_double.c.
References parse_symbols::f, and POW2_8F.
f16 f16_from_integer | ( | int8_t | i, | |
uint8_t | d | |||
) |
convert 2 integer (int8_t and uint8_t) to a f16
Definition at line 28 of file f16_int.c.
References parse_symbols::f.
f16 f16_from_lsb | ( | int8_t | i | ) |
convert lsb integer (int8_t) to a f16 ( -0.5 < ret < 0.5 )
Definition at line 51 of file f16_int.c.
References parse_symbols::f.
f16 f16_from_msb | ( | int8_t | i | ) |
convert msb integer (int8_t) to a f16
Definition at line 39 of file f16_int.c.
References parse_symbols::f.
return opposite of the number (=1/f)
Definition at line 28 of file f16_inv.c.
References F16_IS_ZERO, and F16_NAN.
Referenced by f16_div().
mul a with b (=a*b)
Definition at line 27 of file f16_mul.c.
Referenced by f16_div(), and f16_sqrt().
void f16_print | ( | f16 | fix | ) |
function that display a f16 to the standard output
Definition at line 26 of file f16_print.c.
References F16_IS_EQ, F16_NAN, and f16_to_double().
sqrt of f
Definition at line 47 of file f16_sqrt.c.
References a, F16_IS_NEG, f16_mul(), and F16_NAN.
double f16_to_double | ( | f16 | fix | ) |
convert a f16 to a double
Definition at line 40 of file f16_double.c.
References POW2_8F.
Referenced by f16_print().