Thank you for reporting this bug. We will make it our priority to review this report.
-
Sencha User
Ext.Number.toFixed is not stable
Repro is at https://fiddle.sencha.com/#fiddle/14m0
Ext version tested:
Browser versions tested against:
- Chrome Version 47.0.2526.111 m
Description:
- Ext.Number.toFixed wrongly relies on Chrome's native Number.prototype.toFixed, because Chrome's toFixed is buggy with (0.145).toFixed(2).
Steps to reproduce the problem:
- Evaluate Ext.Number.toFixed(0.145, 2) in Chrome
The result that was expected:
The result that occurs instead:
-
Sencha User
Perhaps the issue is related to the fact that as per standard (though weird), 0.145 * 100 results in 14.499999999999998 (in every browser). Though IE handles (0.145).toFixed(2) correctly, resulting "0.15".
-
Sencha User
A next layer of rounding seems to me solving the problem (in Ext.Number.toFixed):
(Math.round(Math.round(value * pow * 10) / 10) / pow).toFixed(precision)
-
Thanks for the report. We have an existing ticket for this issue (EXTJS-11494).