diff options
author | Michal Čihař <michal@cihar.com> | 2016-08-30 16:45:53 +0300 |
---|---|---|
committer | Michal Čihař <michal@cihar.com> | 2016-08-30 16:51:18 +0300 |
commit | f3ca367efa5a44161ca6fa3a2a9fa3b9ed24cbb1 (patch) | |
tree | efc963ef6de45fffd15a0b81e4d284d40ceaf5f1 /test/bootstrap-dist.php | |
parent | f3babbb945ec54f55969e16191f3f2e9a13a2f74 (diff) |
Fix number formatting with different settings of precision in PHP
- fixed Util::formatNumber to avoid rounding issues to mess up display
- force precision = 14 to ensure we get sane behavior
With precision set to higher value many things do not behave as expected
producing strange numbers in various places.
For example with precision=19 you get:
php > echo round(1.2, 2);
1.199999999999999956
Fixes #12303
Signed-off-by: Michal Čihař <michal@cihar.com>
Diffstat (limited to 'test/bootstrap-dist.php')
-rw-r--r-- | test/bootstrap-dist.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/bootstrap-dist.php b/test/bootstrap-dist.php index 1b2e45059f..0188e49b05 100644 --- a/test/bootstrap-dist.php +++ b/test/bootstrap-dist.php @@ -6,6 +6,13 @@ * @package PhpMyAdmin-test */ +/** + * Set precision to sane value, with higher values + * things behave slightly unexpectedly, for example + * round(1.2, 2) returns 1.199999999999999956. + */ +ini_set('precision', 14); + // Let PHP complain about all errors error_reporting(E_ALL); |