Change 20169 by [EMAIL PROTECTED] on 2003/07/18 06:36:20 Subject: Re: [PATCH] Re: Oops - Can't calculate our powers From: Andreas J Koenig <[EMAIL PROTECTED]> Date: Fri, 18 Jul 2003 09:36:47 +0200 Message-ID: <[EMAIL PROTECTED]>
Affected files ... ... //depot/perl/t/op/pow.t#3 edit Differences ... ==== //depot/perl/t/op/pow.t#3 (text) ==== Index: perl/t/op/pow.t --- perl/t/op/pow.t#2~20167~ Thu Jul 17 23:14:33 2003 +++ perl/t/op/pow.t Thu Jul 17 23:36:20 2003 @@ -12,7 +12,13 @@ # 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]); +my @pow = ([3,30,1e-14], + [4,32,0], + [5,20,1e-14], + [2.5, 10,,1e-14], + [-2, 69,0], + [-3, 30,0], +); my $tests; $tests += $_->[1] foreach @pow; @@ -33,17 +39,17 @@ # 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 $exp = 2 ** $n; + my $pow = 2 ** $n; my $int = 1 << $n; - cmp_ok ($exp, '==', $int, "2 ** $n vs 1 << $n"); + cmp_ok ($pow, '==', $int, "2 ** $n vs 1 << $n"); } foreach my $pow (@pow) { my ($base, $max, $range) = @$pow; - my $fp = 1; + my $expect = 1; foreach my $n (0..$max-1) { - my $exp = $base ** $n; - within ($exp, $fp, $range, "$base ** $n [$exp] vs $base * $base * ..."); - $fp *= $base; + my $got = $base ** $n; + within ($got, $expect, $range, "$base ** $n got[$got] expect[$expect]"); + $expect *= $base; } } End of Patch.