#38548 [Opn->Bgs]: intval rounds to nearest int
| From: | tony2001@php.net | Date: | Tue, 22 Aug 2006 17:52:04 +0000 |
| Subject: | #38548 [Opn->Bgs]: intval rounds to nearest int | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-101135@lists.php.net to get a copy of this message | ||
ID: 38548
Updated by: tony2001@php.net
Reported By: tstarling at wikimedia dot org
-Status: Open
+Status: Bogus
Bug Type: Math related
Operating System: Linux
PHP Version: 4.4.4
New Comment:
>Perhaps someone here has an idea about how to reproduce it?
I guess you should ask the person who originally reported it.
Previous Comments:
------------------------------------------------------------------------
[2006-08-22 17:51:00] tstarling at wikimedia dot org
I couldn't confirm this personally, I tried a new build of 4.4.3 and
4.4.4 on linux, but didn't see the bug on either. Perhaps someone here
has an idea about how to reproduce it?
------------------------------------------------------------------------
[2006-08-22 17:50:43] tony2001@php.net
# php -r 'var_dump(intval(0.9));'
int(0)
# php -v
PHP 4.4.5-dev (cli) (built: Aug 22 2006 21:48:33) (DEBUG)
Same result with 4.4.4, 4.4.3 and others.
Obviously such change could not happen, 'cause it would break lots of
tests.
------------------------------------------------------------------------
[2006-08-22 17:25:29] tstarling at wikimedia dot org
Description:
------------
We have a report on http://bugzilla.wikimedia.org/show_bug.cgi?id=7013
that in PHP 4.4.3 on linux, integer conversion rounds to the nearest
integer. This is a change from the previous behaviour, according to the
manual and in previous versions of PHP, integer conversion rounds down.
I don't see anything about this in the changelog, so I'm assuming the
problem persists in 4.4.4.
Reproduce code:
---------------
intval(0.99)
Expected result:
----------------
0
Actual result:
--------------
1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38548&edit=1