|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9692 Subtraction result below 100 yields wrong decimal output
Submitted: 2001-03-12 00:41 UTC Modified: 2001-03-12 16:40 UTC
From: bhavint at directi dot com Assigned:
Status: Closed Package: Math related
PHP Version: 4.0.4pl1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: bhavint at directi dot com
New email:
PHP Version: OS:


 [2001-03-12 00:41 UTC] bhavint at directi dot com
Please check

In case (1) I subtract a number from another which should output '0.9' but insted outputs '0.90000000000009'

In case (2) I subtract a number from another and it gives correct output

This behaviour has been noticed if the result of the subtraction is greater than 100. I have also published my PHPINFO output on the same page for your reference.

This bug is quite dangerous (especially for us when we are dealing with financial calculations for our payment gateway using PHP) since all our reports dont tally at the end of the day by tiny figures such as this.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-12 00:45 UTC]
Check the last comment on bug: #9288


 [2001-03-12 01:12 UTC] bhavint at directi dot com
i dont think thats the same is it. Because all I am doing is a simple subtraction operation. 

Additionally the output comes perfect if the result is greater than 100 but does not come perfect if the output is lesser than 100
 [2001-03-12 16:40 UTC]
Yes it is. 
This bug report is about the same 'problem': #8164
And it has an url to a page that explains this better
than I can. :)

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 14:01:32 2024 UTC