Bug #64425 [Opn->Nab]: Problem with intval function
Edit report at https://bugs.php.net/bug.php?id=64425&edit=1
ID: 64425
Updated by: laruence@php.net
Reported by: mszajner at rexoft dot pl
Summary: Problem with intval function
-Status: Open
+Status: Not a bug
Type: Bug
Package: Variables related
Operating System: Windows, Unix
PHP Version: 5.3.22
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
float are not accurate..
Previous Comments:
------------------------------------------------------------------------
[2013-03-14 09:17:11] mszajner at rexoft dot pl
Description:
------------
I try to convert double to int, but result is sometimes wrong.
Test script:
---------------
echo intval(5 * 4.02 * 100), " == 2009 - WRONG!\n";
echo intval(round(5 * 4.02, 2) * 100), " == 2010 - OK!\n";
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64425&edit=1
Thread (2 messages)