\section{aversive\_\-10-03-12/modules/base/math/fixed\_\-point/f64.h File Reference}
\label{f64_8h}\index{aversive\_\-10-03-12/modules/base/math/fixed\_\-point/f64.h@{aversive\_\-10-03-12/modules/base/math/fixed\_\-point/f64.h}}
{\tt \#include $<$aversive.h$>$}\par
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct {\bf fixed\_\-64}
\end{CompactItemize}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf f64\_\-integer}~u.s.integer
\item 
\#define {\bf f64\_\-decimal}~u.s.decimal
\item 
\#define {\bf F64\_\-ZERO}
\item 
\#define {\bf F64\_\-NAN}
\item 
\#define {\bf F64\_\-IS\_\-GT}(x, y)~(f64\_\-to\_\-s64(x) $>$  f64\_\-to\_\-s64(y))
\item 
\#define {\bf F64\_\-IS\_\-LT}(x, y)~(f64\_\-to\_\-s64(x) $<$  f64\_\-to\_\-s64(y))
\item 
\#define {\bf F64\_\-IS\_\-GE}(x, y)~(f64\_\-to\_\-s64(x) $>$= f64\_\-to\_\-s64(y))
\item 
\#define {\bf F64\_\-IS\_\-LE}(x, y)~(f64\_\-to\_\-s64(x) $<$= f64\_\-to\_\-s64(y))
\item 
\#define {\bf F64\_\-IS\_\-EQ}(x, y)~(f64\_\-to\_\-s64(x) == f64\_\-to\_\-s64(y))
\item 
\#define {\bf F64\_\-IS\_\-NE}(x, y)~(f64\_\-to\_\-s64(x) != f64\_\-to\_\-s64(y))
\item 
\#define {\bf F64\_\-IS\_\-NEG}(x)~((x).f64\_\-integer $<$ 0)
\item 
\#define {\bf F64\_\-IS\_\-ZERO}(x)~((x).f64\_\-integer == 0 \&\& (x).f64\_\-decimal == 0)
\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
typedef struct {\bf fixed\_\-64} {\bf f64}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
{\bf f64} {\bf f64\_\-from\_\-double} (double f)
\item 
double {\bf f64\_\-to\_\-double} ({\bf f64} fix)
\item 
{\bf f64} {\bf f64\_\-from\_\-integer} (int32\_\-t {\bf i}, uint32\_\-t d)
\item 
{\bf f64} {\bf f64\_\-from\_\-msb} (int32\_\-t {\bf i})
\item 
{\bf f64} {\bf f64\_\-from\_\-lsb} (int32\_\-t {\bf i})
\item 
{\bf f64} {\bf f64\_\-neg} ({\bf f64} f)
\item 
{\bf f64} {\bf f64\_\-add} ({\bf f64} {\bf a}, {\bf f64} b)
\item 
{\bf f64} {\bf f64\_\-sub} ({\bf f64} {\bf a}, {\bf f64} b)
\item 
{\bf f64} {\bf f64\_\-inv} ({\bf f64} f)
\item 
{\bf f64} {\bf f64\_\-mul} ({\bf f64} {\bf a}, {\bf f64} b)
\item 
int32\_\-t {\bf f64\_\-msb\_\-mul} ({\bf f64} {\bf a}, {\bf f64} b)
\item 
{\bf f64} {\bf f64\_\-div} ({\bf f64} {\bf a}, {\bf f64} b)
\item 
{\bf f64} {\bf f64\_\-sqrt} ({\bf f64} f)
\item 
void {\bf f64\_\-print} ({\bf f64} fix)
\end{CompactItemize}


\subsection{Define Documentation}
\index{f64.h@{f64.h}!f64\_\-decimal@{f64\_\-decimal}}
\index{f64\_\-decimal@{f64\_\-decimal}!f64.h@{f64.h}}
\subsubsection[f64\_\-decimal]{\setlength{\rightskip}{0pt plus 5cm}\#define f64\_\-decimal~u.s.decimal}\label{f64_8h_8480e090609b598831a899b6cc12c7f5}




Definition at line 53 of file f64.h.\index{f64.h@{f64.h}!f64\_\-integer@{f64\_\-integer}}
\index{f64\_\-integer@{f64\_\-integer}!f64.h@{f64.h}}
\subsubsection[f64\_\-integer]{\setlength{\rightskip}{0pt plus 5cm}\#define f64\_\-integer~u.s.integer}\label{f64_8h_514bab239f0a0638cd5496cff847a4c9}




Definition at line 52 of file f64.h.\index{f64.h@{f64.h}!F64\_\-IS\_\-EQ@{F64\_\-IS\_\-EQ}}
\index{F64\_\-IS\_\-EQ@{F64\_\-IS\_\-EQ}!f64.h@{f64.h}}
\subsubsection[F64\_\-IS\_\-EQ]{\setlength{\rightskip}{0pt plus 5cm}\#define F64\_\-IS\_\-EQ(x, \/  y)~(f64\_\-to\_\-s64(x) == f64\_\-to\_\-s64(y))}\label{f64_8h_deddf9c67d3d0ecb0af2d62bcf4f80b2}




Definition at line 73 of file f64.h.

Referenced by f64\_\-print().\index{f64.h@{f64.h}!F64\_\-IS\_\-GE@{F64\_\-IS\_\-GE}}
\index{F64\_\-IS\_\-GE@{F64\_\-IS\_\-GE}!f64.h@{f64.h}}
\subsubsection[F64\_\-IS\_\-GE]{\setlength{\rightskip}{0pt plus 5cm}\#define F64\_\-IS\_\-GE(x, \/  y)~(f64\_\-to\_\-s64(x) $>$= f64\_\-to\_\-s64(y))}\label{f64_8h_6c92b2fd182cbfc946f8a7a0c4fe15d7}




Definition at line 71 of file f64.h.\index{f64.h@{f64.h}!F64\_\-IS\_\-GT@{F64\_\-IS\_\-GT}}
\index{F64\_\-IS\_\-GT@{F64\_\-IS\_\-GT}!f64.h@{f64.h}}
\subsubsection[F64\_\-IS\_\-GT]{\setlength{\rightskip}{0pt plus 5cm}\#define F64\_\-IS\_\-GT(x, \/  y)~(f64\_\-to\_\-s64(x) $>$  f64\_\-to\_\-s64(y))}\label{f64_8h_45aa0b76ddae6a5e5dfe51b1e5738eb5}




Definition at line 69 of file f64.h.\index{f64.h@{f64.h}!F64\_\-IS\_\-LE@{F64\_\-IS\_\-LE}}
\index{F64\_\-IS\_\-LE@{F64\_\-IS\_\-LE}!f64.h@{f64.h}}
\subsubsection[F64\_\-IS\_\-LE]{\setlength{\rightskip}{0pt plus 5cm}\#define F64\_\-IS\_\-LE(x, \/  y)~(f64\_\-to\_\-s64(x) $<$= f64\_\-to\_\-s64(y))}\label{f64_8h_3597098b9829a871c282143d496c7ef0}




Definition at line 72 of file f64.h.\index{f64.h@{f64.h}!F64\_\-IS\_\-LT@{F64\_\-IS\_\-LT}}
\index{F64\_\-IS\_\-LT@{F64\_\-IS\_\-LT}!f64.h@{f64.h}}
\subsubsection[F64\_\-IS\_\-LT]{\setlength{\rightskip}{0pt plus 5cm}\#define F64\_\-IS\_\-LT(x, \/  y)~(f64\_\-to\_\-s64(x) $<$  f64\_\-to\_\-s64(y))}\label{f64_8h_7adccc4f48aa5429a9a239e7342f0aa0}




Definition at line 70 of file f64.h.\index{f64.h@{f64.h}!F64\_\-IS\_\-NE@{F64\_\-IS\_\-NE}}
\index{F64\_\-IS\_\-NE@{F64\_\-IS\_\-NE}!f64.h@{f64.h}}
\subsubsection[F64\_\-IS\_\-NE]{\setlength{\rightskip}{0pt plus 5cm}\#define F64\_\-IS\_\-NE(x, \/  y)~(f64\_\-to\_\-s64(x) != f64\_\-to\_\-s64(y))}\label{f64_8h_8629e87566bbd01490c7d7c115d968d2}




Definition at line 74 of file f64.h.\index{f64.h@{f64.h}!F64\_\-IS\_\-NEG@{F64\_\-IS\_\-NEG}}
\index{F64\_\-IS\_\-NEG@{F64\_\-IS\_\-NEG}!f64.h@{f64.h}}
\subsubsection[F64\_\-IS\_\-NEG]{\setlength{\rightskip}{0pt plus 5cm}\#define F64\_\-IS\_\-NEG(x)~((x).f64\_\-integer $<$ 0)}\label{f64_8h_4eb1d5514caf8f762440b238ba88cc2c}




Definition at line 75 of file f64.h.

Referenced by f64\_\-sqrt().\index{f64.h@{f64.h}!F64\_\-IS\_\-ZERO@{F64\_\-IS\_\-ZERO}}
\index{F64\_\-IS\_\-ZERO@{F64\_\-IS\_\-ZERO}!f64.h@{f64.h}}
\subsubsection[F64\_\-IS\_\-ZERO]{\setlength{\rightskip}{0pt plus 5cm}\#define F64\_\-IS\_\-ZERO(x)~((x).f64\_\-integer == 0 \&\& (x).f64\_\-decimal == 0)}\label{f64_8h_f354146a30be96184ab05896e7a041d8}




Definition at line 76 of file f64.h.

Referenced by f64\_\-div(), f64\_\-inv(), and f64\_\-sqrt().\index{f64.h@{f64.h}!F64\_\-NAN@{F64\_\-NAN}}
\index{F64\_\-NAN@{F64\_\-NAN}!f64.h@{f64.h}}
\subsubsection[F64\_\-NAN]{\setlength{\rightskip}{0pt plus 5cm}\#define F64\_\-NAN}\label{f64_8h_9e560faed3de59df5146c5166d789a93}


\textbf{Value:}

\begin{Code}\begin{verbatim}(                      \
{                                      \
    f64 __f;                           \
    __f.u.s64 = 0xFFFFFFFFFFFFFFFF;    \
    __f;                               \
})
\end{verbatim}
\end{Code}


Definition at line 62 of file f64.h.

Referenced by f64\_\-div(), f64\_\-inv(), f64\_\-print(), and f64\_\-sqrt().\index{f64.h@{f64.h}!F64\_\-ZERO@{F64\_\-ZERO}}
\index{F64\_\-ZERO@{F64\_\-ZERO}!f64.h@{f64.h}}
\subsubsection[F64\_\-ZERO]{\setlength{\rightskip}{0pt plus 5cm}\#define F64\_\-ZERO}\label{f64_8h_d6d95c7066d1694d2e14293d745928d2}


\textbf{Value:}

\begin{Code}\begin{verbatim}(    \
{                     \
    f64 __f;          \
    __f.u.s64 = 0;    \
    __f;              \
})
\end{verbatim}
\end{Code}


Definition at line 55 of file f64.h.

Referenced by f64\_\-sqrt().

\subsection{Typedef Documentation}
\index{f64.h@{f64.h}!f64@{f64}}
\index{f64@{f64}!f64.h@{f64.h}}
\subsubsection[f64]{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf fixed\_\-64}  {\bf f64}}\label{f64_8h_e7b5da5437a138f91ce64d5c712fffb0}




\subsection{Function Documentation}
\index{f64.h@{f64.h}!f64\_\-add@{f64\_\-add}}
\index{f64\_\-add@{f64\_\-add}!f64.h@{f64.h}}
\subsubsection[f64\_\-add]{\setlength{\rightskip}{0pt plus 5cm}{\bf f64} f64\_\-add ({\bf f64} {\em a}, \/  {\bf f64} {\em b})}\label{f64_8h_36affd39fd890004d1322db8007bf88d}


add a with b (=a+b) 

Definition at line 27 of file f64\_\-add.c.\index{f64.h@{f64.h}!f64\_\-div@{f64\_\-div}}
\index{f64\_\-div@{f64\_\-div}!f64.h@{f64.h}}
\subsubsection[f64\_\-div]{\setlength{\rightskip}{0pt plus 5cm}{\bf f64} f64\_\-div ({\bf f64} {\em a}, \/  {\bf f64} {\em b})}\label{f64_8h_44d1e7e7aa065f05ca85075ddbb15c29}


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.\index{f64.h@{f64.h}!f64\_\-from\_\-double@{f64\_\-from\_\-double}}
\index{f64\_\-from\_\-double@{f64\_\-from\_\-double}!f64.h@{f64.h}}
\subsubsection[f64\_\-from\_\-double]{\setlength{\rightskip}{0pt plus 5cm}{\bf f64} f64\_\-from\_\-double (double {\em f})}\label{f64_8h_cc7689d7ed70602b3650074d9881ed9d}


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().\index{f64.h@{f64.h}!f64\_\-from\_\-integer@{f64\_\-from\_\-integer}}
\index{f64\_\-from\_\-integer@{f64\_\-from\_\-integer}!f64.h@{f64.h}}
\subsubsection[f64\_\-from\_\-integer]{\setlength{\rightskip}{0pt plus 5cm}{\bf f64} f64\_\-from\_\-integer (int32\_\-t {\em i}, \/  uint32\_\-t {\em d})}\label{f64_8h_4dad031d851bc6b85d7264dc02a92c16}


convert 2 integer (int32\_\-t and uint32\_\-t) to a f64 

Definition at line 27 of file f64\_\-int.c.

References parse\_\-symbols::f.\index{f64.h@{f64.h}!f64\_\-from\_\-lsb@{f64\_\-from\_\-lsb}}
\index{f64\_\-from\_\-lsb@{f64\_\-from\_\-lsb}!f64.h@{f64.h}}
\subsubsection[f64\_\-from\_\-lsb]{\setlength{\rightskip}{0pt plus 5cm}{\bf f64} f64\_\-from\_\-lsb (int32\_\-t {\em i})}\label{f64_8h_245043a7b0e11168b6c66323e96bfe05}


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().\index{f64.h@{f64.h}!f64\_\-from\_\-msb@{f64\_\-from\_\-msb}}
\index{f64\_\-from\_\-msb@{f64\_\-from\_\-msb}!f64.h@{f64.h}}
\subsubsection[f64\_\-from\_\-msb]{\setlength{\rightskip}{0pt plus 5cm}{\bf f64} f64\_\-from\_\-msb (int32\_\-t {\em i})}\label{f64_8h_986d6016af84e1b100fbd0d16edba819}


convert msb integer (int32\_\-t) to a f64 

Definition at line 38 of file f64\_\-int.c.

References parse\_\-symbols::f.\index{f64.h@{f64.h}!f64\_\-inv@{f64\_\-inv}}
\index{f64\_\-inv@{f64\_\-inv}!f64.h@{f64.h}}
\subsubsection[f64\_\-inv]{\setlength{\rightskip}{0pt plus 5cm}{\bf f64} f64\_\-inv ({\bf f64} {\em f})}\label{f64_8h_3f0e5680042da0facc4778cd5625ba83}


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().\index{f64.h@{f64.h}!f64\_\-msb\_\-mul@{f64\_\-msb\_\-mul}}
\index{f64\_\-msb\_\-mul@{f64\_\-msb\_\-mul}!f64.h@{f64.h}}
\subsubsection[f64\_\-msb\_\-mul]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t f64\_\-msb\_\-mul ({\bf f64} {\em a}, \/  {\bf f64} {\em b})}\label{f64_8h_b547eaf9d637650dc74e99989bec043a}


mul a with b (=a$\ast$b), but return only the msb 

Definition at line 28 of file f64\_\-msb\_\-mul.c.

Referenced by rs\_\-update().\index{f64.h@{f64.h}!f64\_\-mul@{f64\_\-mul}}
\index{f64\_\-mul@{f64\_\-mul}!f64.h@{f64.h}}
\subsubsection[f64\_\-mul]{\setlength{\rightskip}{0pt plus 5cm}{\bf f64} f64\_\-mul ({\bf f64} {\em a}, \/  {\bf f64} {\em b})}\label{f64_8h_500e2a288837b8b0b5c4abec1054bb5d}


mul a with b (=a$\ast$b) 

Definition at line 28 of file f64\_\-mul.c.

Referenced by f64\_\-div(), and f64\_\-sqrt().\index{f64.h@{f64.h}!f64\_\-neg@{f64\_\-neg}}
\index{f64\_\-neg@{f64\_\-neg}!f64.h@{f64.h}}
\subsubsection[f64\_\-neg]{\setlength{\rightskip}{0pt plus 5cm}{\bf f64} f64\_\-neg ({\bf f64} {\em f})}\label{f64_8h_8ecc86b579263c00ad8c5e9f2b368c34}


return opposite of the number (=-f) 

Definition at line 28 of file f64\_\-neg.c.\index{f64.h@{f64.h}!f64\_\-print@{f64\_\-print}}
\index{f64\_\-print@{f64\_\-print}!f64.h@{f64.h}}
\subsubsection[f64\_\-print]{\setlength{\rightskip}{0pt plus 5cm}void f64\_\-print ({\bf f64} {\em fix})}\label{f64_8h_334f21f1a1e339382207950b73b06815}


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().\index{f64.h@{f64.h}!f64\_\-sqrt@{f64\_\-sqrt}}
\index{f64\_\-sqrt@{f64\_\-sqrt}!f64.h@{f64.h}}
\subsubsection[f64\_\-sqrt]{\setlength{\rightskip}{0pt plus 5cm}{\bf f64} f64\_\-sqrt ({\bf f64} {\em f})}\label{f64_8h_b180b0eea087f1f06884be2df1627b7e}


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.\index{f64.h@{f64.h}!f64\_\-sub@{f64\_\-sub}}
\index{f64\_\-sub@{f64\_\-sub}!f64.h@{f64.h}}
\subsubsection[f64\_\-sub]{\setlength{\rightskip}{0pt plus 5cm}{\bf f64} f64\_\-sub ({\bf f64} {\em a}, \/  {\bf f64} {\em b})}\label{f64_8h_61745083bfa1c5ac844cf649c817bfa0}


add a with b (=a-b) 

Definition at line 27 of file f64\_\-sub.c.\index{f64.h@{f64.h}!f64\_\-to\_\-double@{f64\_\-to\_\-double}}
\index{f64\_\-to\_\-double@{f64\_\-to\_\-double}!f64.h@{f64.h}}
\subsubsection[f64\_\-to\_\-double]{\setlength{\rightskip}{0pt plus 5cm}double f64\_\-to\_\-double ({\bf f64} {\em fix})}\label{f64_8h_67126c88db7222b19cb718c2c3c84a47}


convert a f64 to a double 

Definition at line 40 of file f64\_\-double.c.

References POW2\_\-32F.

Referenced by f64\_\-print().