php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28210 Erro in subtration
Submitted: 2004-04-28 21:11 UTC Modified: 2004-04-28 21:48 UTC
From: giucareca at brfree dot com dot br Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.4 OS: redhat
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: giucareca at brfree dot com dot br
New email:
PHP Version: OS:

 

 [2004-04-28 21:11 UTC] giucareca at brfree dot com dot br
Description:
------------
Error of expression

Reproduce code:
---------------
<?php
$j = (19.8 + 0.6) - 20.4; //try this expression
echo($j); //it's don't return 0.00;
?>

Expected result:
----------------
0

Actual result:
--------------
3.4556

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-28 21:48 UTC] derick@php.net
Floating point values have a limited precision. Hence a value might 
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly 
printing it without any mathematical operations.
 
Thank you for your interest in PHP.

.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sun Feb 15 10:00:01 2026 UTC