3 [![Build Status](https://travis-ci.org/yisibl/num2fraction.svg)](https://travis-ci.org/yisibl/num2fraction)
4 [![NPM Downloads](https://img.shields.io/npm/dm/num2fraction.svg?style=flat)](https://www.npmjs.com/package/num2fraction)
5 [![NPM Version](http://img.shields.io/npm/v/num2fraction.svg?style=flat)](https://www.npmjs.com/package/num2fraction)
6 [![License](https://img.shields.io/npm/l/num2fraction.svg?style=flat)](http://opensource.org/licenses/MIT)
8 > Converting Number to Fraction with Node.js.
13 npm install num2fraction
20 var n2f = require('num2fraction')
21 console.log(n2f(0)) // => 0
22 console.log(n2f(.2)) // => 1/5
23 console.log(n2f(1.1)) // => 11/10
24 console.log(n2f(1.2)) // => 6/5
25 console.log(n2f(1.3)) // => 13/10
26 console.log(n2f(1.4)) // => 7/5
27 console.log(n2f(1.5)) // => 3/2
28 console.log(n2f(2)) // => 2/1
29 console.log(n2f(2.1)) // => 21/10
30 console.log(n2f(3)) // => 3/1
31 console.log(n2f(2.555)) // => 511/200
32 console.log(n2f(8.36)) // => 209/25
33 console.log(n2f('3em')) // => 3/1
34 console.log(n2f('1.5px')) // => 3/2
35 console.log(n2f(7 / 9) // => 7/9
36 console.log(n2f(8 / 9) // => 8/9
37 console.log(n2f(512 / 999) // => 512/999
38 console.log(n2f((2 * π / 3) / π) // => 2/3
39 console.log(n2f((8 * 5) / (4 / 2)) // => 20/1
44 Opera [old versions](http://www.opera.com/docs/specs/presto28/css/o-vendor/) support the non-standard `-o-min-device-pixel-ratio` or `-o-max-device-pixel-ratio` in CSS media queries.
48 only screen and (-webkit-min-device-pixel-ratio: 2),
49 only screen and ( min--moz-device-pixel-ratio: 2),
50 only screen and ( -o-min-device-pixel-ratio: 2/1), /* Opera */
51 only screen and ( min-device-pixel-ratio: 2),
52 only screen and ( min-resolution: 192dpi), /* fallback */
53 only screen and ( min-resolution: 2dppx) {
62 * \+ Remove: Debug log message.
66 * \+ Fix: 0 must be converted to a string.
70 * \+ Fix: Accomodate rounding errors. (by @jamestalmage)
71 * \+ Fix: The negative sign should be on numerator. (by @jamestalmage)
75 * \+ Use more precise (not fixed) precision factor for the calculation
79 * \- Remove "ci.testling.com"