aversive_10-03-12/modules/base/math/fixed_point/f64.h File Reference

#include <aversive.h>

Go to the source code of this file.

Data Structures

struct  fixed_64

Defines

#define f64_integer   u.s.integer
#define f64_decimal   u.s.decimal
#define F64_ZERO
#define F64_NAN
#define F64_IS_GT(x, y)   (f64_to_s64(x) > f64_to_s64(y))
#define F64_IS_LT(x, y)   (f64_to_s64(x) < f64_to_s64(y))
#define F64_IS_GE(x, y)   (f64_to_s64(x) >= f64_to_s64(y))
#define F64_IS_LE(x, y)   (f64_to_s64(x) <= f64_to_s64(y))
#define F64_IS_EQ(x, y)   (f64_to_s64(x) == f64_to_s64(y))
#define F64_IS_NE(x, y)   (f64_to_s64(x) != f64_to_s64(y))
#define F64_IS_NEG(x)   ((x).f64_integer < 0)
#define F64_IS_ZERO(x)   ((x).f64_integer == 0 && (x).f64_decimal == 0)

Typedefs

typedef struct fixed_64 f64

Functions

f64 f64_from_double (double f)
double f64_to_double (f64 fix)
f64 f64_from_integer (int32_t i, uint32_t d)
f64 f64_from_msb (int32_t i)
f64 f64_from_lsb (int32_t i)
f64 f64_neg (f64 f)
f64 f64_add (f64 a, f64 b)
f64 f64_sub (f64 a, f64 b)
f64 f64_inv (f64 f)
f64 f64_mul (f64 a, f64 b)
int32_t f64_msb_mul (f64 a, f64 b)
f64 f64_div (f64 a, f64 b)
f64 f64_sqrt (f64 f)
void f64_print (f64 fix)


Define Documentation

#define f64_decimal   u.s.decimal

Definition at line 53 of file f64.h.

#define f64_integer   u.s.integer

Definition at line 52 of file f64.h.

#define F64_IS_EQ ( x,
 )     (f64_to_s64(x) == f64_to_s64(y))

Definition at line 73 of file f64.h.

Referenced by f64_print().

#define F64_IS_GE ( x,
 )     (f64_to_s64(x) >= f64_to_s64(y))

Definition at line 71 of file f64.h.

#define F64_IS_GT ( x,
 )     (f64_to_s64(x) > f64_to_s64(y))

Definition at line 69 of file f64.h.

#define F64_IS_LE ( x,
 )     (f64_to_s64(x) <= f64_to_s64(y))

Definition at line 72 of file f64.h.

#define F64_IS_LT ( x,
 )     (f64_to_s64(x) < f64_to_s64(y))

Definition at line 70 of file f64.h.

#define F64_IS_NE ( x,
 )     (f64_to_s64(x) != f64_to_s64(y))

Definition at line 74 of file f64.h.

#define F64_IS_NEG (  )     ((x).f64_integer < 0)

Definition at line 75 of file f64.h.

Referenced by f64_sqrt().

#define F64_IS_ZERO (  )     ((x).f64_integer == 0 && (x).f64_decimal == 0)

Definition at line 76 of file f64.h.

Referenced by f64_div(), f64_inv(), and f64_sqrt().

#define F64_NAN

Value:

(                      \
{                                      \
    f64 __f;                           \
    __f.u.s64 = 0xFFFFFFFFFFFFFFFF;    \
    __f;                               \
})

Definition at line 62 of file f64.h.

Referenced by f64_div(), f64_inv(), f64_print(), and f64_sqrt().

#define F64_ZERO

Value:

(    \
{                     \
    f64 __f;          \
    __f.u.s64 = 0;    \
    __f;              \
})

Definition at line 55 of file f64.h.

Referenced by f64_sqrt().


Typedef Documentation

typedef struct fixed_64 f64


Function Documentation

f64 f64_add ( f64  a,
f64  b 
)

add a with b (=a+b)

Definition at line 27 of file f64_add.c.

f64 f64_div ( f64  a,
f64  b 
)

div a with b (=a/b)

Definition at line 25 of file f64_div.c.

References f64_inv(), F64_IS_ZERO, f64_mul(), and F64_NAN.

f64 f64_from_double ( double  f  ) 

convert a double to a f64

Definition at line 31 of file f64_double.c.

References parse_symbols::f, and POW2_32F.

Referenced by rs_set_left_ext_encoder(), and rs_set_right_ext_encoder().

f64 f64_from_integer ( int32_t  i,
uint32_t  d 
)

convert 2 integer (int32_t and uint32_t) to a f64

Definition at line 27 of file f64_int.c.

References parse_symbols::f.

f64 f64_from_lsb ( int32_t  i  ) 

convert lsb integer (int32_t) to a f64 ( -0.5 < ret < 0.5 )

Definition at line 50 of file f64_int.c.

References parse_symbols::f.

Referenced by rs_update().

f64 f64_from_msb ( int32_t  i  ) 

convert msb integer (int32_t) to a f64

Definition at line 38 of file f64_int.c.

References parse_symbols::f.

f64 f64_inv ( f64  f  ) 

return opposite of the number (=1/f)

Definition at line 27 of file f64_inv.c.

References F64_IS_ZERO, and F64_NAN.

Referenced by f64_div().

int32_t f64_msb_mul ( f64  a,
f64  b 
)

mul a with b (=a*b), but return only the msb

Definition at line 28 of file f64_msb_mul.c.

Referenced by rs_update().

f64 f64_mul ( f64  a,
f64  b 
)

mul a with b (=a*b)

Definition at line 28 of file f64_mul.c.

Referenced by f64_div(), and f64_sqrt().

f64 f64_neg ( f64  f  ) 

return opposite of the number (=-f)

Definition at line 28 of file f64_neg.c.

void f64_print ( f64  fix  ) 

function that display a f64 to the standard output

Definition at line 26 of file f64_print.c.

References F64_IS_EQ, F64_NAN, and f64_to_double().

f64 f64_sqrt ( f64  f  ) 

sqrt of f

Definition at line 45 of file f64_sqrt.c.

References a, F64_IS_NEG, F64_IS_ZERO, f64_mul(), F64_NAN, and F64_ZERO.

f64 f64_sub ( f64  a,
f64  b 
)

add a with b (=a-b)

Definition at line 27 of file f64_sub.c.

double f64_to_double ( f64  fix  ) 

convert a f64 to a double

Definition at line 40 of file f64_double.c.

References POW2_32F.

Referenced by f64_print().


Generated on Fri Mar 12 06:32:05 2010 for AVR by  doxygen 1.5.6