#41714 [NEW]: Problem with intval()
From: bartlomiejbak at gmail dot com
Operating system: ubuntu
PHP version: 5.2.3
PHP Bug Type: *Math Functions
Bug description: Problem with intval()
Description:
------------
Hi. I've got a little bit problem
this code should show me result of equation 20x + 27y = 1
for ($y = 0; $y < 1000; $y++)
{
$x = (1/20) - (27/20) * $y;
if ($x == intval($x)) $out .= "x: $x,y: $y\n";
}
I need only int values of X and Y but intval() sometimes return wrong
value. Result should be (-4,3),(-31,23),(-58,43) etc. but php is starting
showing from (-31,23)...
--
Edit bug report at http://bugs.php.net/?id=41714&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41714&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41714&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41714&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41714&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41714&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41714&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41714&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41714&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41714&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41714&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41714&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41714&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41714&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41714&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41714&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41714&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41714&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41714&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41714&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41714&r=mysqlcfg
Thread (3 messages)
- bartlomiejbak at gmail dot com