php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44088 dividing float values gives irrational results
Submitted: 2008-02-10 03:07 UTC Modified: 2008-02-10 05:18 UTC
From: hosting at indiannic dot com Assigned:
Status: Not a bug Package: Math related
PHP Version: 5.2CVS-2008-02-10 (CVS) OS: windows 2000
Private report: No CVE-ID: None
 [2008-02-10 03:07 UTC] hosting at indiannic dot com
Description:
------------
os : windows 2000, iis 5 upto date with will microsoft patches
we have two independent websites each using two versions of php on the same server

same sample php code as given below placed on each website
http://maptelltrack.com/divide.php (php 4.3.10 gives wrong results)
http://maptell.com/divide.php (php 5.2.6 gives correct results)

php 4.3.10 gives correct results and php5.2.5 gives Wrong results for the same php code on the web server

php info file for each website

http://maptelltrack.com/info.php (php 5.2.5) using php-cgi.exe
(we have tried all versions upto php5.2-win32-latest)

http://maptell.com/info.php (php 4.3.10) using php.exe

Please do not try the same with command line since the results are different.

Reproduce code:
---------------
<?php
$test = var_dump (46985.532 / 3600) ;
echo($test);
?>


Expected result:
----------------
float(13.0515366667)

Actual result:
--------------
float(10)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-10 05:18 UTC] rasmus@php.net
Your "precision" .ini setting is set to F14 which makes no sense and will mess up the precision of floating point operations.  If you are going to report bugs like this comparing two versions, please use the same .ini parameters.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun May 11 07:01:28 2025 UTC