This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade Math::BigRat from version 0.25 to 0.26
[perl5.git] / cpan / Math-BigRat / t / bigratup.t
CommitLineData
990fb837
RGS
1#!/usr/bin/perl -w
2
12fc2493 3# Test whether $Math::BigInt::upgrade breaks our neck
990fb837 4
990fb837 5use strict;
c32198f6 6use Test::More tests => 5;
990fb837
RGS
7
8use Math::BigInt upgrade => 'Math::BigRat';
9use Math::BigRat;
10
11my $rat = 'Math::BigRat';
12my ($x,$y,$z);
13
14##############################################################################
15# bceil/bfloor
16
12fc2493
AMS
17$x = $rat->new('49/4'); is ($x->bfloor(),'12', 'floor(49/4)');
18$x = $rat->new('49/4'); is ($x->bceil(),'13', 'ceil(49/4)');
990fb837
RGS
19
20##############################################################################
21# bsqrt
22
12fc2493
AMS
23$x = $rat->new('144'); is ($x->bsqrt(),'12', 'bsqrt(144)');
24$x = $rat->new('144/16'); is ($x->bsqrt(),'3', 'bsqrt(144/16)');
25$x = $rat->new('1/3'); is ($x->bsqrt(),
26 '1000000000000000000000000000000000000000/1732050807568877293527446341505872366943',
27 'bsqrt(1/3)');
990fb837 28
12fc2493 29# all tests successfull
990fb837 30
12fc2493 311;
990fb837 32