Bug #14244 Updated: A bug about integer operation "/"
| From: | poolshark at bmcc dot com dot cn | Date: | Thu, 29 Nov 2001 01:17:11 +0000 |
| Subject: | Bug #14244 Updated: A bug about integer operation "/" | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-71977@lists.php.net to get a copy of this message | ||
ID: 14244
User updated by: poolshark@bmcc.com.cn
Reported By: poolshark@bmcc.com.cn
Status: Bogus
Bug Type: Variables related
Operating System: linux
PHP Version: 4.0.6
New Comment:
************ Ignoring my bug report!!!! ***********
It is my wrong.
Previous Comments:
------------------------------------------------------------------------
[2001-11-27 04:11:08] cnewbill@php.net
Yes, did you read the part in ****? Obviously not.
****If either operand is a floating-point value, or the operation results in a non-integer value, a
floating-point value is returned.****
The operation 13/10 will result in 1.3 which is a float, so a floating point value is returned.
-Chris
------------------------------------------------------------------------
[2001-11-27 04:08:33] derick@php.net
Again:
****If either operand is a
floating-point value, or the operation results in a non-integer value, a
floating-point value is returned.****
The division returns a floatingpoint value.
------------------------------------------------------------------------
[2001-11-27 02:17:50] poolshark@bmcc.com.cn
Bug Database <php-dev@lists.php.net>
Did you see my program?,and dir you run them?
obviously, the two operands are ***integers ***.
------------------------------------------------------------------------
[2001-11-27 01:16:50] cnewbill@php.net
RTM http://www.php.net/manual/en/language.operators.php
"The division operator ("/") returns an integer value (the result of an integer
division) if the two operands are integers (or strings that get converted to integers) and the
quotient is an integer. ****If either operand is a floating-point value, or the operation results in
a non-integer value, a floating-point value is returned.****"
-Chris
------------------------------------------------------------------------
[2001-11-27 01:06:51] poolshark@bmcc.com.cn
Here is a short test program :
<?
#test.php of integer operation by /
$total=13;
printf ("total %d type %s<BR>",$total,gettype($total));
$each=10;
printf ("each %d type %s<BR>",$each,gettype($each));
$page=$total/$each;
print ("Page is $page");
?>
The output is 1.3
not as the expect 1
-----------------------------
configure command
./configure --with-apache=/home/zlq/bin/apache_1.3.22
--with-mysql=/mysql
--with-xml
--with-charset=gb2312
--disable-debug
--enable-ftp
-------------------------------
INIT_VERSION :sysinit-2.78
HOSTTYPE:i386
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14244&edit=1