#49187 [Opn]: Misbehaving function : intval ()

From: Date: Fri, 07 Aug 2009 05:51:09 +0000
Subject: #49187 [Opn]: Misbehaving function : intval ()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-140759@lists.php.net to get a copy of this message
ID: 49187 User updated by: belanger dot b at gmail dot com Reported By: belanger dot b at gmail dot com Status: Open Bug Type: *Math Functions Operating System: Linux PHP Version: 5.2.10 New Comment: Tested it with all values from previously rejected or ignored similar bug submissions (code and execution here) : http://www.benlg.com/test.php P.S.: intval('9.95'*100) == intval(9.95*100) == 994 Previous Comments: ------------------------------------------------------------------------ [2009-08-07 05:20:11] belanger dot b at gmail dot com Description: ------------ intval is not returning the correct value for '995' echo number_format('9.95'*100,0,'',''); // output 995 echo intval('9.95'*100); // output 994 Sorry but the most up to date server at my disposition is version 5.2.5 POSSIBLY RELATED REFUSED BUGS... found by me : http://bugs.php.net/bug.php?id=1960 (set to closed) found by system : http://bugs.php.net/bug.php?id=37554 (set to bogus) http://bugs.php.net/bug.php?id=39900 (set to bogus) Reproduce code: --------------- echo number_format('9.95'*100,0,'','') .' and '. number_format('1.16'*100,0,'','') ."\n". intval('9.95'*100); .' and '. intval('1.16'*100); Expected result: ---------------- 995 and 116 995 and 116 Actual result: -------------- 995 and 116 994 and 115 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49187&edit=1

« previous php.bugs (#140759) next »