\hypertarget{group___mmal_rational_utilities}{}\section{Rational Utility Functions}
\label{group___mmal_rational_utilities}\index{Rational Utility Functions@{Rational Utility Functions}}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} \mbox{\hyperlink{group___mmal_rational_utilities_ga2a9a72b56cbe9108009abceea4ead7f4}{mmal\+\_\+rational\+\_\+add}} (\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} a, \mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} b)
\item 
\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} \mbox{\hyperlink{group___mmal_rational_utilities_gac4326d4fb579aad4289fbda106260069}{mmal\+\_\+rational\+\_\+subtract}} (\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} a, \mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} b)
\item 
\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} \mbox{\hyperlink{group___mmal_rational_utilities_gab2e950314aa999d95a7bb2b6f9346d67}{mmal\+\_\+rational\+\_\+multiply}} (\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} a, \mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} b)
\item 
\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} \mbox{\hyperlink{group___mmal_rational_utilities_ga41760367b5019207ee6fd89fd1972ae0}{mmal\+\_\+rational\+\_\+divide}} (\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} a, \mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} b)
\item 
int32\+\_\+t \mbox{\hyperlink{group___mmal_rational_utilities_ga6bc456446ae92b742928cdd6a6b80ac2}{mmal\+\_\+rational\+\_\+to\+\_\+fixed\+\_\+16\+\_\+16}} (\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} rational)
\item 
\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} \mbox{\hyperlink{group___mmal_rational_utilities_ga75ccc64ed701280983ae95c3ef0f539c}{mmal\+\_\+rational\+\_\+from\+\_\+fixed\+\_\+16\+\_\+16}} (int32\+\_\+t fixed)
\item 
void \mbox{\hyperlink{group___mmal_rational_utilities_gae56850c49fb42c3f9a69baa22d41ed66}{mmal\+\_\+rational\+\_\+simplify}} (\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} $\ast$rational)
\item 
M\+M\+A\+L\+\_\+\+B\+O\+O\+L\+\_\+T \mbox{\hyperlink{group___mmal_rational_utilities_ga85c7bab253400a784f5ca55de7aeb3e3}{mmal\+\_\+rational\+\_\+equal}} (\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} a, \mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} b)
\end{DoxyCompactItemize}


\subsection{Detailed Description}
The rational utility functions allow easy manipulation of rational numbers. 

\subsection{Function Documentation}
\mbox{\Hypertarget{group___mmal_rational_utilities_ga2a9a72b56cbe9108009abceea4ead7f4}\label{group___mmal_rational_utilities_ga2a9a72b56cbe9108009abceea4ead7f4}} 
\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+add@{mmal\+\_\+rational\+\_\+add}}
\index{mmal\+\_\+rational\+\_\+add@{mmal\+\_\+rational\+\_\+add}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection{\texorpdfstring{mmal\+\_\+rational\+\_\+add()}{mmal\_rational\_add()}}
{\footnotesize\ttfamily \mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} mmal\+\_\+rational\+\_\+add (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}}}]{a,  }\item[{\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}}}]{b }\end{DoxyParamCaption})}

Add 2 rational numbers. It is assumed that both input rational numbers are in their simplest form.


\begin{DoxyParams}{Parameters}
{\em a} & First operand \\
\hline
{\em b} & Second operand\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a + b 
\end{DoxyReturn}
\mbox{\Hypertarget{group___mmal_rational_utilities_ga41760367b5019207ee6fd89fd1972ae0}\label{group___mmal_rational_utilities_ga41760367b5019207ee6fd89fd1972ae0}} 
\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+divide@{mmal\+\_\+rational\+\_\+divide}}
\index{mmal\+\_\+rational\+\_\+divide@{mmal\+\_\+rational\+\_\+divide}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection{\texorpdfstring{mmal\+\_\+rational\+\_\+divide()}{mmal\_rational\_divide()}}
{\footnotesize\ttfamily \mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} mmal\+\_\+rational\+\_\+divide (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}}}]{a,  }\item[{\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}}}]{b }\end{DoxyParamCaption})}

Divide 2 rational numbers. It is assumed that both input rational numbers are in their simplest form.


\begin{DoxyParams}{Parameters}
{\em a} & First operand \\
\hline
{\em b} & Second operand\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a / b 
\end{DoxyReturn}
\mbox{\Hypertarget{group___mmal_rational_utilities_ga85c7bab253400a784f5ca55de7aeb3e3}\label{group___mmal_rational_utilities_ga85c7bab253400a784f5ca55de7aeb3e3}} 
\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+equal@{mmal\+\_\+rational\+\_\+equal}}
\index{mmal\+\_\+rational\+\_\+equal@{mmal\+\_\+rational\+\_\+equal}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection{\texorpdfstring{mmal\+\_\+rational\+\_\+equal()}{mmal\_rational\_equal()}}
{\footnotesize\ttfamily M\+M\+A\+L\+\_\+\+B\+O\+O\+L\+\_\+T mmal\+\_\+rational\+\_\+equal (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}}}]{a,  }\item[{\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}}}]{b }\end{DoxyParamCaption})}

Test 2 rational numbers for equality.


\begin{DoxyParams}{Parameters}
{\em a} & First operand \\
\hline
{\em b} & Second operand\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if equal 
\end{DoxyReturn}
\mbox{\Hypertarget{group___mmal_rational_utilities_ga75ccc64ed701280983ae95c3ef0f539c}\label{group___mmal_rational_utilities_ga75ccc64ed701280983ae95c3ef0f539c}} 
\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+from\+\_\+fixed\+\_\+16\+\_\+16@{mmal\+\_\+rational\+\_\+from\+\_\+fixed\+\_\+16\+\_\+16}}
\index{mmal\+\_\+rational\+\_\+from\+\_\+fixed\+\_\+16\+\_\+16@{mmal\+\_\+rational\+\_\+from\+\_\+fixed\+\_\+16\+\_\+16}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection{\texorpdfstring{mmal\+\_\+rational\+\_\+from\+\_\+fixed\+\_\+16\+\_\+16()}{mmal\_rational\_from\_fixed\_16\_16()}}
{\footnotesize\ttfamily \mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} mmal\+\_\+rational\+\_\+from\+\_\+fixed\+\_\+16\+\_\+16 (\begin{DoxyParamCaption}\item[{int32\+\_\+t}]{fixed }\end{DoxyParamCaption})}

Convert a signed 32-\/bit Q16 number to a rational number.


\begin{DoxyParams}{Parameters}
{\em fixed} & Signed 32-\/bit Q16 number to convert\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Rational number 
\end{DoxyReturn}
\mbox{\Hypertarget{group___mmal_rational_utilities_gab2e950314aa999d95a7bb2b6f9346d67}\label{group___mmal_rational_utilities_gab2e950314aa999d95a7bb2b6f9346d67}} 
\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+multiply@{mmal\+\_\+rational\+\_\+multiply}}
\index{mmal\+\_\+rational\+\_\+multiply@{mmal\+\_\+rational\+\_\+multiply}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection{\texorpdfstring{mmal\+\_\+rational\+\_\+multiply()}{mmal\_rational\_multiply()}}
{\footnotesize\ttfamily \mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} mmal\+\_\+rational\+\_\+multiply (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}}}]{a,  }\item[{\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}}}]{b }\end{DoxyParamCaption})}

Multiply 2 rational numbers. It is assumed that both input rational numbers are in their simplest form.


\begin{DoxyParams}{Parameters}
{\em a} & First operand \\
\hline
{\em b} & Second operand\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a $\ast$ b 
\end{DoxyReturn}
\mbox{\Hypertarget{group___mmal_rational_utilities_gae56850c49fb42c3f9a69baa22d41ed66}\label{group___mmal_rational_utilities_gae56850c49fb42c3f9a69baa22d41ed66}} 
\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+simplify@{mmal\+\_\+rational\+\_\+simplify}}
\index{mmal\+\_\+rational\+\_\+simplify@{mmal\+\_\+rational\+\_\+simplify}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection{\texorpdfstring{mmal\+\_\+rational\+\_\+simplify()}{mmal\_rational\_simplify()}}
{\footnotesize\ttfamily void mmal\+\_\+rational\+\_\+simplify (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} $\ast$}]{rational }\end{DoxyParamCaption})}

Reduce a rational number to it\textquotesingle{}s simplest form.


\begin{DoxyParams}{Parameters}
{\em rational} & Rational number to simplify \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{group___mmal_rational_utilities_gac4326d4fb579aad4289fbda106260069}\label{group___mmal_rational_utilities_gac4326d4fb579aad4289fbda106260069}} 
\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+subtract@{mmal\+\_\+rational\+\_\+subtract}}
\index{mmal\+\_\+rational\+\_\+subtract@{mmal\+\_\+rational\+\_\+subtract}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection{\texorpdfstring{mmal\+\_\+rational\+\_\+subtract()}{mmal\_rational\_subtract()}}
{\footnotesize\ttfamily \mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}} mmal\+\_\+rational\+\_\+subtract (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}}}]{a,  }\item[{\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}}}]{b }\end{DoxyParamCaption})}

Subtract 2 rational numbers. It is assumed that both input rational numbers are in their simplest form.


\begin{DoxyParams}{Parameters}
{\em a} & First operand \\
\hline
{\em b} & Second operand\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a -\/ b 
\end{DoxyReturn}
\mbox{\Hypertarget{group___mmal_rational_utilities_ga6bc456446ae92b742928cdd6a6b80ac2}\label{group___mmal_rational_utilities_ga6bc456446ae92b742928cdd6a6b80ac2}} 
\index{Rational Utility Functions@{Rational Utility Functions}!mmal\+\_\+rational\+\_\+to\+\_\+fixed\+\_\+16\+\_\+16@{mmal\+\_\+rational\+\_\+to\+\_\+fixed\+\_\+16\+\_\+16}}
\index{mmal\+\_\+rational\+\_\+to\+\_\+fixed\+\_\+16\+\_\+16@{mmal\+\_\+rational\+\_\+to\+\_\+fixed\+\_\+16\+\_\+16}!Rational Utility Functions@{Rational Utility Functions}}
\subsubsection{\texorpdfstring{mmal\+\_\+rational\+\_\+to\+\_\+fixed\+\_\+16\+\_\+16()}{mmal\_rational\_to\_fixed\_16\_16()}}
{\footnotesize\ttfamily int32\+\_\+t mmal\+\_\+rational\+\_\+to\+\_\+fixed\+\_\+16\+\_\+16 (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_m_m_a_l___r_a_t_i_o_n_a_l___t}{M\+M\+A\+L\+\_\+\+R\+A\+T\+I\+O\+N\+A\+L\+\_\+T}}}]{rational }\end{DoxyParamCaption})}

Convert a rational number to a 32-\/bit signed Q16 number. Saturation will occur for rational numbers with an absolute value greater than 32768.


\begin{DoxyParams}{Parameters}
{\em rational} & Rational number to convert\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
32-\/bit signed Q16 number 
\end{DoxyReturn}
