php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25157 PHP miscalculates!
Submitted: 2003-08-19 15:14 UTC Modified: 2003-08-19 15:23 UTC
From: skaltura at czmb dot net Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: Irrelevant OS: Linux 2.4.20, Trusted Debian 1.0
Private report: No CVE-ID: None
 [2003-08-19 15:14 UTC] skaltura at czmb dot net
Description:
------------
PHP does an miscalculation,
ie. (584.04 / 2) / 3.14 is not same as 93 (that calculation returns 93)

Reproduce code:
---------------
<?
$a = 93;
$b = 93;
$c = 584.04;
$d = ($c / 2) / 3.14;
if ($a == $b) { echo "a and b matches!\n"; }
if ($d == $a) { echo "d and a matches!\n"; }
echo "a's value is $a AND d's value is $d";
?>


Expected result:
----------------
a and b matches!
d and a matches!
a's value is 93 AND d's value is 93

Actual result:
--------------
a and b matches!
a's value is 93 AND d's value is 93

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-19 15:23 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

read the manual on floats again
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 21:01:29 2024 UTC