This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade bignum from version 0.42 to 0.43
[perl5.git] / cpan / bignum / t / bigexp.t
CommitLineData
91f07087 1#!perl
bce28014
SP
2
3###############################################################################
4# test for bug #18025: bignum/bigrat can lead to a number that is both 1 and 0
5
bce28014 6use strict;
91f07087
SH
7use warnings;
8
5488a7f9 9use Test::More tests => 4;
bce28014
SP
10
11use bignum;
12
91f07087
SH
13my $ln_ev = -7 / (10 ** 17);
14my $ev = exp($ln_ev);
91f07087
SH
15is(sprintf('%0.5f', $ev), '1.00000', '($ev) is approx. 1');
16is(sprintf('%0.5f', 1 - $ev), '0.00000', '(1-$ev) is approx. 0');
17is(sprintf('%0.5f', 1 - "$ev"), '0.00000', '(1-"$ev") is approx. 0');
bce28014 18
91f07087 19cmp_ok($ev, '!=', 0, '$ev should not equal 0');