Open parzhitsky opened 4 years ago
Due to specifics ot IEEE 754 standard (see https://0.30000000000000004.com), it is not that straightforward to implement ranges with non-integer arguments.
xrange(1, 0, -0.1); // expected: // (10) [ 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1 ] // actual: // (11) [ 1, 0.9, 0.8, 0.7000000000000001, 0.6000000000000001, 0.5000000000000001, 0.40000000000000013, 0.30000000000000016, 0.20000000000000015, 0.10000000000000014, 1.3877787807814457e-16 ]
Perhaps, use https://github.com/MikeMcl/decimal.js (although, only a couple of methods from there are really needed)?
The smaller fork of decimal.js is here, — decimal.js-tiny
decimal.js
decimal.js-tiny
Rescheduled to 2.2
Due to specifics ot IEEE 754 standard (see https://0.30000000000000004.com), it is not that straightforward to implement ranges with non-integer arguments.
Perhaps, use https://github.com/MikeMcl/decimal.js (although, only a couple of methods from there are really needed)?