Larry Battle

Results 31 comments of Larry Battle

There needs to be a condition that prevents using the simplified fraction if it turns out to be longer than the original. Test Case: ``` var checkRatioSimplify = function (min,...

Here's a better test. ``` var checkRatioSimplify = function (min, max, fn, includeValues) { var badValues = includeValues ? [] : 0, x = [], expect, output; if (max

For `toFixed()`, I think `Ratio.parse().valueOf().toFixed()` should work well, unless if there are too many errors with the division. For example, ``` (12000/31).toFixed(20) === "387.09677419354841276800" but should be (12000/31).toFixed(20) === "387.09677419354838709677"...

For tofixed(), you could try something like decimal expansion. Article: http://bateru.com/news/2012/05/code-of-the-day-javascript-decimal-expansion-a-k-a-division/ Bug in article, doesn't support scientific notated values.

File is included but not sure where to use to it.

This might work. ``` Ratio.prototype.getContinuedFraction = function(){ var arr = [], a = Math.abs(this.numerator), b = this.denominator, c = Math.floor(a/b), limit = 400, tmp; while( limit-- && isFinite(a/b) && 0...

I'm not sure how to use continued fractions. Need more research.

Transverse the Stern-Brocot tree to find the best approximation.

Are better yet should `.reduce()` replace `.cleanFormat()`?

Software Versioning Guideline: a.b.c `a`, `b`, `c` are all integers that represent the release version. Increase `a` when a set well tested usable features have been added to the source...