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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Mar 29 13:01:29 2024 UTC