source: trunk/essentials/dev-lang/perl/lib/Math/BigRat/t/bigratup.t

Last change on this file was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 907 bytes
Line 
1#!/usr/bin/perl -w
2
3# Test whether $Math::BigInt::upgrade breaks our neck
4
5use Test::More;
6use strict;
7
8BEGIN
9 {
10 $| = 1;
11 chdir 't' if -d 't';
12 unshift @INC, '../lib';
13 plan tests => 5;
14 }
15
16use Math::BigInt upgrade => 'Math::BigRat';
17use Math::BigRat;
18
19my $rat = 'Math::BigRat';
20my ($x,$y,$z);
21
22##############################################################################
23# bceil/bfloor
24
25$x = $rat->new('49/4'); is ($x->bfloor(),'12', 'floor(49/4)');
26$x = $rat->new('49/4'); is ($x->bceil(),'13', 'ceil(49/4)');
27
28##############################################################################
29# bsqrt
30
31$x = $rat->new('144'); is ($x->bsqrt(),'12', 'bsqrt(144)');
32$x = $rat->new('144/16'); is ($x->bsqrt(),'3', 'bsqrt(144/16)');
33$x = $rat->new('1/3'); is ($x->bsqrt(),
34 '1000000000000000000000000000000000000000/1732050807568877293527446341505872366943',
35 'bsqrt(1/3)');
36
37# all tests successfull
38
391;
40
Note: See TracBrowser for help on using the repository browser.