#47208 [NEW]: Converting Float/Double to Integer bug.
From: superdude at hotmail dot com
Operating system: win32/64 possibly others.
PHP version: 5.2.8
PHP Bug Type: Math related
Bug description: Converting Float/Double to Integer bug.
Description:
------------
When multiplying a float/double that the has value of 1.003, converting it
to a integer, will always return the expected value, minus 1.
Reproduce code:
---------------
<?php
$x = 1.003;
echo (int)($x*1000)."<br>\n";
echo (int)($x*10000)."<br>\n";
echo (int)($x*100000)."<br>\n";
?>
Expected result:
----------------
1003
10030
100300
Actual result:
--------------
1002
10029
100299
--
Edit bug report at http://bugs.php.net/?id=47208&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47208&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47208&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47208&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47208&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47208&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47208&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47208&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47208&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47208&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47208&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47208&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47208&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47208&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47208&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47208&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47208&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47208&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47208&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47208&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47208&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47208&r=mysqlcfg
Thread (2 messages)
- superdude at hotmail dot com