Home
last modified time | relevance | path

Searched refs:Math (Results 1 – 25 of 235) sorted by relevance

12345678910

/openbsd/src/gnu/usr.bin/perl/cpan/Math-BigInt/t/
Ddowngrade-mbi-mbr.t3 # Note that this does not test Math::BigRat upgrading.
10 use Math::BigInt upgrade => 'Math::BigRat';
11 use Math::BigRat downgrade => 'Math::BigInt';
13 is(Math::BigRat->downgrade(), 'Math::BigInt', 'Math::BigRat->downgrade()');
14 is(Math::BigInt->upgrade(), 'Math::BigRat', 'Math::BigInt->upgrade()');
25 $x = Math::BigRat -> new("0.5");
27 is(ref $x, "Math::BigRat", "Creating a 0.5 does not downgrade");
29 $x = Math::BigRat -> new("4");
31 is(ref $x, "Math::BigInt", "Creating a 4 downgrades to Math::BigInt");
33 $x = Math::BigRat -> new("0");
[all …]
Disa.t9 use Math::BigInt::Subclass;
10 use Math::BigFloat::Subclass;
11 use Math::BigFloat::BareSubclass;
12 use Math::BigInt;
13 use Math::BigFloat;
15 my $class = "Math::BigInt::Subclass";
16 my $LIB = "Math::BigInt::Calc";
18 # Check that a subclass is still considered a Math::BigInt
19 isa_ok($class->new(123), 'Math::BigInt');
21 # ditto for plain Math::BigInt
[all …]
Dupgrade2.t10 use Math::BigInt upgrade => 'Math::BigFloat';
11 use Math::BigFloat upgrade => 'Math::BigMouse';
14 @Math::BigMouse::ISA = 'Math::BigFloat';
15 sub Math::BigMouse::bsqrt {};
17 () = sqrt Math::BigInt->new(2);
20 # Math::BigRat inherits from Math::BigFloat, which inherits from Math::BigInt.
25 use Math::BigRat;
27 Math::BigFloat -> upgrade("Math::BigRat");
28 Math::BigFloat -> downgrade(undef);
30 Math::BigRat -> upgrade(undef);
[all …]
Ddowngrade-mbi-mbf.t3 # Note that this does not test Math::BigFloat upgrading.
10 use Math::BigInt upgrade => 'Math::BigFloat';
11 use Math::BigFloat downgrade => 'Math::BigInt';
13 is(Math::BigFloat->downgrade(), 'Math::BigInt', 'Math::BigFloat->downgrade()');
14 is(Math::BigInt->upgrade(), 'Math::BigFloat', 'Math::BigInt->upgrade()');
18 subtest 'Math::BigFloat->new("0.2E0")' => sub {
20 my $x = Math::BigFloat->new("0.2E0");
22 is(ref($x), "Math::BigFloat", '$x is a Math::BigFloat');
25 subtest 'Math::BigFloat->new("0.2E1")' => sub {
27 my $x = Math::BigFloat->new("2");
[all …]
Dbig_ap.t11 use Math::BigInt;
12 use Math::BigFloat;
13 use Math::BigRat;
15 my $proper = Math::BigRat -> new('12345678901234567890/2');
16 my $proper_inc = Math::BigRat -> new('12345678901234567890/2') -> binc();
17 my $proper_dec = Math::BigRat -> new('12345678901234567890/2') -> bdec();
18 my $proper_int = Math::BigInt -> new('12345678901234567890');
19 my $proper_float = Math::BigFloat -> new('12345678901234567890');
20 my $proper2 = Math::BigRat -> new('12345678901234567890');
22 Math::BigInt -> accuracy(3);
[all …]
Dbigintpm.t9 use Math::BigInt only => 'Calc';
12 $CLASS = "Math::BigInt";
13 $LIB = Math::BigInt -> config('lib'); # backend library
20 my $gcd0 = Math::BigInt::bgcd(-12, 18, 27);
21 isa_ok($gcd0, "Math::BigInt", "bgcd() as function");
24 my $gcd1 = Math::BigInt->bgcd(-12, 18, 27);
25 isa_ok($gcd1, "Math::BigInt", "bgcd() as class method");
28 $x = Math::BigInt -> new(-12);
30 isa_ok($gcd2, "Math::BigInt", "bgcd() as instance method");
37 my $lcm0 = Math::BigInt::blcm(-12, 18, 27);
[all …]
Dupgrade.t9 use Math::BigInt;
10 use Math::BigFloat;
12 my $x = Math::BigInt -> new(9);
13 my $y = Math::BigInt -> new(4);
19 is(ref($zi), "Math::BigInt", "9/4 gives a Math::BigInt without upgrading");
23 Math::BigInt -> upgrade("Math::BigFloat");
26 is(ref($zf), "Math::BigFloat", "9/4 gives a Math::BigFloat with upgrading");
31 $CLASS = "Math::BigInt";
32 $EXPECTED_CLASS = "Math::BigFloat";
33 $LIB = "Math::BigInt::Calc"; # backend
[all …]
Dbigfltpm.t9 use Math::BigInt only => 'Calc';
10 use Math::BigFloat;
13 $CLASS = "Math::BigFloat";
14 $LIB = Math::BigInt -> config('lib'); # backend library
19 # bug #17447: Can't call method Math::BigFloat->bsub, not a valid method
20 my $c = Math::BigFloat->new('123.3');
22 qq|\$c = Math::BigFloat -> new("123.3"); \$y = \$c -> bsub("123")|);
24 # Bug until Math::BigInt v1.86, the scale wasn't treated as a scalar:
25 $c = Math::BigFloat->new('0.008');
26 my $d = Math::BigFloat->new(3);
[all …]
Dmbimbf.t12 use Math::BigInt only => 'Calc';
13 use Math::BigFloat;
15 our $mbi = 'Math::BigInt';
16 our $mbf = 'Math::BigFloat';
21 # guaranteed in the Math::Big(Int|Float) (unless subclass chooses to support
24 Math::BigInt->round_mode("even"); # reset for tests
25 Math::BigFloat->round_mode("even"); # reset for tests
27 is($Math::BigInt::rnd_mode, "even", '$Math::BigInt::rnd_mode = "even"');
28 is($Math::BigFloat::rnd_mode, "even", '$Math::BigFloat::rnd_mode = "even"');
39 $x = eval '$Math::BigInt::rnd_mode = "huhmbi";';
[all …]
Dupgradef.t9 package Math::BigFloat::Test;
11 use Math::BigFloat;
13 our @ISA = qw/Math::BigFloat Exporter/;
19 return if $class =~ /^Math::Big(Int|Float$)/; # we aren't one of these
34 # use Math::BigInt upgrade => 'Math::BigFloat';
35 use Math::BigFloat upgrade => 'Math::BigFloat::Test';
40 $CLASS = "Math::BigFloat";
41 $EXPECTED_CLASS = "Math::BigFloat::Test";
42 $LIB = "Math::BigInt::Calc"; # backend
44 is(Math::BigFloat->upgrade(), $EXPECTED_CLASS,
[all …]
Dnew_overloaded.t3 # Math::BigFloat->new had a bug where it would assume any object is a
4 # Math::BigInt which broke overloaded non-Math::BigInt objects.
26 use Math::BigFloat;
31 my $bigfloat = Math::BigFloat->new($overloaded_num);
32 is($bigfloat, 2.23, 'Math::BigFloat->new() accepts overloaded numbers');
34 my $bigint = Math::BigInt->new(Overloaded::Num->new(3));
35 is($bigint, 3, 'Math::BigInt->new() accepts overloaded numbers');
37 is(Math::BigFloat->new($bigint), 3,
38 'Math::BigFloat->new() accepts a Math::BigInt');
Duse_mbfw.t3 # check that using Math::BigFloat with "with" and "lib" at the same time works
14 # completely, for instance, when it is a 100% replacement for Math::BigInt, but
17 # Math::BigFloat hands the lib properly down, any more is outside out testing
20 use Math::BigFloat with => 'Math::BigInt::Subclass',
23 is(Math::BigFloat->config("with"), 'Math::BigInt::BareCalc',
24 'Math::BigFloat->config("with")');
26 # is($Math::BigInt::Subclass::lib, 'BareCalc');
29 is(Math::BigInt->config("lib"), 'Math::BigInt::BareCalc',
30 'Math::BigInt->config("lib")');
Dwith_sub.t3 # Test use Math::BigFloat with => 'Math::BigInt::SomeSubclass';
11 use Math::BigFloat with => 'Math::BigInt::Subclass',
15 $CLASS = "Math::BigFloat";
16 $LIB = "Math::BigInt::Calc"; # backend
19 is(Math::BigFloat->config("with"), 'Math::BigInt::Calc',
20 qq|Math::BigFloat->config("with")|);
Dcalling-class-methods.t12 package Math::BigInt::Test;
14 use Math::BigInt;
15 our @ISA = qw/Math::BigInt/; # subclass of MBI
20 package Math::BigFloat::Test;
22 use Math::BigFloat;
23 our @ISA = qw/Math::BigFloat/; # subclass of MBI
30 use Math::BigInt try => 'Calc';
31 use Math::BigFloat;
54 Math::BigInt Math::BigFloat
55 Math::BigInt::Test Math::BigFloat::Test
Dcalling-instance-methods.t12 package Math::BigInt::Test;
14 use Math::BigInt;
15 our @ISA = qw/Math::BigInt/; # subclass of MBI
20 package Math::BigFloat::Test;
22 use Math::BigFloat;
23 our @ISA = qw/Math::BigFloat/; # subclass of MBI
30 use Math::BigInt try => 'Calc';
31 use Math::BigFloat;
54 Math::BigInt Math::BigFloat
55 Math::BigInt::Test Math::BigFloat::Test
/openbsd/src/gnu/usr.bin/perl/cpan/bignum/t/
Ddown-mbi-up-mbf.t10 is(bignum -> downgrade(), "Math::BigInt",
11 "bignum's downgrade class is Math::BigInt");
12 is(bignum -> upgrade(), "Math::BigFloat",
13 "bignum's upgrade class is Math::BigFloat");
15 is(Math::BigFloat -> downgrade(), "Math::BigInt",
16 "Math::BigFloat's downgrade class is Math::BigInt");
17 is(Math::BigInt -> upgrade(), "Math::BigFloat",
18 "Math::BigInt's upgrade class is Math::BigFloat");
25 is(ref($i1), "Math::BigInt", "literal $i1 is a Math::BigInt");
26 is(ref($f1), "Math::BigFloat", "literal $f1 is a Math::BigFloat");
[all …]
Ddown-mbi-up-mbr.t9 eval "use Math::BigRat";
10 plan skip_all => 'Math::BigRat required for these tests' if $@;
15 use bignum upgrade => "Math::BigRat";
17 is(bignum -> downgrade(), "Math::BigInt",
18 "bignum's upgrade class is Math::BigInt");
19 is(bignum -> upgrade(), "Math::BigRat",
20 "bignum's downgrade class is Math::BigInt");
22 is(Math::BigInt -> upgrade(), "Math::BigRat",
23 "Math::BigInt's upgrade class is Math::BigRat");
24 is(Math::BigRat -> downgrade(), "Math::BigInt",
[all …]
Dscope-nested-const.t17 is(ref(hex("1")), "Math::BigInt", 'ref(hex("1"))');
18 is(ref(oct("1")), "Math::BigInt", 'ref(oct("1"))');
23 is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))');
24 is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))');
29 is(ref(hex("1")), "Math::BigRat", 'ref(hex("1"))');
30 is(ref(oct("1")), "Math::BigRat", 'ref(oct("1"))');
38 is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))');
39 is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))');
47 is(ref(hex("1")), "Math::BigInt", 'ref(hex("1"))');
48 is(ref(oct("1")), "Math::BigInt", 'ref(oct("1"))');
[all …]
Dscope-nested-hex-oct.t17 is(ref(hex("1")), "Math::BigInt", 'ref(hex("1"))');
18 is(ref(oct("1")), "Math::BigInt", 'ref(oct("1"))');
23 is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))');
24 is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))');
29 is(ref(hex("1")), "Math::BigRat", 'ref(hex("1"))');
30 is(ref(oct("1")), "Math::BigRat", 'ref(oct("1"))');
38 is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))');
39 is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))');
47 is(ref(hex("1")), "Math::BigInt", 'ref(hex("1"))');
48 is(ref(oct("1")), "Math::BigInt", 'ref(oct("1"))');
[all …]
Dconst-bigfloat.t28 my $class = "Math::BigFloat";
32 # The following tests should be identical for Math::BigInt, Math::BigFloat and
33 # Math::BigRat.
39 is(ref($x), "Math::BigFloat",
40 "value is a Math::BigInt or Math::BigInt::Lite");
54 is(ref($x), "Math::BigFloat",
55 "value is a Math::BigInt or Math::BigInt::Lite");
65 is(ref($x), "Math::BigFloat",
66 "value is a Math::BigInt or Math::BigInt::Lite");
72 is(ref($x), "Math::BigFloat",
[all …]
Dconst-bignum.t28 my $class = "Math::BigFloat";
32 # The following tests should be identical for Math::BigInt, Math::BigFloat and
33 # Math::BigRat.
39 like(ref($x), qr/^Math::BigInt(::Lite)?$/,
40 "value is a Math::BigInt or Math::BigInt::Lite");
49 like(ref($x), qr/^Math::BigInt(::Lite)?$/,
50 "value is a Math::BigInt or Math::BigInt::Lite");
55 like(ref($x), qr/^Math::BigInt(::Lite)?$/,
56 "value is a Math::BigInt or Math::BigInt::Lite");
66 like(ref($x), qr/^Math::BigInt(::Lite)?$/,
[all …]
Ddown-mbi-up-undef.t9 eval "use Math::BigRat";
10 plan skip_all => 'Math::BigRat required for these tests' if $@;
17 is(bignum -> downgrade(), "Math::BigInt",
18 "bignum's upgrade class is Math::BigInt");
22 is(Math::BigInt -> upgrade(), undef,
23 "Math::BigInt's upgrade class is undefined");
24 is(Math::BigFloat -> downgrade(), "Math::BigInt",
25 "Math::BigFloat's downgrade class is Math::BigInt");
32 is(ref($i1), "Math::BigInt", "literal $i1 is a Math::BigInt");
33 is(ref($f1), "Math::BigFloat", "literal $f1 is a Math::BigFloat");
[all …]
Ddown-undef-up-mbf.t12 is(bignum -> upgrade(), "Math::BigFloat",
13 "bignum's upgrade class is Math::BigFloat");
15 is(Math::BigFloat -> downgrade(), undef,
16 "Math::BigFloat's downgrade class is undefined");
17 is(Math::BigInt -> upgrade(), "Math::BigFloat",
18 "Math::BigInt's upgrade class is Math::BigFloat");
25 is(ref($i1), "Math::BigInt", "literal $i1 is a Math::BigInt");
26 is(ref($f1), "Math::BigFloat", "literal $f1 is a Math::BigFloat");
28 # Verify that the result is upgraded to a Math::BigFloat.
31 is(ref($i1/$i2), "Math::BigFloat",
[all …]
Dconst-bigrat.t28 my $class = "Math::BigRat";
32 # The following tests should be identical for Math::BigInt, Math::BigFloat and
33 # Math::BigRat.
39 is(ref($x), "Math::BigRat", "value is a Math::BigRat");
53 is(ref($x), "Math::BigRat", "value is a Math::BigRat");
63 is(ref($x), "Math::BigRat", "value is a Math::BigRat");
69 is(ref($x), "Math::BigRat", "value is a Math::BigRat");
87 is(ref($x), "Math::BigRat", "value is a Math::BigRat");
93 is(ref($x), "Math::BigRat", "value is a Math::BigRat");
108 is(ref($x), "Math::BigRat", "value is a Math::BigRat");
[all …]
/openbsd/src/gnu/usr.bin/perl/cpan/Math-BigInt-FastCalc/t/
Dleak.t11 use Math::BigInt::FastCalc;
14 package Math::BigInt::FastCalc::LeakCheck;
16 use Math::BigInt::FastCalc;
17 our @ISA = qw< Math::BigInt::FastCalc >;
29 my $num = Math::BigInt::FastCalc::LeakCheck->$method();
30 bless $num, "Math::BigInt::FastCalc::LeakCheck";
35 my $num = Math::BigInt::FastCalc->_zero();
40 my $rc = Math::BigInt::FastCalc->$method($num);
41 bless \$rc, "Math::BigInt::FastCalc::LeakCheck";
46 my $num_10 = Math::BigInt::FastCalc->_ten();
[all …]

12345678910