Home > Backend Development > PHP Tutorial > 关于浮点取模的一个有关问题

关于浮点取模的一个有关问题

WBOY
Release: 2016-06-13 12:30:10
Original
1044 people have browsed it

求助:关于浮点取模的一个问题
在书上看的一个例程

<?php<br />
$a=5;<br />
$b=3;<br />
echo $a/$b%$b;<br />
?>
Copy after login


上案例取模的结果为1。

以下为个人理解,但不敢肯定,请大神给予解答。
$a/$b得到一个浮点数做为被除数再与做为除数的%b进行取模,当被除数是浮点型且小于除数时,所取模不足1时,是不是把小数点后面的第一位自动进1,且不按四舍五入的原则?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template