3 ###############################################################################
12 unshift @INC, '../lib';
18 ###############################################################################
21 my $x = 5; ok (ref($x) =~ /^Math::BigInt/); # :constant
24 $x = 2 + 3.5; ok (ref($x),'Math::BigFloat');
26 $x = 2 + 2.1; ok (ref($x),'Math::BigFloat');
28 $x = 2 ** 255; ok (ref($x) =~ /^Math::BigInt/);
30 # see if Math::BigInt constant and upgrading works
31 ok (Math::BigInt::bsqrt('12'),'3.464101615137754587054892683011744733886');
32 ok (sqrt(12),'3.464101615137754587054892683011744733886');
34 ok (2/3,"0.6666666666666666666666666666666666666667");
36 #ok (2 ** 0.5, 'NaN'); # should be sqrt(2);
40 ok (12->bfac(),479001600);
42 # see if Math::BigFloat constant works
44 # 0123456789 0123456789 <- default 40
45 # 0123456789 0123456789
46 ok (1/3, '0.3333333333333333333333333333333333333333');
48 ###############################################################################
49 # accurarcy and precision
53 ok_undef ($Math::BigInt::accuracy);
54 ok_undef ($Math::BigInt::precision);
55 ok_undef ($Math::BigFloat::accuracy);
56 ok_undef ($Math::BigFloat::precision);
58 ok ($Math::BigInt::accuracy,5);
59 ok ($Math::BigFloat::accuracy,5);
60 bignum->precision(-2);
61 ok_undef ($Math::BigInt::accuracy);
62 ok_undef ($Math::BigFloat::accuracy);
63 ok ($Math::BigInt::precision,-2);
64 ok ($Math::BigFloat::precision,-2);
66 ###############################################################################
67 ###############################################################################
68 # Perl 5.005 does not like ok ($x,undef)
74 ok (1,1) and return if !defined $x;