This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade bignum from version 0.40 to 0.41
[perl5.git] / cpan / 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 strict;
7 use Test::More tests => 4;
8
9 use bignum;
10
11 my $lnev = -7 / (10**17);
12 my $ev=exp($lnev);
13
14 is( sprintf('%0.5f',$ev) , '1.00000', '($ev) is approx. 1' );
15 is( sprintf('%0.5f',1-$ev) , '0.00000', '(1-$ev) is approx. 0' );
16 is( sprintf('%0.5f',1-"$ev") , '0.00000', '(1-"$ev") is approx. 0' );
17
18 cmp_ok( $ev, '!=', 0, '$ev should not equal 0');