Convert a rational number to a Babylonian fractions
JavaScript performance comparison
Info
Comparisons of algorithms to convert a rational number (a/b) to a sum of Babylonian fractions (rational numbers with a numerator of one)
Preparation code
<script src="//raw.github.com/acerix/jsscience/master/src/mathematics/number/Rational.js">
</script>
<script>
Benchmark.prototype.setup = function() {
var test_cases = [
[1, 10],
[3, 360],
[5, 360],
[7, 360],
[11, 360],
[13, 360],
[21, 666],
[23, 666],
[25, 666]
];
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
Test  Ops/sec  

JSScience Rational>toBabylonian() 

pending… 
JSScience Rational>toEgyptian() 

pending… 
JSScience Rational>toDecimal() 

pending… 
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit
to the URL. Here’s a list of current revisions for this page:
 Revision 1: published
 Revision 2: published
 Revision 3: published
 Revision 4: published
 Revision 5: published
 Revision 6: published
 Revision 7: published
 Revision 9: published
 Revision 10: published
 Revision 12: published
 Revision 14: published
 Revision 18: published
 Revision 21: published
 Revision 22: published
0 comments