#45897 [Opn]: Invalid valid return for modulus

[email protected] ("hengkhee at gmail dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               45897
 User updated by:  hengkhee at gmail dot com
 Reported By:      hengkhee at gmail dot com
 Status:           Open
 Bug Type:         Math related
 Operating System: UBuntu 8.04, CentOS 5.0
-PHP Version:      5.2.6
+PHP Version:      5.2.4
 New Comment:

The php version on 

------------
Ubuntu 8.04:
------------
PHP 5.2.4-2ubuntu5.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 23
2008 06:46:18) 
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

------------
CentOS:
------------
PHP 5.2.6 (cli) (built: Jul 29 2008 20:48:49) 
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
    with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by
Zend Technologies
    with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend
Technologies


Previous Comments:
------------------------------------------------------------------------

[2008-08-23 13:09:02] hengkhee at gmail dot com

Description:
------------
- Modulus error, please refer to code.
- Using default package/installation from Ubuntu 8.04 Server/Desktop
and CentOS 5.0
- Using default php.ini from distro.

Reproduce code:
---------------
$var1 = 0.15 * 3 * 100;
echo ($var1 % 5);		# Output "4", unexpected result
echo ((0.15 * 3 * 100) % 5);	# Output "4", unexpected result
echo (45.00 % 5);		# Output "0", correct result
echo (45 % 5);			# Output "0", correct result
echo (($var1."") % 5);		# Output "0", correct result

Expected result:
----------------
Correct result = "0" for all above sample.

Actual result:
--------------
Please refer to above sample code.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45897&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.