ekg / fraction.js

A fraction math library in javascript.
http://hypervolu.me/~erik/fraction.js/
165 stars 43 forks source link

Fixed conversion bug #21

Closed imajeet5 closed 3 years ago

imajeet5 commented 3 years ago

There was a bug on line 315 and 322 of code js var scaleup = Math.pow(10, rounded.toString().split('.')[1].length); for the case in where decimal number is ending with .9999 ex 8.99999999999

The value of rounded becomes 9 i.e. whole number and it will throw an error cannot read length of undefined because out code is expecting a decimal value with '.' in it