The title pretty much says it all: this JavaScript code takes a decimal number and converts it into a fraction.
This code:
- recognizes 0.3333333 as 1/3
- allows not to extract the integral part: 1.5 can return 1 1/2 (by default) or 3/2
- works with negative numbers