\href{https://travis-ci.org/yisibl/num2fraction}{\texttt{ }} \href{https://www.npmjs.com/package/num2fraction}{\texttt{ }} \href{https://www.npmjs.com/package/num2fraction}{\texttt{ }} \href{http://opensource.org/licenses/MIT}{\texttt{ }}

\begin{quote}
Converting Number to Fraction with Node.\+js. \end{quote}
\hypertarget{md_sfcode_node_modules_num2fraction_README_autotoc_md18752}{}\doxysection{Installation}\label{md_sfcode_node_modules_num2fraction_README_autotoc_md18752}

\begin{DoxyCode}{0}
\DoxyCodeLine{npm install num2fraction }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_num2fraction_README_autotoc_md18753}{}\doxysection{Usage}\label{md_sfcode_node_modules_num2fraction_README_autotoc_md18753}

\begin{DoxyCode}{0}
\DoxyCodeLine{var π   = Math.PI}
\DoxyCodeLine{var n2f = require('num2fraction')}
\DoxyCodeLine{  console.log(n2f(0))                // => 0}
\DoxyCodeLine{  console.log(n2f(.2))               // => 1/5}
\DoxyCodeLine{  console.log(n2f(1.1))              // => 11/10}
\DoxyCodeLine{  console.log(n2f(1.2))              // => 6/5}
\DoxyCodeLine{  console.log(n2f(1.3))              // => 13/10}
\DoxyCodeLine{  console.log(n2f(1.4))              // => 7/5}
\DoxyCodeLine{  console.log(n2f(1.5))              // => 3/2}
\DoxyCodeLine{  console.log(n2f(2))                // => 2/1}
\DoxyCodeLine{  console.log(n2f(2.1))              // => 21/10}
\DoxyCodeLine{  console.log(n2f(3))                // => 3/1}
\DoxyCodeLine{  console.log(n2f(2.555))            // => 511/200}
\DoxyCodeLine{  console.log(n2f(8.36))             // => 209/25}
\DoxyCodeLine{  console.log(n2f('3em'))            // => 3/1}
\DoxyCodeLine{  console.log(n2f('1.5px'))          // => 3/2}
\DoxyCodeLine{  console.log(n2f(7 / 9)             // => 7/9}
\DoxyCodeLine{  console.log(n2f(8 / 9)             // => 8/9}
\DoxyCodeLine{  console.log(n2f(512 / 999)         // => 512/999}
\DoxyCodeLine{  console.log(n2f((2 * π / 3) / π)   // => 2/3}
\DoxyCodeLine{  console.log(n2f((8 * 5) / (4 / 2)) // => 20/1 }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_num2fraction_README_autotoc_md18754}{}\doxysection{Example}\label{md_sfcode_node_modules_num2fraction_README_autotoc_md18754}
Opera \href{http://www.opera.com/docs/specs/presto28/css/o-vendor/}{\texttt{ old versions}} support the non-\/standard {\ttfamily -\/o-\/min-\/device-\/pixel-\/ratio} or {\ttfamily -\/o-\/max-\/device-\/pixel-\/ratio} in CSS media queries.


\begin{DoxyCode}{0}
\DoxyCodeLine{@media}
\DoxyCodeLine{  only screen and (-\/webkit-\/min-\/device-\/pixel-\/ratio: 2),}
\DoxyCodeLine{  only screen and (   min-\/-\/moz-\/device-\/pixel-\/ratio: 2),}
\DoxyCodeLine{  only screen and (     -\/o-\/min-\/device-\/pixel-\/ratio: 2/1), /* Opera */}
\DoxyCodeLine{  only screen and (        min-\/device-\/pixel-\/ratio: 2),}
\DoxyCodeLine{  only screen and (                min-\/resolution: 192dpi), /* fallback */}
\DoxyCodeLine{  only screen and (                min-\/resolution: 2dppx) \{ }
\DoxyCodeLine{}
\DoxyCodeLine{\} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_num2fraction_README_autotoc_md18755}{}\doxysection{Changelog}\label{md_sfcode_node_modules_num2fraction_README_autotoc_md18755}
\hypertarget{md_sfcode_node_modules_num2fraction_README_autotoc_md18756}{}\doxysubsection{v1.\+2.\+2}\label{md_sfcode_node_modules_num2fraction_README_autotoc_md18756}

\begin{DoxyItemize}
\item + Remove\+: Debug log message.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_num2fraction_README_autotoc_md18757}{}\doxysubsection{v1.\+2.\+1}\label{md_sfcode_node_modules_num2fraction_README_autotoc_md18757}

\begin{DoxyItemize}
\item + Fix\+: 0 must be converted to a string.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_num2fraction_README_autotoc_md18758}{}\doxysubsection{v1.\+2.\+0}\label{md_sfcode_node_modules_num2fraction_README_autotoc_md18758}

\begin{DoxyItemize}
\item + Fix\+: Accomodate rounding errors. (by @jamestalmage)
\item + Fix\+: The negative sign should be on numerator. (by @jamestalmage)
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_num2fraction_README_autotoc_md18759}{}\doxysubsection{v1.\+1.\+0}\label{md_sfcode_node_modules_num2fraction_README_autotoc_md18759}

\begin{DoxyItemize}
\item + Use more precise (not fixed) precision factor for the calculation
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_num2fraction_README_autotoc_md18760}{}\doxysubsection{v1.\+0.\+1}\label{md_sfcode_node_modules_num2fraction_README_autotoc_md18760}

\begin{DoxyItemize}
\item -\/ Remove \char`\"{}ci.\+testling.\+com\char`\"{}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_num2fraction_README_autotoc_md18761}{}\doxysubsection{V1.\+0.\+0}\label{md_sfcode_node_modules_num2fraction_README_autotoc_md18761}
\begin{quote}
First release. \end{quote}
\hypertarget{md_sfcode_node_modules_num2fraction_README_autotoc_md18762}{}\doxysection{License}\label{md_sfcode_node_modules_num2fraction_README_autotoc_md18762}
\mbox{[}MIT\mbox{]}(LICENSE) 