php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44477 1990!=1990
Submitted: 2008-03-19 12:18 UTC Modified: 2008-03-19 12:26 UTC
From: ppalka3 at abacus dot pl Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.5 OS: linux
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: ppalka3 at abacus dot pl
New email:
PHP Version: OS:

 

 [2008-03-19 12:18 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-19 12:26 UTC] scottmac@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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 12:01:30 2024 UTC