in reply to Test modulus zero in bigint
use warnings FATAL => qw(all); use strict; use Data::Dump qw(dump); use bigint; say STDERR "AAAA ", (1 % 0); # Should fail say STDERR "BBBB ", dump(1 % 0); if (1) {use Math::BigInt; my $a = Math::BigInt::new(1); my $b = Math::BigInt::new(0); my $c = $a->bmod($b); say STDERR "CCCC ", $c; say STDERR "DDDD ", dump($c); } # AAAA 1 # BBBB bless({ _a => undef, _p => undef, sign => "+", value => [1] }, +"Math::BigInt") # CCCC NaN # DDDD bless({ sign => NaN, value => [0] }, "Math::BigInt")
The crucial diffrence is between AAAA and CCCC.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Test modulus zero in bigint
by Anonymous Monk on Sep 12, 2016 at 00:51 UTC | |
by Anonymous Monk on Sep 12, 2016 at 01:17 UTC |