Do we know how to control precision on OS level? Or maybe there is another reason for the wrong values.
Tested with PHP 8.1.7 and 7.4. Sometimes processes get to 100% usage giving blank pages but dtrace show there is nothing happening. The problem does not exists on Freebsd 13.
Python 3.9 looks good:
Any ideas? Thanks.
Tested with PHP 8.1.7 and 7.4. Sometimes processes get to 100% usage giving blank pages but dtrace show there is nothing happening. The problem does not exists on Freebsd 13.
Code:
# php a.php
(object) array(
'a' => 0.01,
'b' => 0.02,
'c' => 0.029999999999999999,
'd' => 0.040000000000000001,
'e' => 0.050000000000000003,
'f' => 0.059999999999999998,
'g' => 0.070000000000000007,
'h' => 0.080000000000000002,
'i' => 0.089999999999999997,
'j' => 0.10000000000000001,
'k' => 0.11,
'l' => 0.12,
)
Code:
# php -v
PHP 8.1.7 (cli) (built: Jun 12 2022 00:24:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.7, Copyright (c) Zend Technologies
with Zend OPcache v8.1.7, Copyright (c), by Zend Technologies
PHP:
<?php
ini_set('precision', 0);
var_export(json_decode('{"a": 0.01, "b": 0.02, "c": 0.03, "d": 0.04, "e": 0.05, "f": 0.06, "g": 0.07, "h": 0.08, "i": 0.09, "j": 0.10, "k": 0.11, "l": 0.12}'));
Python 3.9 looks good:
Python:
Python 3.9.13 (main, May 22 2022, 13:55:38)
[Clang 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a on freebsd13
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> print(json.dumps({"a": 0.01, "b": 0.02, "c": 0.03, "d": 0.04, "e": 0.05, "f": 0.06, "g": 0.07, "h": 0.08, "i": 0.09, "j": 0.10, "k": 0.11, "l": 0.12}, sort_keys=True, indent=4))
{
"a": 0.01,
"b": 0.02,
"c": 0.03,
"d": 0.04,
"e": 0.05,
"f": 0.06,
"g": 0.07,
"h": 0.08,
"i": 0.09,
"j": 0.1,
"k": 0.11,
"l": 0.12
}