ID:               30655
 Updated by:       [EMAIL PROTECTED]
 Reported By:      shejan at web dot de
-Status:           Open
+Status:           Bogus
 Bug Type:         *General Issues
 Operating System: Linux/Windows
 PHP Version:      Irrelevant
 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.
 
Thank you for your interest in PHP.

.


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

[2004-11-02 09:31:30] shejan at web dot de

Description:
------------
mod (%) has problems with double.
with 2.01*100 mod isnt working
but 1.01*100 works fine.

chaning a double to int isnt working.
chaning a double to string and than int is working.

Reproduce code:
---------------
echo "201%100:  ".(201%100)."<br>"; // 1 (that is right)
echo "(2.01*100)%100:  ".((2.01*100)%100)."<br>"; // 0 (wrong)
echo "((int)(2.01*100))%100:  ".(((int)(2.01*100))%100)."<br>"; // 0
(wrong)
echo "((int)(string)(2.01*100))%100: 
".(((int)(string)(2.01*100))%100)."<br>"; // 1 (right)

Expected result:
----------------
201%100: 1
(2.01*100)%100: 0
((int)(2.01*100))%100: 0
((int)(string)(2.01*100))%100: 1



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


-- 
Edit this bug report at http://bugs.php.net/?id=30655&edit=1

Reply via email to