home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / ntcode / ntperlb / t / lib / bigrat.nt < prev   
Encoding:
Text File  |  1995-05-19  |  956 b   |  19 lines

  1. print "1..11\n";
  2.  
  3. require 'bigrat.pl';
  4.  
  5. if (&rabs('1/0') eq 'NaN') {print "ok 1\n";} else {print "not ok 1\n";}
  6. if (&rneg('1/2') eq '-1/2') {print "ok 2\n";} else {print "not ok 2\n";}
  7. if (&rcmp('3/2', '6/4') == 0) {print "ok 3\n";} else {print "not ok 3\n";}
  8. if (&rcmp('1/2', '6/4') < 0) {print "ok 4\n";} else {print "not ok 4\n";}
  9. if (&rcmp('4/2', '6/4') > 0) {print "ok 5\n";} else {print "not ok 5\n";}
  10. if (&radd('1/2', '4/6') eq '+7/6') {print "ok 6\n";} else {print "not ok 6\n";}
  11. if (&rsub('7/6', '1/2') eq '+2/3') {print "ok 7\n";} else {print "not ok 7\n";}
  12. if (&rmul('7/6', '1/2') eq '+7/12') {print "ok 8\n";} else {print "not ok 8\n";}
  13. if (&rdiv('7/12', '1/2') eq '+7/6') {print "ok 9\n";} else {print "not ok 9\n";}
  14. ($int, $frac) = &rmod('2/3', '2/1');
  15. if (($int eq '+0/1') && ($frac eq '+2/3')) 
  16.     {print "ok 10\n";} else {print "not ok 10\n";}
  17.  
  18. if (&rnorm('12/24') eq '+1/2') {print "ok 11\n";} else {print "not ok 11\n";}
  19.