#!./perl -w
# Now they'll be wanting biff! and zap! tests too.
BEGIN {
chdir 't' if -d 't';
}
# This calcualtion ought to be within 0.001 of the right answer.
# 3**30 < 2**48, don't trust things outside that range on a Cray
# Likewise other 3 should not overflow 48 bits if I did my sums right.
my @pow = ([ 3, 30, 1e-14],
[ 4, 32, 0],
[ 5, 20, 1e-14],
[2.5, 10, 1e-14],
[ -2, 69, 0],
[ -3, 30, 1e-14],
);
my $tests;
# (-3)**3 gave 27 instead of -27 before change #20167.
# Let's test the other similar edge cases, too.
# Positives shouldn't be a problem
# And test order of operations while we're at it
is(-3**0, -1);
is(-3**1, -3);
is(-3**2, -9);
is(-3**3, -27);
# Ought to be 32, 64, 36 or something like that.
# These are a lot of brute force tests to see how accurate $m ** $n is.
# Unfortunately rather a lot of perl programs expect 2 ** $n to be integer
# perfect, forgetting that it's a call to floating point pow() which never
# claims to deliver perfection.
foreach my $n (0..$bits_in_uv - 1) {
my $pow = 2 ** $n;
my $int = 1 << $n;
}
my $expect = 1;
}
}