Revert change #30530, following Jan's advice
[p5sagit/p5-mst-13.2.git] / lib / bignum / t / bigexp.t
CommitLineData
bce28014 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
6use Test::More;
7use strict;
8
9BEGIN
10 {
11 $| = 1;
12 chdir 't' if -d 't';
13 unshift @INC, '../lib';
14 plan tests => 4;
15 }
16
17use bignum;
18
19my $lnev = -7 / (10**17);
20my $ev=exp($lnev);
21
22is( sprintf('%0.5f',$ev) , '1.00000', '($ev) is approx. 1' );
23is( sprintf('%0.5f',1-$ev) , '0.00000', '(1-$ev) is approx. 0' );
24is( sprintf('%0.5f',1-"$ev") , '0.00000', '(1-"$ev") is approx. 0' );
25
26cmp_ok( $ev, '!=', 0, '$ev should not equal 0');