different behaviour converting float to integer
| From: | Tomas Kuliavas | Date: | Mon, 04 Oct 2004 07:26:31 +0000 |
| Subject: | different behaviour converting float to integer | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-198578@lists.php.net to get a copy of this message | ||
When php 5.0.2 converts float to integer, it uses biggest possible integer
value. Other php versions overflow and use negalive integers.
How to reproduce it:
echo (int)0xde120495;
Expected result (php 5.0.1, 4.3.9 and 4.1.2):
----------------
-569244523
Actual result (only php 5.0.2):
--------------
2147483647
Is this a standard behaviour of all future php versions or some error in php?
OS details: Linux Debian Sarge
PHP compilation details (vanilla php-5.0.2.tar.bz2):
./configure --disable-debug --with-apxs=/somepath/apache/bin/apxs
--prefix=/somepath/php
--with-config-file-path=/somepath/
--with-pcre-regex --enable-mbstring --enable-session --disable-all
--with-gettext=shared,/usr
php.ini details:
error_reporting=E_ALL
display_errors=on
register_globals=off
asp_tags=on
short_tags=off
Please CC to my email.
--
Tomas