10 unshift @INC, '../lib'; # for running manually
14 # testing of Math::BigRat
20 $x = Math::BigRat->new(1234); ok ($x,1234);
21 $x = Math::BigRat->new('1234/1'); ok ($x,1234);
22 $x = Math::BigRat->new('1234/2'); ok ($x,617);
24 $x = Math::BigRat->new('100/1.0'); ok ($x,100);
25 $x = Math::BigRat->new('10.0/1.0'); ok ($x,10);
26 $x = Math::BigRat->new('0.1/10'); ok ($x,'1/100');
27 $x = Math::BigRat->new('0.1/0.1'); ok ($x,'1');
28 $x = Math::BigRat->new('1e2/10'); ok ($x,10);
29 $x = Math::BigRat->new('1e2/1e1'); ok ($x,10);
30 $x = Math::BigRat->new('1 / 3'); ok ($x,'1/3');
31 $x = Math::BigRat->new('-1 / 3'); ok ($x,'-1/3');
32 $x = Math::BigRat->new('NaN'); ok ($x,'NaN');
33 $x = Math::BigRat->new('inf'); ok ($x,'inf');
34 $x = Math::BigRat->new('-inf'); ok ($x,'-inf');
35 $x = Math::BigRat->new('1/'); ok ($x,'NaN');
37 $x = Math::BigRat->new('1/4'); $y = Math::BigRat->new('1/3');
42 $x = Math::BigRat->new('7/5'); $x *= '3/2';
45 ok ($x,'2'); # not 21/10
47 $x = Math::BigRat->new('2/3'); $y = Math::BigRat->new('3/2');
52 $x = Math::BigRat->new('-2/3'); $y = Math::BigRat->new('3/2');
57 $x = Math::BigRat->new('-2/3'); $y = Math::BigRat->new('-2/3');
62 $x = Math::BigRat->new('-2/3'); $y = Math::BigRat->new('-1/3');
67 $x = Math::BigRat->new('-124'); $y = Math::BigRat->new('-122');
70 $x = Math::BigRat->new('-124'); $y = Math::BigRat->new('-122');
73 $x = Math::BigRat->new('-144/9'); $x->bsqrt(); ok ($x,'NaN');
74 $x = Math::BigRat->new('144/9'); $x->bsqrt(); ok ($x,'4');