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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 05:01:30 2024 UTC