php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41240 numbers bugs
Submitted: 2007-04-30 11:50 UTC Modified: 2007-04-30 12:01 UTC
From: webmaster at cashoclic dot fr Assigned:
Status: Not a bug Package: *Math Functions
PHP Version: 5.2.1 OS: windowsxp
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: webmaster at cashoclic dot fr
New email:
PHP Version: OS:

 

 [2007-04-30 11:50 UTC] webmaster at cashoclic dot fr
Description:
------------
100-99.99=0.0100005

Here is the bug
i don't understand why

Reproduce code:
---------------
echo 100-99.99;

Expected result:
----------------
0.01

Actual result:
--------------
0.0100005

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-30 11:53 UTC] bjori@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.

If you would like to know more about "floats" and what IEEE
754 is read this:
http://docs.sun.com/source/806-3568/ncg_goldberg.html
 
Thank you for your interest in PHP.


 [2007-04-30 12:01 UTC] webmaster at cashoclic dot fr
i'm french and i havent understand your message. what can i do for the problem ?
Because if i do $a=100
and $b=99.99
and $c=$a-$b
$c=0.0100005
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Nov 27 18:01:25 2020 UTC