|  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
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:
26 - 12 = ?
Subscribe to this entry?

 [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-2022 The PHP Group
All rights reserved.
Last updated: Mon Dec 05 02:05:52 2022 UTC