Bug #53972 [NEW]: Operator Type Casting Issue
| From: | thipse_rahul at rediffmail dot com | Date: | Wed, 09 Feb 2011 12:56:32 +0000 |
| Subject: | Bug #53972 [NEW]: Operator Type Casting Issue | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-158648@lists.php.net to get a copy of this message | ||
From:
Operating system: Linux/Windows
PHP version: 5.3.5
Package: *General Issues
Bug Type: Bug
Bug description:Operator Type Casting Issue
Description:
------------
Following code snippet --
Case 1:
$a = (int)((0.1+0.7) * 10); echo $a; // Result: 7 (Wrong) should give 8
Case 2:
$a = (int)((0.1+0.6) * 10); echo $a; // Result: 7
Case 3:
$a = (int)((0.1+0.8) * 10); echo $a; // Result: 9
Test script:
---------------
$a = (int)((0.1+0.7) * 10);
echo $a;
Expected result:
----------------
8
Actual result:
--------------
7
--
Edit bug report at http://bugs.php.net/bug.php?id=53972&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53972&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53972&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53972&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53972&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53972&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53972&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53972&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53972&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53972&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53972&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53972&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53972&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53972&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53972&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53972&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53972&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53972&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53972&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53972&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53972&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53972&r=mysqlcfg