The following pir program:
.sub test @MAIN
$I1 = mod 3, 3
print "3 mod 3 = "
print $I1
print "\n"
$I1 = mod -3, 3
print "-3 mod 3 = "
print $I1
print "\n"
$I1 = mod 3, -3
print "3 mod -3 = "
print $I1
print "\n"
$I1 = mod -3, -3
print "-3 mod -3 = "
print $I1
print "\n"
end
.end
...prints this:
3 mod 3 = 0
-3 mod 3 = 3
3 mod -3 = -3
-3 mod -3 = 0
...but I believe it should print this:
3 mod 3 = 0
-3 mod 3 = 0
3 mod -3 = 0
-3 mod -3 = 0
...according to the documentation at
http://www.parrotcode.org/docs/ops/math.html
and according to this discussion from 2001:
http://www.nntp.perl.org/group/perl.perl6.internals/5496
Regards,
Roger Browne
ro...@eiffel.demon.co.uk
> The following pir program:
[ ... ]
> ...but I believe it should print this:
>
> 3 mod 3 = 0
> -3 mod 3 = 0
> 3 mod -3 = 0
> -3 mod -3 = 0
IMHO too. I've updated intval_mod to consider the case of zero reminder
with negative args (rev 8178).
Thanks for testing,
leo