#44477 [Opn->Bgs]: 1990!=1990
| From: | scottmac@php.net | Date: | Wed, 19 Mar 2008 12:26:02 +0000 |
| Subject: | #44477 [Opn->Bgs]: 1990!=1990 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-123463@lists.php.net to get a copy of this message | ||
ID: 44477
Updated by: scottmac@php.net
Reported By: ppalka3 at abacus dot pl
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: linux
PHP Version: 5.2.5
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2008-03-19 12:18:42] ppalka3 at abacus dot pl
Description:
------------
PHP Version 5.2.4
System Linux test2 2.6.19 #7 SMP PREEMPT Sun Dec 17 22:01:07 CET 2006
i686
Build Date Oct 16 2007 15:19:41
Configure Command './configure' '--prefix=/usr/PHP5'
'--with-config-file-path=/usr/PHP5' '--sysconfdir=/usr/PHP5'
'--enable-track-vars' '--with-libxml-dir=/usr/include/libxml2'
'--with-xml' '--enable-xslt' '--with-mysql=/usr/MYSQL_5.0.45'
'--with-mysql-sock=/tmp/mysql.sock' '--with-iconv'
'--with-jpeg-dir=/usr/lib/' '--enable-mbstring' '--enable-ftp'
'--with-gd' '--with-zlib' '--with-gettext'
'--enable-safe-mode'
'--with-curl=/usr/local/include/curl' '--with-apxs=/usr/Apache/bin/apxs'
'--with-mcrypt' '--with-imap=/usr/local/src/imap-2006k/'
'--without-krb5'
Reproduce code:
---------------
$pay=19.90;
$pay_grosze=$pay*100;
$zaplacono=1990;
if($zaplacono!=$pay_grosze)
{
echo $zaplacono."!=".$pay_grosze;
}else
{
echo $zaplacono."=".$pay_grosze;
}
Expected result:
----------------
1990=1990
Actual result:
--------------
1990!=1990
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44477&edit=1