note 120130 deleted from reserved.constants by cmb
| From: | cmb@php.net | Date: | Tue, 08 Nov 2016 16:17:41 +0000 |
| Subject: | note 120130 deleted from reserved.constants by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207052@lists.php.net to get a copy of this message | ||
Note Submitter: jean-francois dot courteau at nexcess dot ca
----
I discovered that, at least on my setup, the highest precise integer that can be precisely
represented is different than the value of PHP_INT_MAX.
On my WAMP setup (W2K12R2x64, Apache 2.4, PHP 7.x), PHP INT_MAX is 9,223,372,036,854,775,807, but
the true highest precise integer I could represent is 9,007,199,254,740,991 (2^53-1). I discovered
it manually, at first because I wondered why my integers were rounded at even values. Testing
manually where rounding stops, when I discovered the value, I searched for it on Google, just to
find out it was also the "max_safe_integer" value in Javascript.
Don't know the exact relation, but since I needed exact values, I limited my script's
input values to 2^53-1 instead of PHP_INT_MAX.
If it can be useful to someone else...