diff options
author | SADAHIRO Tomoyuki <BQW10602@nifty.com> | 2007-01-10 08:39:42 +0900 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-01-10 13:17:37 +0000 |
commit | 4848a83b92f23f5ce46f82d3a4743a4c6dfbf2da (patch) | |
tree | efbad3860748cb82014bf2819e8b54f24ab93074 /pod/perlop.pod | |
parent | 017a05de2c6af847d65b8a8a506f2eb7d434ad53 (diff) | |
download | perl-4848a83b92f23f5ce46f82d3a4743a4c6dfbf2da.tar.gz |
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
Diffstat (limited to 'pod/perlop.pod')
-rw-r--r-- | pod/perlop.pod | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pod/perlop.pod b/pod/perlop.pod index cf36bf2248..46af19b230 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<abs($b)>) 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<UV_MAX> means the maximum of the unsigned integer type). +If the absolute value of the right operand (C<abs($b)>) 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<not> as the left operand C<$a> like C function C<fmod()>) +and the absolute value less than that of C<$b>. Note that when C<use integer> 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 |