C:\_32>perl -wle "$m = (2**113) - 1; $n = 2; print $m % $n;"
0
####
C:\_32>perl -MPOSIX -wle "$m = (2**113) - 1; $n = 2; print fmod($m, $n);"
1
####
Binary "%" is the modulo operator, which computes the division remainder
of its first argument with respect to its second argument. Given integer
operands $m and $n: If $n is positive, then "$m % $n" is $m minus the
largest multiple of $n less than or equal to $m. If $n is negative, then
"$m % $n" is $m minus the smallest multiple of $n that is not less than
$m (that is, the result will be less than or equal to zero). If the
operands $m and $n are floating point values and the absolute value of
$n (that is "abs($n)") is less than "(UV_MAX + 1)", only the integer
portion of $m and $n will be used in the operation (Note: here "UV_MAX"
means the maximum of the unsigned integer type). If the absolute value
of the right operand ("abs($n)") is greater than or equal to
"(UV_MAX + 1)", "%" computes the floating-point remainder $r in the
equation "($r = $m - $i*$n)" where $i is a certain integer that makes $r
have the same sign as the right operand $n (not as the left operand $m
like C function "fmod()") and the absolute value less than that of $n.
Note that when "use integer" is in scope, "%" gives you direct access to
the modulo operator as implemented by your C compiler. This operator is
not as well defined for negative operands, but it will execute faster.
####
If $n is positive, then "$m % $n" is $m minus the largest multiple of $n less than or equal to $m.
....
If the operands $m and $n are floating point values and the absolute value of
$n (that is "abs($n)") is less than "(UV_MAX + 1)", only the integer
portion of $m and $n will be used in the operation (Note: here "UV_MAX"
means the maximum of the unsigned integer type)
####
C:\_32>perl -wle "$r = 10384593717069655257060992658440191.0 - (5192296858534827628530496329220095.0 * 2); print $r;"
1
####
C:\_32>perl -wle "$m = (2**113) - 1; $n = 2; print $m % $n;"
0
C:\_32>perl -MPOSIX -wle "$m = (2**113) - 1; $n = 2; print fmod($m, $n);"
1
####
C:\>perl -wle "$m = (2**64) - 1; $n = 2; print $m % $n;"
0
C:\>perl -MPOSIX -wle "$m = (2**64) - 1; $n = 2; print fmod($m, $n);"
1
####
C:\_32>perl -wle "$m = (2**53) - 1; $n = 2; print $m % $n;"
1
C:\_32>perl -MPOSIX -wle "$m = (2**53) - 1; $n = 2; print fmod($m, $n);"
1