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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC