Revert change #30530, following Jan's advice
[p5sagit/p5-mst-13.2.git] / lib / bignum / t / bigexp.t
1 #!/usr/bin/perl -w
2
3 ###############################################################################
4 # test for bug #18025: bignum/bigrat can lead to a number that is both 1 and 0
5
6 use Test::More;
7 use strict;
8
9 BEGIN
10   {
11   $| = 1;
12   chdir 't' if -d 't';
13   unshift @INC, '../lib';
14   plan tests => 4;
15   }
16
17 use bignum;
18
19 my $lnev = -7 / (10**17);
20 my $ev=exp($lnev);
21
22 is( sprintf('%0.5f',$ev) , '1.00000', '($ev) is approx. 1' );
23 is( sprintf('%0.5f',1-$ev) , '0.00000', '(1-$ev) is approx. 0' );
24 is( sprintf('%0.5f',1-"$ev") , '0.00000', '(1-"$ev") is approx. 0' );
25
26 cmp_ok( $ev, '!=', 0, '$ev should not equal 0');