ID:               36325
 Updated by:       [EMAIL PROTECTED]
 Reported By:      paul dot biggar at gmail dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: Ubuntu dapper (Linux 2.6.15)
 PHP Version:      Irrelevant
 New Comment:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation
better.


Previous Comments:
------------------------------------------------------------------------

[2006-02-07 21:55:37] paul dot biggar at gmail dot com

Description:
------------
This is related to bug 32211. The fix specified a documentation fix was
required. It seems that this should be fixed in the code base, so that
hexadecimal and decimal integers behave identically. Regardless, the
documentation doesn't completely describe the behaviour below.

Description:

The manual (http://ie2.php.net/int#language.types.integer.overflow)
implies that hexadecimal integers above 2147483647 do not get converted
to a float, but rather, are truncated to an int.

In actual fact, only numbers above 0x100000000 get truncated.
Hexadecimal numbers between 0x80000000 and 0xffffffff are converted to
floats, in the same way as if they had been specified in decimal.



Reproduce code:
---------------
        echo "\nHexdecimal ints near ULONG_MAX(truncated to
int(LONG_MAX) after ULONG_MAX)\n";
        echo "0xfffffffd\t= "; var_dump(0xfffffffd);
        echo "0xfffffffe\t= "; var_dump(0xfffffffe);
        echo "0xffffffff\t= "; var_dump(0xffffffff);
        echo "0x100000000\t= "; var_dump(0x100000000);
        echo "0x100000001\t= "; var_dump(0x100000001);
        echo "0x100000002\t= "; var_dump(0x100000002);

        echo "\nDecimal ints near ULONG_MAX(floats as far as the eye
can see)\n";
        echo "4294967293\t= "; var_dump(4294967293);
        echo "4294967294\t= "; var_dump(4294967294);
        echo "4294967295\t= "; var_dump(4294967295);
        echo "4294967296\t= "; var_dump(4294967296);
        echo "4294967297\t= "; var_dump(4294967297);
        echo "4294967298\t= "; var_dump(4294967298);


Expected result:
----------------
Hexdecimal ints near ULONG_MAX(truncated to int(LONG_MAX) after
ULONG_MAX)
0xfffffffd      = float(4294967293)
0xfffffffe      = float(4294967294)
0xffffffff      = float(4294967295)
0x100000000     = float(4294967296)
0x100000001     = float(4294967297)
0x100000002     = float(4294967298)

Decimal ints near ULONG_MAX(floats as far as the eye can see)
4294967293      = float(4294967293)
4294967294      = float(4294967294)
4294967295      = float(4294967295)
4294967296      = float(4294967296)
4294967297      = float(4294967297)
4294967298      = float(4294967298)

Actual result:
--------------
Hexdecimal ints near ULONG_MAX(truncated to int(LONG_MAX) after
ULONG_MAX)
0xfffffffd      = float(4294967293)
0xfffffffe      = float(4294967294)
0xffffffff      = float(4294967295)
0x100000000     = int(2147483647)
0x100000001     = int(2147483647)
0x100000002     = int(2147483647)

Decimal ints near ULONG_MAX(floats as far as the eye can see)
4294967293      = float(4294967293)
4294967294      = float(4294967294)
4294967295      = float(4294967295)
4294967296      = float(4294967296)
4294967297      = float(4294967297)
4294967298      = float(4294967298)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36325&edit=1

Reply via email to