#38548 [Opn->Bgs]: intval rounds to nearest int

From: Date: Tue, 22 Aug 2006 17:50:43 +0000
Subject: #38548 [Opn->Bgs]: intval rounds to nearest int
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-101133@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: # 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#101133) next »