Bug #62170 [NEW]: Inaccurate division
From: cidahf at live dot co dot uk
Operating system: Ubuntu 12.04
PHP version: 5.4.3
Package: Math related
Bug Type: Bug
Bug description:Inaccurate division
Description:
------------
When I divide 25.4 by 10000 I get an awkward
0.002539999999999999723276911112179732299409806728363037109375 instead of
the
desired 0.00254. I tried the same with Ruby 1.8.7 and it returned the
correct
result.
This issue is problematic for unit conversion.
I also got this in 5.3 but I upgraded before making a report.
Test script:
---------------
echo 25.4 / 10000;
Expected result:
----------------
0.00254
Actual result:
--------------
0.002539999999999999723276911112179732299409806728363037109375
--
Edit bug report at https://bugs.php.net/bug.php?id=62170&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62170&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62170&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62170&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62170&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62170&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62170&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62170&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62170&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62170&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62170&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62170&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62170&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62170&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62170&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62170&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62170&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62170&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62170&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62170&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62170&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62170&r=mysqlcfg
Thread (5 messages)
- cidahf at live dot co dot uk