#41240 [Bgs]: numbers bugs

From: Date: Mon, 30 Apr 2007 12:01:51 +0000
Subject: #41240 [Bgs]: numbers bugs
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112086@lists.php.net to get a copy of this message
ID: 41240 User updated by: webmaster at cashoclic dot fr Reported By: webmaster at cashoclic dot fr Status: Bogus Bug Type: *Math Functions Operating System: windowsxp PHP Version: 5.2.1 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2007-04-30 11:53:43] 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 11:50:10] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41240&edit=1

« previous php.bugs (#112086) next »