PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<floorgetrandmax>
Last updated: Mon, 16 Jul 2012

fmod

(PHP 4 >= 4.2.0, PHP 5)

fmod -- 返回除法的浮点数余数

说明

float fmod ( float x, float y )

返回被除数(x)除以除数(y)所得的浮点数余数。余数(r)的定义是:x = i * y + r,其中 i 是整数。如果 y 是非零值,则 rx 的符号相同并且其数量值小于 y

例子 1. 使用 fmod()

<?php
$x
= 5.7;
$y = 1.3;
$r = fmod($x, $y);
// $r equals 0.5, because 4 * 1.3 + 0.5 = 5.7
?>




<floorgetrandmax>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST