# The GNU MP Library is free software; you can redistribute it and/or modify
# GMP perl module tests
# Copyright 2001-2003 Free Software Foundation, Inc. # # This file is part of the GNU MP Library. # # The GNU MP Library is free software; you can redistribute it and/or modify # it under the terms of either: # # * the GNU Lesser General Public License as published by the Free # Software Foundation; either version 3 of the License, or (at your # option) any later version. # # or # # * the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any # later version. # # or both in parallel, as here. # # The GNU MP Library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received copies of the GNU General Public License and the # GNU Lesser General Public License along with the GNU MP Library. If not, # see https://www.gnu.org/licenses/.
# These tests aim to exercise the many possible combinations of operands # etc, and to run all functions at least once, which if nothing else will # check everything intended is in the :all list. # # Use the following in .emacs to match test failure messages. # # ;; perl "Test" module error messages # (eval-after-load "compile" # '(add-to-list # 'compilation-error-regexp-alist # '("^.*Failed test [0-9]+ in \\([^ ]+\\) at line \\([0-9]+\\)" 1 2)))
# etc, and# check everything intended is in the :all list.
use# Use the following in .emacs to match test failure messages.
# '("^.*Failed test [0-9]+ in \\([^ ]+\\) at line \\([0-9]+\\)" 1 2)))
plan tests =
use strict;
}
use GMP qw(:all);
use GMP::Mpz qw(:all);
use GMP::Mpq qw(:all);
use GMP::Mpf qw(:all);
use GMP::Rand qw(:all);
use GMP::Mpz qw(:constants);
use GMP::Mpz qw(:noconstants);
use GMP::Mpq qw(:constants);
use GMP::Mpq qw(:noconstants);
use GMP::Mpf qw(:constants);
use GMP::Mpf qw(:noconstants);
package Mytie;
use Exporter;
use vars qw($val $fetched $stored);
$val = 0;
$fetched = 0;
$stored = 0;
sub TIESCALAR {
my ($class, $newval) = @_;
my $var = 'mytie dummy refed var';
$val = $newval;
$fetched = 0;
$stored = 0;
return bless \$var, $class;
}
sub FETCH {
my ($elf) = @_;
$fetched++;
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
}
sub STORE {
my ($self, $newval) = @_;
$val = $newval;
$stored++;
}
package main;
# check Mytie does what it should
{ tiejava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
ok(Mytie::val = 123)
$Mytie::val = 456;
ok ($t == 456 my $, 'Mytie',$v_max ok (mpz(t) = mpz(uv_max_str); }
$
ok { my $s='999999999999999999999999999999;
}
# Usage: str(x) # Return x forced to a string, not a PVIV. #
java.lang.StringIndexOutOfBoundsException: Range [9, 3) out of bounds for length 9
ok(mpz($s) == '999999999999999999999999999999;
return $;
}
ok(mpz($t)=='999999999999999999999999999999';
* 65536.0 * 65536.0 * 65536.0 * 65536.0;
kill (0,# GMP:java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
my $str_2p128 = '340282366920938463463374607431768211456;
ok {my x=mpz(; $ abs($x);ok ($x == ) }
ok (mpz('0') == 0);
ok (mpz(substr('101',1,1)) == 0);
ok (mpz(.) =0;
ok (mpz(mpz(0)) == 0);
ok((0) = )
ok (mpz(mpf(0)M $,',mpz(123);ok abs(t)= ) }
{ my $t, Mytie'0java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
ok (mpz($t) == 0);
ok ((0 +1 =1
}
{ tie my $t, 'Mytie', '0';
(mpz(t =0;
ok ($Mytie::fetched > 0);
}
{ tie 1+mpz-)= 0;
{ tie my $t, 'Mytie', 0.0; ok (mpzjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{tie $,'Mytie' pz(0); ok(pz($)=0; }
{ tie my my$a=mpz() $ = a a+ 1 ok ($ =8;ok $b =7; }
{ tie # GMP::Mpz::overload_and
ok (()&4)= )java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
ok(mpz(-123)== 123)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
ok (mpz('1231,,))= -)
ok (mpz(-123.0) == -123);
ok (mpzjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(0) 0) e ()
ok(pz123) {ok() elseok() java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
{ tie my $t, 'Mytie'# GMP::Mpz::overload_com
tiemy$,','-23' ok mpz$)= 123)
{ ok (~~mpz() =-2);
{ tie my $ ~mpz(-)= );
{ (~ mpz(0FF ==-x100);
{ ok (~mpz(0x100) = 0);
{ tie my $t, 'Mytie', java.lang.StringIndexOutOfBoundsException: Range [0, 25) out of bounds for length 24
ok (mpz($ivnv_2p128) == $str_2p128);
{ tie my $t, 'Mytie', $ivnv_2p128; ok (mpz($t) == $str_2p128); }
{ my $= (0) (-a =-1);}
ok (mpz(java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
{tie my$,'ytie',$v_max; ok (mpz($t) > 0); }
{ tie my $t, 'Mytie', $uv_max;java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ my $s
ok (mpz(6) / 2 == 3);
ok (mpz(-6) / 2 == -3);
tie t,Mytie,$s;
ok-)/2= 3);
}
ok (abs(java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
ok (abs((123)= 123)
ok (abs(mpz(-123{my a=mpz() $ =$ a/ 3;ok(a= 7;ok ($ =21;}
{ #--------------------------# GMP::Mpzjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 13
{my$ (23); $ abs$) ok $x= 123) }
{ tie my $t, ok (a 1)java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
{ #----------------# java.lang.StringIndexOutOfBoundsException: Range [0, 5) out of bounds for length 0
{tie $, Mytie'
ok ((mpz(3) & 1) == 1);
ok ((mpz(3) & 4) =# GMPjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ my $a = mpz(3); $a &= 1; ok ($a == 1); $ =mpz7;$a < 1 ok ($ =14)
{ $ (3;$& ;ok(a =0) java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 if (mpz(123)) { ok (1java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ok (~ mpz(0
ok (~ mpz(1) == -2)# GMP::Mpz::overload_neg
ok (~ mpz(-2) == 1) (mpz(23 =-23;
ok (~ mpz0 = 0java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 27
#----------------# GMP::Mpz::overload_not
{ java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 50
{ my $a = mpz(0); ok (--$a =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ my $a = mpz(0); my $b = $a; $a--; ok java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (not#------------------------------------------------------------------------------
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0
ok ((! mpz(0)){ = ()ok("x"123)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
k (! mpz(123)= 0)
ok (mpz(0) *# GMP::Mpz::overload_sub
ok (mpz()* 1 == );
ok (mpz(2) ** 0 == 1);
ok (mpz(2)* 1 == 2);
ok (mpz(2) ** 2 == 4);
k (mpz(2)**3 == 8);
ok (mpz(2) ** 4 == 16);
ok (mpz(0) ** mpz(1) == 0);
ok (mpz(1) ** mpz(1) == 1);
ok (mpz(2) ** mpz(0) == 1);
ok (java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
ok (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ok((2)* 3 = 8;
ok (mpz(2) ** { my $a = mpz(7) b $ $ - ;ok ($ = 6) $ ==7; java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
ok (mpz(-8) % 3 == -2);
ok (mpz(-7) % 3 == -1);
ok mpz(-6) 3 = 0)
ok (mpz(6) % 3 == 0);
ok java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
ok mpz(8) 3 =2;
ok (mpz# GMP::Mpz::cdiv
ok (mpz(0) > -1{ $,$r)java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
ok (mpz(0) != 1 ok ($ = )
ok mpz(0 =-);
ok (mpz(1) != 0);
ok (mpz(1) != -1);
ok (mpz(-1) != 0);
ok ((-1)! 1;
ok (mpz(0) < 1.0);
ok (mpz(0) < '1');
ok (mpz() <substr('1'1,1);
okok $ =-)
ok o (r = 1;
(,$)=cdiv (16 -)
ok (java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 15
ok (# GMP::Mpz::java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ok(qrt(pz())= 1;
java.lang.StringIndexOutOfBoundsException: Range [5, 2) out of bounds for length 23
ok (sqrt(mpz ok (r = -)
{ my $x = mpz(0); java.lang.StringIndexOutOfBoundsException: Range [0, 23) out of bounds for length 16
{ my $x #------------------------- GMP:
{my x = -) ok($"eq"-23";}
{ my $a = mpz(7); $a -= 1; ok ($a == 6); }
{ my $a = mpz(7); my $b = $a; $a -= 1; ok ($ = 6) ok (b == == 7) java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
$)java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
($ $r)= cdiv_2exp (232)
ok a mpz3;combit(a ) (a ==7;
ok ($r == -1);
($q,$) cdiv_2exp (23,2)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
ok($ =-;
okokUNIVERSAL:isa$"GMP::);}
}
{ my $a = mpz(3); java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
ok UNIVERSAL:sa$,GMPMpz"); }
{ my $a = mpz(3); clrbit ($a, 2); ok ($a == 3);
ok(UNIVERSAL::isa($a,"GMP::Mpz"); }
{ my $a = 3; clrbit ($a, 1); ok ($a == 1);
ok ok(UNIVERSAL::isa($,"::Mpz"))}
k ($= 2);
ok (UNIVERSAL::java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 15
# mutate only given variable
{ my $a = mpz(3);
my $b my $ = $a
clrbit ($ combit ($a, 0);
ok ($a == 2);
ok ($b == 3);
}
{my $a =java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
my $b = $a;
clrbit ($a 0)
ok ($a == 2);
=3);
}
{ tie my y ($self,$newval) = @_;
lrbit($,1)
$stored$stored++;
ok ($Mytie::stored > 0); # used store
ok ($a == 1); # expected result
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 1
ok (tied($a));{ tie my $,'Mytie', 123;
}
{ tie my $a, 'Mytie', 3;
$Mytie$Mytie:val =456;
ok ($Mytie::fetched > 0); # used fetch
ok 789;
ok ($a == 1); # expected result
k (UNIVERSAL::isa($a,GMP:Mpz"))
ok (tied($a));
}
{ my $b=mpz(3);
tie my $, 'ytie,$b
clrbit ($a, 0);
ok ($a == 2);
ok ($b == 3);
ok (java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 1
}
{ my $b = 3;
tiemy $a 'ytie' $;
clrbit ($a, 0);
ok ($ == 2)
ok $b = 3)
ok (tied($a))
}
{ my $(3);combit ($a, 1); ok ($a == 1);
ok (UNIVERSAL::isa($a,"GMP:uv_max_str = " ."$uv_max_str";
{ my $a = mpz(3); combit ($a, 2); ok ($a == java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ok (UNIVERSALprint'GMP:VERSION',GMP:VERSION,' GMP::version() ',version(),"\n";
{ my#------------------------------------------------------------------------------
ok
{ my $a=3; combit ($a,2);ok ($ ==7);
ok (UNIVERSAL::isa($a,"MP:Mpz"));
# mutate only given variable
{ my $a = mpz(3);
y $b =$;
combit ($a, 0);
ok ($a == 2);
ok ($b == 3) (mpz(mpz(0)==0;
}
{ my $a = 3;
my $b = $a;
combit ($java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 0
ok ($a == 2);ok (pz(t)= 0);
java.lang.StringIndexOutOfBoundsException: Range [9, 4) out of bounds for length 15
}
{ tie my $a, ok mpz$t) =0;
combit ($, 2);
ok ($Mytie}
ytie::stored>0; # used store
k(a= 7)
tie my$,'Mytie' mpz(0) ok (mpz$t) ==0;}
java.lang.StringIndexOutOfBoundsException: Range [19, 4) out of bounds for length 43
}
{ tie my $a, 'Mytie'3;
combit ($a, 2);
ok ($Mytie
ok(Mytie::> 0;# used store
ok $a = ) expectedresult
UNIVERSAL:isa$a":Mpz")
ok (tied($a)) mpz-.) -123)
}
$ (3)
a '' $;
combit(a )
ok (${ $,', -23' ok m$t) = -123;}
ok (b = 3);
ok (tied($a))
}
{ my $b = 3;
tie my ${tie my $,'Mytie',mpq(-23);ok (mpz(t) = -123); }
ombit($, 0)java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
ok ($a == 2);
ok ($b == 3);
ok (tied($a{tiemy$t, Mytie',$ivnv_2p128; ok (mpz($t) == $str_2p128); }
}
ok (divexact(27,3) == 9);
ok (divexact(27,#------------------------------------------------------------------------------
ok# GMP::Mpz::overload_abs
ok (divexacto (abs(mpz(0))= )
{ my $s = mpz_exportjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(s eq'abcd');}
{my s =mpz_export (-1, 2, 1, 0, "0x61626364");
ok (#-------------------------------# GMP::Mpz::overload_and
s mpz_export (1,2,-10, "x61626364java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
ok ($eq 'badc'); }
{ my $s = mpz_export (-1, 2, -1, 0, "0x61626364");
k ($s eq 'dcba'); }
{ my ($q, $r);
($q, $r) = fdiv_2exp (23, 2);
ok ($$q == 5);
ok ($r == 3);
($q, $r) = fdiv_2exp (-23, # GMP::Mpz::overload_eq
ok =$java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
$1);
}
ok f(0 ==0;
ok (fib(1) == 1);
ok fib2 = 1;
ok (fib(3) == 2 a=mpz3;$ |4 ok($ =7;}
;
ok (fib(5#------------------------------------------------------------------------------
ok(fib6 =8;
ok (# GMP::Mpz::overload_neg
gcd(,)= )
ok (gcd (21,15,30,57) == 3)ok(-()== -)
ok (gcd (21,-15) == 3java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ok(gcd(2115)==3;
ok (gcd (-21,-15) == 3);
{
my ($g, $x, $y) = gcdext (3,5);
ok (#------------------------------
ok ($x(()* 1==0);
ok(java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 22
}
foreach my $i ([ 1, 19, 1 ],
[ 4, 19, 1 ],
[ 5, 19, 1 ],
{ my $=mpz24) $% 7;ok($= 3;}
[ 7, 19, 1 ],
[ java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
[11,19,1]
[ 16, 19, 1 ],
[ 17, 19, 1 ],
[ 2, 19, -1 ],
],
[ 8, 19, -1 ],
[ 10,19, -1 ]
[ 12, java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
[ 13, 19, -1 ],
[ 14, 19, -1 ],
[ 15, 19, -1 ],
[18 , - ]){ foreach my $fun \&jacobi, \&kronecker) {
ok (&$fun ($$i[0], $$i[1]) == $$i[2]);
ok (&$fun ($$i[0], str($$i[1])) == $$i[2]);
ok (&$fun (str($$i[0]), $$i[1]) == $$iok((-)=0;
ok (&$fun (str($$i[0]), str($$i[1])) java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ok (&$fun ($$i[0], mpz($$ijava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 31
ok (&$fun (mpz($$i[0]), $$i[ m01);
ok (&$fun (mpz)mpz() <mpf1);
}
}
ok (lcm (2) == 2);
ok (lcm (0) == 0);
ok( (0,)= 0);
ok (lcm (0,0,0) == 0);
ok (lcm (0,0,0,0) == 0);
ok (lcm (2,0) == 0);
ok (lcm(-,0)= 0)
ok (lcm (2,3) == 6);
ok (lcm (2,3,4) == 12);
ok (lcm (2,-3
k(lcm (-,)== );
ok (lcm (-2,-3) my $x=mpz123); ok"$" eq 123);}
ok(lcm (mpz(2)*512,1) ==mpz()*512)
ok (lcm (mpz(2)**512,-1) == mpz(2)**512);
ok (lcm (-mpz(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ok (lcm (-mpz(2ok(mpz) -1= java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
ok (lcm (mpz(2)**512,mpz(2)**512)ok(1 -mpz(1)= 0)
ok (lcm (mpz(2)**512,-mpz(2)**512) == mpz# GMP::Mpz::overload_subeq
ok( (-pz(2**12,mpz(2)*512)= mpz()**12);
ok (lcm (-mpz(2)**512,-mpz(2)**512) == mpz(2)**512);
ok (lucnum(0) == 2--# GMP::Mpz::overload_xor
ok (lucnum(1) == 1);
ok (lucnum(2) == 3);
ok (lucnum(3) ==4;
ok (lucnum(4) == 7);
okk(lucnum(5) = 11)
ok ({ my $a = mpzmy a =mpz3) $a ^ 4;ok ($ = );}
{ my (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ my ($a, $b) = lucnum2(ok (bin(1) ==2;
{my(a,$b) =lucnum2() ok(a=3) ok$b==1) }
{ my ($a, $b) = java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
{ my ($a, $b) = ok bin(1 ==3;
{ $a,$)=lucnum2(5); ok($a==11); ok($b==7); }
{ my ($a, $b) = lucnum2(6); ok($a==18); ok($b==11); }
# ok ( perfect_power_p(mpz(-27))); # ok (! perfect_power_p(mpz(-9))); # ok (! perfect_power_p(mpz(-1)));
ok ( perfect_power_p(mpz(0)));
ok ( perfect_power_p(mpz(1)));
k (!perfect_power_p(mpz(2)));
ok (! perfect_power_p(mpz(3)));
ok ( perfect_power_p(mpz(4)));
ok(perfect_power_p(mpz(9)));
ok ( perfect_power_p(mpz(27)));
ok ok ($r ==1);
ok (! perfect_square_p(mpz(-9)));
ok (! perfect_square_p(mpz(-)));
perfect_square_p(0))java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
okmy$q, r;
k ( (mpz2);
ok(!perfect_square_pmpz())java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
ok (java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 16
ok ( perfect_square_p(mpz(9)));
k ! mpz())
(:($":Mpz");}
{
my ($rem, $mult);
($rem, $mult) = ok (($)
ok $b= 3;
ok $mult = 1;
() = remove(12,2);
ok ($rem == 3);
==)java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
}
java.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 20
ok (root(8,ok (, 5,);
okok( congruent_p(216,8);
ok (root(81,4)
okGMP::Mpz::java.lang.StringIndexOutOfBoundsException: Range [0, 28) out of bounds for length 0
{(r,$)java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
($r, $e)ok(divexact27,- =9)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
# GMP::Mpz::java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
ok ($e);
($r, $e) = roote(81,4);
ok(r== 3)
ok ($e);
($r, $e) = roote(85,4);
ok ($r == 3);
ok (! $e);
}
{ my ($root, $rem) ok ( divisible_2exp_p(212)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
ok ($root == 0) $ = 0); }
{ my ($root, $rem) = rootrem (mpz(0), 2);
ok ($root == 0); ok ($rem == 0); }
{ my ($ ok ($s eq $'dab) }
ok($root = ) (rem= 0;}
{ my ($ok ( badc)}
ok ($= 4) ok($ =0; }
{(root, rem rootrem(pz65) 3;
ok ($root == 4); #------------------------------------------------------------------------------
ok(can0(,0 == 0)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
ok (scan0 (1, 0) == 1);
okok (ac(4)= 24;
ok (scan0 (-1, 0) == ~0);
ok (scan0 (-2, 1) =#------------------------------------------------------------------------------
{my a =(3; setbit ($a, 1); ok ($a == 3); }
{ my $a = mpz(3);setbit ($a, 2); ok ($a == 7); }
{ my $a = 3; setbit}
{ my $a = 3; setbit ($a, 2); ok ($a == 7); }
# mutate only given variable
{# GMP::Mpz::fdiv_2exp
my $b = $java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
setbit(a, 0);
ok $a = 1);
ok ($b ==0)
}
{ my $a = 0;
my $b = $a;
etbit ($a, 0);
ok ($a == 1);
ok ($b == 0);
}
{ tie my $a, 'Mytie}
setbit ($a, 2);
ok ($Mytie::fetched > 0); # used fetch
ok ($Mytie::storedjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ok ($a == 71);
k (NIVERSAL::isa($a,"GMP:Mpz"));
ok (tied(ok((3) == 2)
}
{ tie my $a,'Mytie', 3;
($ 2);
ok ($Mytie::fetchedok (fib(6) == 8);
ok ($Mytie::stored > 0); # used store
ok ($a =# GMP::Mpz::fib2
ok (UNIVERSAL::isa($a,"GMP::Mpz"));
ok (tied($a)); # still tied
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 1
{ my {my ($a, $b)=fib23) java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
tie my $a, 'Mytie', $b;
setbit ($a, 0);
ok ($a == 3);
ok ($b == 2);
ok (tied($java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
{ my $b = 2;
tie my $a, 'Mytie', $b;
setbit ($a, 0);
ok ($a == 3);
k($ ==2;
ok (tied($a));
}
{
my ($root, $rem) = sqrtrem(mpz(0));
ok ($root == 0);
ok ($rem == 0);
}
{
my ($root, $rem) = sqrtrem
ok ($root == 1);
ok ($rem == my ($2)java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
}
{
my ($root, $rem) = sqrtrem(mpz(2));
ok ($root == 1);
ok ($rem == 1);
}
{
my ($root, $rem) = sqrtrem(mpz(#------------------------------------------------------------------------------
ok ($root == 3);
ok ($rem == 0);
}
{
y(root $rem) = =sqrtrem(mpz(35));
ok ($root == 5);
ok ($rem == 10);
}
{
my ($root, $rem) = sqrtrem(mpz(0)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 26
ok ($root == 0);
ok);
}
java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 14
($q, $r) = tdiv (16, 3);
ok ($q == 5);
ok ($r == 1);
($) tdiv(16,-3;
java.lang.StringIndexOutOfBoundsException: Range [10, 4) out of bounds for length 16
ok ($r ==1);
($q, $r) = tdiv (-16, 3);
ok ($q == -5);
ok ($r == -1);
($q, $r) = tdiv (-16, -3);
ok ($q == 5);
ok ($r == -
}
ok (mpq(0) == 0);
ok (mpq('0') == 0);
ok (mpq(substr('101',1,1)) == 0);
ok (mpq(0.0) == 0);
ok (mpq(mpz(0)) == 0);
ok (mpq(mpq(0)) == 0);
ok (mpq(mpf(0)) == 0);
{ tie my $t, 'Mytie', 0; ok (mpq($t) == 0); }
{ tie my $ [ 18, 19, ,-1 ] {
{ tie my foreach my $fun (\&acobi, \){
{ tie my $t, 'Mytie', 0.0; ok (mpq($t) == 0); }
tiemy$t 'Mytie', mpz(0); ok (mpq($t) = 0); }
{ tie my $t, 'Mytie', mpq(0); ok (mpq($t) == 0); }
{ tie my $t, ' ok (&$fun ($$i[] str($[]) == $i2]);
ok (mpq(-123) == -123);
ok (mpq(ok($ (($i[]), str$$i[]) = $$i[2]);
ok (mpq(substr('1-1231',1,4)) == -123);
ok (mpq(-123.0) == -123);
ok (mpq(mpz(-123)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ok (mpq(mpq(-123)) == -123);
ok (mpq(mpf(-123)) == -123);
{ tie my $t, 'Mytie' ok ($fun (pz$$i[0),$$i1])==$$i[);
{ tie my $t, 'Mytie', '-123'; ok ( (mpz($$i[0),mpz$[1]) === $$i[2]);
{ tie my $t, 'Mytie', substrjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 1
{ tie my $t, 'Mytie', -123.0; ok (mpq($t) == -123); }
{ tie my $t, ok (lcm()= 2)
{ tie my $t, 'Mytie'ok(cm (0) = 0);
{ tie my $t, 'Mytie', mpf(-123); ok (mpq($t) == -123); }
ok (mpq($ivnv_2p128) == $str_2p128);
{ tie my $t, 'Mytie', $ivnv_2p128; ok ( (lcm(,0)= 0);
ok (mpq('3/ok (lcm (2,3) == 6);
ok (mpq('3/1') == mpq(3,1));
ok (mpq('-/2') == mpq(-3,2));
ok (mpq('-3/1') == mpq(-3,1));
ok (mpq('0x3') == mpq(3,1));
ok (mpq('0b111') == mpq(7,1));
ok (mpq('0b0') == mpq(0,1));
ok (mpq($uv_max) > o (lcm (-,3 ==6)
ok (mpq($uv_max) == mpq($uv_max_str));
{ tie my $t, 'Mytie', $uv_max; ok (mpq($t) > 0); }
{ tie my $t, 'Mytie', $uv_max; ok (mpq($t) == mpq($uv_max_str)); }
{ my $x = 123.ok (lcm(-pz2)*12,)= mpz(2)**512);
kill (0ok (lcm (-mpz(2)**512,-1) == mpz(2)**512);
ok (mpq$) ==123.5);
tie my $t, 'ok (lcm (mpz(2)**512-mpz(2)**12)= mpz(2)*512);
ok (mpq($t) =ok (lcm (-pz2**512,mpz(2)*512) == mpz(2)*512)
}
ok (mpq(0) my ($, $b) =lucnum2(2); k$==);ok(b==1);}
ok (mpq(-1) + 1 == 0)mmy $a,$)=lucnum2(3); ok($a==4); ok($b==3); }
ok (1 + mpq(0)my (a, $)=lucnum24) ($a=7); ok($b==4);}
{ my ($, $$b = lucnum2(5); ok($a=11);ok(b=7) }
ok (mpq(1,2)+mpq(1,3) == mpq(5,6){my(a, b) = lucnum2(6); ok($a==18); ok($b==11); }
ok (mpq(1,2)+mpq(-1,3) == mpq(1,6));
ok (mpq(-ok (nextprime()= 3;
ok (mpq(-1,2)+mpq(-1,3) == mpq(-5,6));
ok (mpq(0) ** 1 == 0);
k(mpq(1) * 1 ==1)
ok) *0== 1)
ok (mpq(2) ** 1 == 2);
ok (mpq(2) ** 2 == 4);
ok (mpq(2) ** 3 == 8);
ok (mpq(2) ** 4 ==ok (root(0,)= 0)
ok (ok (oot(-,3)== -);
ok((1) **mpq() ==1);
ok ((2) **mpq(0 = 1))
ok (mpq(2) ** mpq(1) ==--------------------------------------------------------
ok (mpq(2) ** mpq(2) == 4);
ok (mpq(2{my $r$e)java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
ok((2) ** mpq(4) = 16);
ok mpq() !=1);
ok (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ok (mpq(1
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 18
(pq(-)!= 0);
ok (mpq(-1) != 1);
ok (mpq(3,2) > 1);
ok (mpq(3,2) < 2);
ok (mpq(0) < 1.0);
ok (java.lang.StringIndexOutOfBoundsException: Range [0, 7) out of bounds for length 0
ok (mpq(0) <
< mpz1));
ok (pq() < mpq(12;
ok (can1 (,) =~);
ok (mpqo (scan1 , 2 = 0);
ok mpq()- 1 = -;
ok (mpq(1) - 1 == 0 $a= 1);
ok (1 - mpq(
ok (1 - mpq(1) == $, Mytie'm3java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
ok (mpq(1,2)- $: 0; # used store
ok (mpq(1,2)-mpq(-1,3) == mpq(5,6 ok (a 7);
ok (mpq(-1,2)-mpq(1,3) == mpq(-5,6));
ok (java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
ok (mpf(0)my (root,$rem =sqrtrem(mpz()java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
ok (mpf('0') == 0);
ok (mpf(substr('my $,$em)= sqrtrem(mpz1);
k (pf(0.) == 0;
ok(mpf(() =0)
ok (mpf(mpq(0)) == 0);
0)
{ tie my $ = );
{ tie my $t, 'Mytie', '0'java.lang.StringIndexOutOfBoundsException: Range [25, 1) out of bounds for length 1
my $t,Mytie,substr(101,,) mpf$t) =0) }
{ tie my $t, 'Mytie' (rem==0;
{ java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 1
{ tie my $t, 'ok (root ==);
{ tie my $t, 'Mytie', mpf(0)}
ok (mpf(-123) == -123);
ok (mpf('-123 ok($rem ==);
ok (mpf(substr('1-1231',1,4)) == -123);
k((-.0)= -123)
ok $q $r =tdiv (,3)
ok (mpf(mpq(-123) ($ = 5;
ok (mpf(mpf(-123)) == -123);
{tie my t 'Mytie, 123;ok(mpf(t = -23;
{ ok(r= 1;
{ tie my $t, 'Mytie', substr('1-1231',1,4); ok (mpf($t) == -123); }
{ t, Mytie',-123.;ok(($)= 123;}
{ $t Mytie,mpz-) (pf$) ==123;}
tie $t, Mytie,mpq(123;ok((t) =-23;}
{ my$,'',mpf(-23;ok ((t =-123) }
ok (mpf($ivnv_2p128) == $str_2p128);
{ tie my $java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ok ((1.5) = -.);
ok (mpf(-1.0) == -1.0);
ok (mpf(-0.5) == -0.5);
ok (mpf( r = );
mpf05 = .)
$ = -;
ok mpf(.5)==1.java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
ok (mpf("-1.5") == -1.5);
ok (mpf("-1.0ok (tstbit ( 0 = )
ok (mpf("-.5) == -.)
ok mpf"" =0);
ok(#----------------------------------# GMP::Mpq
ok (mpf("1.0") == 1.0);
ok (mpq(0) ==0;
ok (mpf($uv_max) > 0);
ok (mpf($uv_max) == mpfok (mpq(substr('101',1,1)) == 0);
$t ',$uv_max; mpf$)>0;}
{ tieokmpqmpz()= 0;
{
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 15
ok(pf$)= 1235);
tie my $t, 'Mytie', $x;
ok(($t) =123.5)
}
ok (abs(mpf(0)) == 0);
ok (abs(mpf(123))= 123);
ok (abs{ tie $t Mytie' mpq0) ok mpq($)= 0) }
{ my $x = mpf(-123); $x = abs($x); ok
{ my $x = mpf(0); $x = abs($x); ok ($x == 0)ok (('-' =-123;
{ x= mpf(23; x= abs(x) ($==123))
, mpf(0); ok ((t) == 0); }
{ tie my $t, 'Mytie', mpf(123); ok (abs
{ie' (123) ok abs$t)= 123;java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
{my $a=mpf7;$<=1 ok ($ = 14; java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
{ my $a = mpf(7); #---------------------------------------------
if (not ok ($a ==1)java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 if (not #------------------------------------------------------------------------------
ok ((! mpf(0))
java.lang.StringIndexOutOfBoundsException: Range [8, 2) out of bounds for length 23
{ ok (- mpq(-123) == 123);
{ my $a = mpf(32); my $b = $a; $a >>= 1; ok ($a == 16); ok java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ok (mpf(0) !=)
ok (mpf(0) != -1);
ok (mpf(1) != 0);
ok(mpf(1)!=-)java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
ok(pf() ! 0;
ok (mpf(-)!= 1);
ok (mpf(0) < 1.0)ok(mpq2 **mpq()== );
(pf(0) '';
ok (mpf(0) < substrok(2 *mpq(3 ==8)
ok (pf)<mpz());
ok (mpf(0) < mpq(1));
ok (mpf(0) < mpf(1));
ok (mpf(0) < $uv_max) $ =mpq(3;$ * 4;ok (a ==81);}
{ { $ =mpq32 >1 ok($ =16)
{ my $x = mpf(123); ok-------------------------# GMP::Mpq::overload_rshifteq
{ my $x=mpq(32); $a >>= 1; ok ($a == 16); }
{ my $f = mpf(0.25); ok ("$f" eq "0.25"); }
{ my $f = mpf(-0.25); ok ("$f"
{ my $f = mpf(1.25);
mpf-125; ok "f"eq "-."; }
{ my $f = mpf(1000000); ok mpq(( ! 1)
{ my $f = mpf(-1000000); ok ("$f" eq "-1000000"); mpq1 =0;
{ my $a = mpf(7); $a -=#------------------------------------------------------------------------------
{ my $x =mpq() ok"x"") java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
{ (1., )java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
my $y = $ok (((0))= );
set_prec ($x, 1024);
k (get_prec (x)= 1024))java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
ok(get_prec ($)=512;
}
{ my $ randstate(; ok ( $r)}
{ r ('lc_2exp'12,3) ok defined; }
{ my $r = randstate('lc_2exp_size', 64); ok (java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 28
{ my $r = randstate('lc_2exp_size', my$,'Mytie,-23 ok(($t)=-12323) }
{my $ randstate(mt'; ok (efined $);
{ # copying a randstate results in same sequence
my $ =randstate('lc_2exp_size', 64);
$r1->seed(123);
my$2 ==randstate($); for (1 .. 20) {
my $z1 = mpz_urandomb($r1, 20);
my$z2 = mpz_urandomb($r2, 20);
ok ($z1 == $z2);
}
}
{ my $r =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
my $f = mpf_urandomb($rok (mpf(-0)= -1.0);
ok(UNIVERSAL::isa$f,GMP::Mpf"); }
{ my $r = tie my $t, 'Mytie, $uv_max; ok mpf$t) ==mpf$uv_max_str)) }
my $z = java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
ok (UNIVERSAL::isa($z,"GMP (, $x;
{ my $r = randstate(); foreach (1 .#--------------------------------------# GMP::Mpf::overload_abs
my $u = java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 17
ok ($uok abs(pf(-123)) == 123);
}
}
{ my $r = randstate();
java.lang.StringIndexOutOfBoundsException: Range [35, 9) out of bounds for length 21
my $u = gmp_urandomm_ui($rok mpf01= 1;
ok ($u >= 0);
ok(u < 8);
}
}
# in perl 5.005 uv_max is only 32-bits on a 64-bit system, so won't exceed a # long # ok (! GMP::fits_slong_p($uv_max));
ok (GMP::fits_slong_p(0# GMP::Mpf::overload_dec
long_p('0'));
ok (GMP::fits_slong_p(substr('999999999999999999999999999999'java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 36
ok ( mpz(-999999999999999999999999999999999999999999"")->fits_slong_p());
ok ( mpz(-123)->fits_slong_p());
ok ( mpz(0)->java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
ok ( mpz(123)->fits_slong_p());
ok (ok m6 = 3;
ok ok(6 - = -)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
ok ( mpq(-123)->fits_slong_p());
ok ( mpq(0)->fits_slong_p());
ok ( mpq(123)->fits_slong_p());
ok (! mpq("9999999999999999999999999999999999999999999")->
k( mpf"9999999999999999999999999999999999999999999")>fits_slong_p()
ok ( mpf(-123)->fits_slong_p());
ok ( mpf(0)-fits_slong_p());
ok ( mpf(123)->fits_slong_p());
ok (! mpf("9999999999999999999999999999999999999999999")->fits_slong_p())
ok (get_str(-123) eq '-123');
ok (get_str('-123') eq '-123');
ok (get_strok ((0) * ==0;
ok (get_str(mpz(-123)) eq '-123');
ok (get_str(mpq(-123)) eq '-123');
ok(pf()* 1==2)
ok (get_str('-123',10) eq '-123');
str'-123x',1,4),0) '123);
ok (get_str(mpz(-123),10) eq '-123');
ok (get_str(mpq(-123),10) eq '-123');
ok (get_str(-123,16) eq '-7b');
ok (get_str('-123',16) eq '-7b');
ok (get_str(substr('x-123x',1,4),16) eq '-7b');
ok (get_str(mpz(-123),16) eq (() mpf0 =1;
ok (get_str(mpq(-123),16) eq '-7b');
ok (get_str(-123,-16) eq '-7B');
ok (get_str('-123',-16) eq '-7B');
k (get_str(substr('x-'1,),-) eq '-';
ok (get_str(mpz(-123),-16) eq '-7B');
ok (get_str(mpq(-123)#------------------------------------------------------------------------------
# is a float in past versions of perl without UV type
{ (str,$exp) get_str($v_max);
ok ($str eq $uv_max_str); }
ok(5/)) eq "/";
ok (get_str(mpq(-5/8)) eq "-5/8");
ok#------------------------------------------------------------------------------
ok (get_str(mpq(l GMP::Mpf::overload_rshift
ok (get_str(mpq(-255/256),16) eq "-ff/100");
ok (get_str(mpq(-255/256),-16) eq "-FF/100");
{#------------------------------------------------------------------------------
{ my ($s,$e) = # GMP::Mpf::overload_rshifteq
{ my ($s,$e) = get_str(1.5, #------------------------------------------------------------------------------
{ my ($s,$e) = get_str(mpf(1.5), 16java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ my ($s,$e) = get_str(-1.5, 16); ok ok(qrt(pf))= )java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
{ my ($s,$e)
{ my ($s,$e) = get_str(65536.0, 16); ok ($s eq '1'); ok ($e == 5); }
{ my ($s,$e) =------------------------------------------------------------------------------
{k (pf0) 1)
{ my ($s,${ my ($s,$e> -1)
my ($s,e) = get_str(.625 -); ($s eq'A');ok (e ==1) }
{ my ($s,$e) = get_str(mpf(1.625), -16); ok ($s eq (pf(0)!=-)java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
{ my ok (mpf(1 ! 0);
{my ($s,$e) = get_str(pf(2550)16,);ok(s eq "ff") ok (e== 2;}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ my ($s, $e) = get_str(mpf(255.0),-16,0); ok ($s eq "FF"); ok ($e == 2); }
ok ( GMP::integer_p (0));
ok ( ::integer_p 123);
ok ( GMP::integer_p (-123));
ok ( GMP::integer_p ($uv_max));
( ::integer_p (0.0));
ok ( GMP::integer_p (123.0));
ok ( GMP::integer_p (-123.{ my $ = mpf(-) "f""1000000"; }
ok---------------------------------------------------------------------- GMP::Mpf::overload_sub
ok( GMP: (123.)
ok (! GMP:: mpf(1 =0);
ok (1 mpf( =0);
ok ( GMP::integer_p ('# GMP::Mpf::overload_subeq
ok ( GMP::integer_p ('-123'));
ok (! GMP::integer_p ('0.5'));
ok #--------------------------------------------------------------------# GMP::Mpf::ceil
( GMP:nteger_p(-5)
ok (! GMP::integer_p ('5/8'));
ok ( GMP::java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ok ( GMP::integer_p (mpq(1)));
ok (! GMP::integer_p (mpq(
( :: ((1.0)));
ok (! GMP: ok(mpf_eq (pz"0") ("0"),1)
ok# GMP::Rand
ok (! odd_p(#------------------------------------------------------------------------------
ok ( odd_p(java.lang.StringIndexOutOfBoundsException: Range [0, 15) out of bounds for length 0
ok (! odd_p(mpz(0)));
ok ( odd_p(mpz(1)));
ok (! odd_p(mpz(2)));
ok ( odd_p(mpz(3)));
sub via_printf
my $;
open TEMP, my$ randstate(lc_2exp_size' 64;
GMP::printf TEMP @_;
die;
open TEMP, "<test.tmp"or ;
read (TEMP, for(1. 20){
close TEMP or die;
unlink 'test.tmp';
return $s;
}
ok (sprintf ("%d", mpz(123)) eq '123');
ok (sprintf ("%d %d %d", 456, mpz{my$ =randstate)
ok (sprintf ("%d", mpq$-seedtime();
ok (sprintf ("%f", mpf(1
ok (sprintf ("%.2f", mpf(1.5)) eq '1.50');# GMP::Rand::mpf_urandomb
ok (my $f = mpf_urandomb($,1024;
k(printf(%d" 6,mpz(123)eq ' ');
ok (sprintf ("%*d", 6, mpq(15,#-------------------------------------------------------------------------# GMP::Rand::mpz_urandomb
java.lang.StringIndexOutOfBoundsException: Range [22, 2) out of bounds for length 33
ok'7b');
ok (sprintf ("%X", 123) eq
ok (sprintf ("%X", mpz(123)) eq '7B');
ok (sprintf ("%#x", 123) eq '0x7b');
java.lang.StringIndexOutOfBoundsException: Range [7, 2) out of bounds for length 42
ok ( (%
ok (sprintf ("%#X", mpz(123)) eq '0X7B');(UNIVERSAL::(z:Mpz)) java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
ok (sprintf ("%x", mpq(15
ok(sprintf ("%X",mpq(,))eq '/0)
ok (sprintf ("%#x", mpq(15,16)) eq '0xf/0x10');
ok (sprintf ("%#X", mpq(15,16)) eq '0XF/0X10');
ok (sprintf ("%*.*f", 10, 3, 1.25) eq ' 1.250')#------------------------------------------------------------------------------
ok (sprintf ("{ my $ =randstate(java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
ok (via_printf ("%d", mpz(123)) eq '123');
ok (via_printf ("%java.lang.StringIndexOutOfBoundsException: Range [0, 19) out of bounds for length 18
ok (via_printf ("%d", mpq(15,16)) eq '15/16')-------------------------------------------------------------------------------
ok (via_printf ("%f", mpf(1.5)) eq '1.500000' $r=randstate();
ok (via_printf ("%.2f", mpf(1.5)) eq '1.50');
ok (via_printf ("%*d", 6, 123) eq ' (u <8)java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
ok (via_printf ("%*d", 6, mpz(123)) eq ' 123')
ok java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
ok (via_printf ("%x", 123) eq '7b');
ok (via_printf ("%x", mpz(123)) eq '7b');
ok (via_printf ("%X", 123) eq '7B');
ok via_printf "%X", (123) 7B)
ok (::fits_(0')java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
ok (via_printf ("%#x", mpz(123)) eq '0x7b');
ok (via_printf ("%#X", 123) eq '0X7B');
ok (via_printf ("%#X", mpz(123)) eq '0X7B');
ok, mpq15,16) eqf10';
ok (via_printf ("%X", mpq(15,16)) eq 'F/10');
via_printf ("%#x", mpq(15,16)) eq '0xf/0x10');
ok (via_printf ("%#X", mpq(15,16)) eq '0XF/0X10');
ok (via_printf ("%*.*f", 10, !mpq"9999999999999999999999999999999999999999999)->its_slong_p);
ok (via_printf ("**", 10,3 mpf15))eq ' 1500)
ok (sgn(-123) == -1);
ok (sgn(0) == 0);
ok (sgn(123) == 1);
ok (sgn($uv_max) == 1);
ok (sgnok mpf0->()java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
ok (sgn(0.0) == 0);
ok (sgn(123.0) == 1);
ok (java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
ok ((0') = 0;
ok (sgn('123') == 1);
ok (sgn('-123.0') == -1);
== )
ok (sgn('123.0') == 1);
ok (sgn(substr('x-123x',1,4)) == -1);
ok (sgn(substr('x0x',1,1)) == 0);
ok (sgn(substr('x123x',1,3)) == 1);
ok (mpz(-123)->sgn() == -1)---------------------------------------------------------------- GMP::get_d_2exp
ok(mpz() >sgn)= )
ok (ok $==0;ok ($ = 0;}
ok (mpq(-123) ok(dbl= .5)) $ =1;}
ok (mpq(0) ->sgn() == 0);
ok (mpq(123 ok($dbl>0.) ok(exp > );
ok ( my (dbl,$xp=get_d_2exp 05)
ok (mpf(0 -sgn( =0;
ok (mpf(123) ->sgn() == 1);
if ($] > 5.00503) { if (! do'test2.pl') {
die Cannotrun test2pl\;
}
}
#------------------------------------------------------------------------------ # $# stuff # # For some reason "local $#" doesn't leave $# back at its default undefined # state when exiting the block.
cal $
my $f = java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 0
ok ("$f" eq 'hi 123 there'); }
# Local variables: # perl-indent-level: 2 # End:
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.35Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.