rational vs float - subtract, multiply, add, divide
JavaScript performance comparison
Preparation code
<script src="//raw.github.com/acerix/rational.js/master/src/rat.js">
</script>
<script>
Benchmark.prototype.setup = function() {
var test_cases = [
[1, 11],
[3, 360],
[5411, 360],
[123, 360],
[171, 360],
[13, 23523],
[21, 666],
[65535, 666],
[-65537, 667]
];
var float_1 = 0.1;
var float_2 = 11.1;
var rat_1 = rat.fromValues(1, 10);
var rat_2 = rat.fromValues(111, 10);
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
native float approximation |
|
pending… |
rational.js calculation |
|
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
0 comments