Bug #51320 [Opn]: Modulus Fails with the number 2.32

From: Date: Thu, 18 Mar 2010 09:55:21 +0000
Subject: Bug #51320 [Opn]: Modulus Fails with the number 2.32
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-148733@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51320&edit=1

 ID:               51320
 User updated by:  woody dot gilk at gmail dot com
 Reported by:      woody dot gilk at gmail dot com
 Summary:          Modulus Fails with the number 2.32
 Status:           Open
 Type:             Bug
 Package:          *General Issues
 Operating System: OSX, Linux
 PHP Version:      Irrelevant

 New Comment:

Sorry, the test script $number value should be "2.32" not "3.32", the
improper 
value of "31" is only reported for "2.32", no other numbers.


Previous Comments:
------------------------------------------------------------------------
[2010-03-18 10:53:26] woody dot gilk at gmail dot com

Description:
------------
Tested on the following PHP versions:

5.3.2 (OSX)
5.2.5 (Linux, Codepad.org)
5.2.4 (Ubuntu)

The following script improperly reports the modulus as "31" instead of
"32", but 
doesn't seem to happen with any other numbers.

Test script:
---------------
<?php

$number = 3.32; echo ($number * 100) % 100;

Expected result:
----------------
32

Actual result:
--------------
31


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



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


Thread (7 messages)

« previous php.bugs (#148733) next »