|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14195 i think i found a bug in adding in PHP v4.0.5
Submitted: 2001-11-23 07:03 UTC Modified: 2001-11-23 07:12 UTC
From: kwysiadly at gddp dot szczecin dot pl Assigned:
Status: Not a bug Package: Math related
PHP Version: 4.0.5 OS: win98se
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
46 - 2 = ?
Subscribe to this entry?

 [2001-11-23 07:03 UTC] kwysiadly at gddp dot szczecin dot pl
$var = "2500";
$temp = "0.00";
$i = "1";
For ($i = 1; $i <= $var; $i++)
	$temp += 0.01;
	print ($i.") ".$temp."<br>");

i think i found a bug in adding in PHP v4.0.5
please, run this script above and take a look on lines from 444 to 1000 and then from 2111 to 2500 in your browser.

my system: win98se, php v4.0.5, Apache 1.3.19

sorry for my english.
best wishes.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-23 07:12 UTC]
Not a bug. This how floating point arithmetic works. PHP can't do anything about it.
On a computer, floating point numbers are stored as the 'best possible' representation of it, and this does not always match the exact number.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Nov 29 16:01:27 2023 UTC