Bug #55409 [NEW]: Casting floats containing an integer to ints gives wrong result
| From: | php-bugs at nickshanks dot com | Date: | Fri, 12 Aug 2011 07:48:19 +0000 |
| Subject: | Bug #55409 [NEW]: Casting floats containing an integer to ints gives wrong result | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-162536@lists.php.net to get a copy of this message | ||
From:
Operating system: Irrelevant
PHP version: Irrelevant
Package: Math related
Bug Type: Bug
Bug description:Casting floats containing an integer to ints gives wrong result
Description:
------------
Casting of certain floating-point values, containing just of an integer
component
and a zero fractional component, to an integer results in wrong value.
Test script:
---------------
echo '32.55' * 100;
echo "\n";
echo (int)('32.55' * 100);
Expected result:
----------------
3255
3255
Actual result:
--------------
3255
3254
--
Edit bug report at https://bugs.php.net/bug.php?id=55409&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55409&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55409&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55409&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=55409&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55409&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=55409&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=55409&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=55409&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=55409&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=55409&r=support
Expected behavior: https://bugs.php.net/fix.php?id=55409&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=55409&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=55409&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=55409&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55409&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55409&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=55409&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=55409&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=55409&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=55409&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=55409&r=mysqlcfg