3 ###############################################################################
12 unshift @INC, '../lib';
16 use bigint qw/hex oct/;
18 ###############################################################################
41 my ($x,$y) = split /:/;
43 ok (bigint::_float_constant("$x"),"$y");
53 my ($x,$y) = split /:/;
55 ok (bigint::_binary_constant("$x"),"$y");
58 ###############################################################################
61 my $x = 5; ok (ref($x) =~ /^Math::BigInt/); # :constant
63 # todo: ok (2 + 2.5,4.5); # should still work
64 # todo: $x = 2 + 3.5; ok (ref($x),'Math::BigFloat');
66 $x = 2 ** 255; ok (ref($x) =~ /^Math::BigInt/);
68 ok (12->bfac(),479001600);
71 ok (4.5+4.5,8); # truncate
72 ok (ref(4.5+4.5) =~ /^Math::BigInt/);
75 ###############################################################################
76 # accurarcy and precision
78 ok_undef (bigint->accuracy());
79 ok (bigint->accuracy(12),12);
80 ok (bigint->accuracy(),12);
82 ok_undef (bigint->precision());
83 ok (bigint->precision(12),12);
84 ok (bigint->precision(),12);
86 ok (bigint->round_mode(),'even');
87 ok (bigint->round_mode('odd'),'odd');
88 ok (bigint->round_mode(),'odd');
90 ###############################################################################
93 my $c = 'Math::BigInt';
96 ok (ref(hex(0x1)), $c);
97 ok (ref(hex("af")), $c);
98 ok (hex("af"), Math::BigInt->new(0xaf));
99 ok (ref(hex("0x1")), $c);
101 ok (ref(oct("0x1")), $c);
102 ok (ref(oct("01")), $c);
103 ok (ref(oct("0b01")), $c);
104 ok (ref(oct("1")), $c);
105 ok (ref(oct(" 1")), $c);
106 ok (ref(oct(" 0x1")), $c);
108 ok (ref(oct(0x1)), $c);
109 ok (ref(oct(01)), $c);
110 ok (ref(oct(0b01)), $c);
111 ok (ref(oct(1)), $c);
113 ###############################################################################
114 ###############################################################################
115 # Perl 5.005 does not like ok ($x,undef)
121 ok (1,1) and return if !defined $x;