php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15948 Basic Subtraction Error
Submitted: 2002-03-08 02:06 UTC Modified: 2002-03-08 02:36 UTC
From: abuckner at cicadadesign dot com Assigned:
Status: Not a bug Package: *Math Functions
PHP Version: 4.0.6 OS: Red Hat Linux 7.1
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: abuckner at cicadadesign dot com
New email:
PHP Version: OS:

 

 [2002-03-08 02:06 UTC] abuckner at cicadadesign dot com
This was submitted by one of our head developers.  We're using PHP/MySQL to build our customer relationship software, and this scares me.

-----------------------

The numbers should add to 0. When I echo the result I get the below:

-5.6843418860808E-14.

<?

echo 241.20 + 169.23 - 410.43;

?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-08 02:36 UTC] derick@php.net
This is actually not a bug, but a normal thing with floatingpoint numbers. If you want to do precise calculating, use cents, or decrease the precision in php.ini from 14 to something like 10.

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 18:01:31 2024 UTC