Bug #53934 [Ver->Nab]: The negative PHP_INT_MAX is incorrectly converted to float
| From: | ajf@php.net | Date: | Tue, 29 May 2018 12:20:17 +0000 |
| Subject: | Bug #53934 [Ver->Nab]: The negative PHP_INT_MAX is incorrectly converted to float | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-215412@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=53934&edit=1
ID: 53934
Updated by: ajf@php.net
Reported by: eriksen dot costa at infranology dot com dot br
Summary: The negative PHP_INT_MAX is incorrectly converted to
float
-Status: Verified
+Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: Linux
PHP Version: 5.3.5
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2018-05-29 12:18:49] spam2 at rhsoft dot net
come on, explain me why the large number becomes a float when we all known from hundrets of
bugrports that float values are making nothing than trouble swhen you touch or even echo them in
doubt
php > $x = 9223372036854775808;
php > echo is_float($x);
1
php > $x = 922337203685477;
php > echo is_float($x);
php > echo is_int($x);
1
------------------------------------------------------------------------
[2018-05-29 12:16:00] spam2 at rhsoft dot net
hell, there are a ton of problems - when a constant named with INT on a x86_64 fails is_int()
something is seriously broken - @cmb: as you can see with -100 the minus sign is not problem
PHP_INT_MIN and PHP_INT_MAX a *both float* which is wrong - period
php > $x = -100;
php > echo is_int($x);
1
php > $x = 9223372036854775808;
php > echo is_float($x);
1
php > echo is_int($x);
php >
php > echo PHP_INT_MAX;
9223372036854775807
php > echo PHP_INT_MIN;
-9223372036854775808
php > $x = -9223372036854775808;
php > echo is_int($x);
php > $x = 9223372036854775808;
php > echo is_int($x);
php > echo is_int(1);
1
php > $x = 1000;
php > echo is_int($x);
1
php >
------------------------------------------------------------------------
[2018-05-29 11:41:13] cmb@php.net
In my opinion, this is not a bug, but rather a documentation
issue. PHP (as many other languages, I believe) does not support
signed literals, but rather only unsigned literals plus the
identity and negation operators.
If we would introduce the notion of signed integer literals, there
would be a difference between
-9223372036854775808 and
0-9223372036854775808 â that's even more confusing.
------------------------------------------------------------------------
[2018-05-29 11:25:41] cmb@php.net
Related To: Bug #76385
------------------------------------------------------------------------
[2017-08-02 17:05:36] nikic@php.net
Related To: Bug #75026
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=53934
--
Edit this bug report at https://bugs.php.net/bug.php?id=53934&edit=1