#include <aversive.h>
Go to the source code of this file.
Data Structures | |
struct | fixed_32 |
Defines | |
#define | f32_decimal u.s.decimal |
#define | f32_integer u.s.integer |
#define | F32_ZERO |
#define | F32_NAN |
#define | F32_IS_GT(x, y) (f32_to_s32(x) > f32_to_s32(y)) |
#define | F32_IS_LT(x, y) (f32_to_s32(x) < f32_to_s32(y)) |
#define | F32_IS_GE(x, y) (f32_to_s32(x) >= f32_to_s32(y)) |
#define | F32_IS_LE(x, y) (f32_to_s32(x) <= f32_to_s32(y)) |
#define | F32_IS_EQ(x, y) (f32_to_s32(x) == f32_to_s32(y)) |
#define | F32_IS_NE(x, y) (f32_to_s32(x) != f32_to_s32(y)) |
#define | F32_IS_NEG(x) ((x).f32_integer < 0) |
#define | F32_IS_ZERO(x) ((x).f32_integer == 0 && (x).f32_decimal == 0) |
Typedefs | |
typedef struct fixed_32 | f32 |
Functions | |
f32 | f32_from_double (double f) |
double | f32_to_double (f32 fix) |
f32 | f32_from_integer (int16_t i, uint16_t d) |
f32 | f32_from_msb (int16_t i) |
f32 | f32_from_lsb (int16_t i) |
f32 | f32_neg (f32 f) |
f32 | f32_add (f32 a, f32 b) |
f32 | f32_sub (f32 a, f32 b) |
f32 | f32_inv (f32 f) |
f32 | f32_mul (f32 a, f32 b) |
f32 | f32_mul_msb (f32 a, f32 b) |
f32 | f32_div (f32 a, f32 b) |
f32 | f32_sqrt (f32 f) |
void | f32_print (f32 fix) |
#define F32_IS_EQ | ( | x, | |||
y | ) | (f32_to_s32(x) == f32_to_s32(y)) |
#define F32_IS_NEG | ( | x | ) | ((x).f32_integer < 0) |
#define F32_IS_ZERO | ( | x | ) | ((x).f32_integer == 0 && (x).f32_decimal == 0) |
#define F32_NAN |
Value:
Definition at line 62 of file f32.h.
Referenced by f32_div(), f32_inv(), f32_print(), and f32_sqrt().
#define F32_ZERO |
f32 f32_from_double | ( | double | f | ) |
convert a double to a f32
Definition at line 31 of file f32_double.c.
References parse_symbols::f, and POW2_16F.
f32 f32_from_integer | ( | int16_t | i, | |
uint16_t | d | |||
) |
convert 2 integer (int16_t and uint16_t) to a f32
Definition at line 28 of file f32_int.c.
References parse_symbols::f.
f32 f32_from_lsb | ( | int16_t | i | ) |
convert lsb integer (int16_t) to a f32 ( -0.5 < ret < 0.5 )
Definition at line 51 of file f32_int.c.
References parse_symbols::f.
f32 f32_from_msb | ( | int16_t | i | ) |
convert msb integer (int16_t) to a f32
Definition at line 39 of file f32_int.c.
References parse_symbols::f.
return opposite of the number (=1/f)
Definition at line 28 of file f32_inv.c.
References F32_IS_ZERO, and F32_NAN.
Referenced by f32_div().
mul a with b (=a*b)
Definition at line 27 of file f32_mul.c.
Referenced by f32_div(), and f32_sqrt().
void f32_print | ( | f32 | fix | ) |
function that display a f32 to the standard output
Definition at line 27 of file f32_print.c.
References F32_IS_EQ, F32_NAN, and f32_to_double().
sqrt of f
Definition at line 46 of file f32_sqrt.c.
References a, F32_IS_NEG, F32_IS_ZERO, f32_mul(), F32_NAN, and F32_ZERO.
double f32_to_double | ( | f32 | fix | ) |
convert a f32 to a double
Definition at line 40 of file f32_double.c.
References POW2_16F.
Referenced by f32_print().