From: SADAHIRO Tomoyuki Date: Tue, 9 Jan 2007 23:39:42 +0000 (+0900) Subject: Re: [perl #41215] % on scalars sometimes throws away fractions X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4848a83b92f23f5ce46f82d3a4743a4c6dfbf2da;p=p5sagit%2Fp5-mst-13.2.git Re: [perl #41215] % on scalars sometimes throws away fractions Message-Id: <20070109233928.07AF.BQW10602@nifty.com> plus nits by Dominic Dunlop p4raw-id: //depot/perl@29744 --- diff --git a/pod/perlop.pod b/pod/perlop.pod index cf36bf2..46af19b 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -266,8 +266,16 @@ C<$a> minus the largest multiple of C<$b> that is not greater than C<$a>. If C<$b> is negative, then C<$a % $b> is C<$a> minus the smallest multiple of C<$b> that is not less than C<$a> (i.e. the result will be less than or equal to zero). If the operands -C<$a> and C<$b> are floting point values, only the integer portion -of C<$a> and C<$b> will be used in the operation. +C<$a> and C<$b> are floating point values and the absolute value of +C<$b> (that is C) is less than C<(UV_MAX + 1)>, only +the integer portion of C<$a> and C<$b> will be used in the operation +(Note: here C means the maximum of the unsigned integer type). +If the absolute value of the right operand (C) is greater than +or equal to C<(UV_MAX + 1)>, "%" computes the floating-point remainder +C<$r> in the equation C<($r = $a - $i*$b)> where C<$i> is a certain +integer that makes C<$r> should have the same sign as the right operand +C<$b> (B as the left operand C<$a> like C function C) +and the absolute value less than that of C<$b>. Note that when C is in scope, "%" gives you direct access to the modulus operator as implemented by your C compiler. This operator is not as well defined for negative operands, but it will