blob: 61d39b2b82fabe831518bceb83220cdd2c70bacc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#!perl
###############################################################################
# test for bug #18025: bignum/bigrat can lead to a number that is both 1 and 0
use strict;
use warnings;
use Test::More tests => 4;
use bignum;
my $ln_ev = -7 / (10 ** 17);
my $ev = exp($ln_ev);
is(sprintf('%0.5f', $ev), '1.00000', '($ev) is approx. 1');
is(sprintf('%0.5f', 1 - $ev), '0.00000', '(1-$ev) is approx. 0');
is(sprintf('%0.5f', 1 - "$ev"), '0.00000', '(1-"$ev") is approx. 0');
cmp_ok($ev, '!=', 0, '$ev should not equal 0');
|