Closed
Description
System information
Geth version: 1.6.5-stable
OS & Version: Linux
Expected behaviour
When this javascript is run in geth console:
floats = [0.82, 1.22, 0.54];
floats.sort(function (a,b) { console.log('comparing', a, b, a-b); return a-b; });
I expect to see these comparisons, and the sorted array:
comparing 0.82 1.22 -0.4
comparing 1.22 0.54 0.6799999999999999
comparing 0.82 0.54 0.2799999999999999
[0.54, 0.82, 1.22]
(this output is copied from the Chrome console, where it works as expected)
Actual behaviour
Instead, I see this modified array that is unsuccessfully sorted:
comparing 0.82 1.22 -0.4
comparing 0.54 1.22 -0.6799999999999999
[0.82, 0.54, 1.22]
Steps to reproduce the behaviour
geth &
geth attach
> floats = [0.82, 1.22, 0.54];
> floats.sort(function (a,b) { console.log('comparing', a, b, a-b); return a-b; });
Metadata
Metadata
Assignees
Labels
No labels