php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28536 Invalid Calculation: 90.99-90.00 = 0.98999999999999 ... when it should be 0.99
Submitted: 2004-05-26 22:04 UTC Modified: 2004-05-26 22:06 UTC
From: hart0550 at umn dot edu Assigned:
Status: Not a bug Package: Math related
PHP Version: 4.3.4 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hart0550 at umn dot edu
New email:
PHP Version: OS:

 

 [2004-05-26 22:04 UTC] hart0550 at umn dot edu
Description:
------------
When calculating 90.99 minus 90.00 it returns 0.98999999999999 which is a bit big for a simple subtraction of two floats that only have 2 decimal numbers.

Reproduce code:
---------------
<?php

	$calc = 90.99 - 90.00;
	print $calc;

?>

Expected result:
----------------
.99

Actual result:
--------------
0.98999999999999

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-26 22:06 UTC] gschlossnagle@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

Welcome to the world of floating point numbers.  This is 
how it works.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC