From:             hengkhee at gmail dot com
Operating system: UBuntu 8.04, CentOS 5.0
PHP version:      5.2.6
PHP Bug Type:     Math related
Bug description:  Invalid valid return for modulus

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 bug report at http://bugs.php.net/?id=45897&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45897&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45897&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45897&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45897&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45897&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45897&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45897&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45897&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45897&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45897&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45897&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45897&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45897&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45897&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45897&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45897&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45897&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45897&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45897&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45897&r=mysqlcfg

Reply via email to