Lines Matching defs:GMP

0 # GMP perl module
39 package GMP;
55 bootstrap GMP $VERSION;
58 # The format string is cut up into "%" specifiers so GMP types can be
59 # passed to GMP::sprintf_internal. Any "*"s are interpolated before
84 if (UNIVERSAL::isa($_[0],"GMP::Mpz")) {
86 die "GMP::sprintf: unsupported output format for mpz: $pat2\n";
91 } elsif (UNIVERSAL::isa($_[0],"GMP::Mpq")) {
93 die "GMP::sprintf: unsupported output format for mpq: $pat2\n";
98 } elsif (UNIVERSAL::isa($_[0],"GMP::Mpf")) {
100 die "GMP::sprintf: unsupported output format for mpf: $pat2\n";
124 print $h GMP::sprintf(@_);
126 print STDOUT GMP::sprintf(@_);
137 GMP - Perl interface to the GNU Multiple Precision Arithmetic Library
141 use GMP;
142 use GMP::Mpz;
143 use GMP::Mpq;
144 use GMP::Mpf;
145 use GMP::Rand;
155 use GMP::Mpz qw(gcd, lcm); # just these functions
156 use GMP::Mpq qw(:all); # everything in mpq
158 =head2 GMP::Mpz
165 use GMP::Mpz qw(:all);
182 C</> and C<%> round towards zero (as per the C<tdiv> functions in GMP).
185 corresponding GMP mpz functions,
205 use GMP::Mpz qw(:all);
233 use GMP::Mpz qw(setbit);
241 =head2 GMP::Mpq
249 use GMP::Mpq qw(:all);
258 the GMP manual, which is denominator positive, no common factors, and zero
262 use GMP::Mpq qw(:all);
288 C<inv> calculates 1/q, as per the corresponding GMP function. C<num> and
293 =head2 GMP::Mpf
303 use GMP::Mpf qw(:all);
322 corresponding GMP mpf functions,
343 use GMP::Mpf qw(mpf);
353 =head2 GMP class
355 The following functions are available in the GMP class,
376 use GMP qw(:all);
377 use GMP::Mpq qw(:all);
387 use GMP qw(:all);
388 use GMP::Mpf qw(:all);
396 C<printf> and C<sprintf> allow formatted output of GMP types. mpz and mpq
401 use GMP::Mpz qw(mpz);
402 use GMP::Mpf qw(mpf);
403 GMP::printf ("%d %d %s", 123, mpz(2)**128, 'foo');
404 GMP::printf STDERR "%.40f", mpf(1.234);
408 C<GMP::printf> is suggested. C<sprintf> doesn't suffer this problem.
410 use GMP qw(sprintf);
411 use GMP::Mpq qw(mpq);
415 C<GMP::version()> is recommended. It returns the GMP library version
418 The other GMP module functions behave as per the corresponding GMP routines,
421 use GMP qw(:all);
422 use GMP::Mpz qw(mpz);
426 Because each of GMP::Mpz, GMP::Mpq and GMP::Mpf is a sub-class of GMP,
429 use GMP qw(:all);
430 use GMP::Mpq qw(mpf);
435 =head2 GMP::Rand
440 use GMP::Rand qw(randstate);
476 corresponding GMP function. For example,
478 use GMP::Rand (:all);
493 use GMP::Mpz (mpz);
494 use GMP::Mpq (mpq);
500 use GMP::Mpz (mpz);
507 use GMP::Mpz (mpz);
514 use GMP::Mpz (mpz);
522 determines the result type when mixing GMP classes. For example,
524 use GMP::Mpz (mpz);
525 use GMP::Mpq (mpq);
526 use GMP::Mpf (mpf);
538 GMP objects. This can only be used on one of GMP::Mpz, GMP::Mpq or GMP::Mpf
541 GMP::Mpz will treat constants as mpz's if they're integers, or ordinary
544 use GMP::Mpz qw(:constants);
548 GMP::Mpq is similar, treating integers as mpq's and leaving floats to the
552 use GMP::Mpq qw(:constants);
556 GMP::Mpf will treat all constants as mpf's using the default precision.
560 use GMP::Mpf qw(:constants);
561 BEGIN { GMP::Mpf::set_default_prec(256); }
563 BEGIN { GMP::Mpf::set_default_prec(64); }
569 use GMP::Mpz qw(:constants);
571 use GMP::Mpz qw(:noconstants);
575 'float' is captured even for GMP::Mpz and GMP::Mpq since perl by default
580 GMP manual, L<perl>, L<overload>.
585 seg faults. Don't know if that's a perl bug or a GMP module bug, though it
586 does seem to go bad before reaching anything in GMP.xs.
608 promoted to a float at any stage, and then on the GMP module rules about
614 class C<GMP::Mpz>. The object holds a pointer to the C language C<mpz_t>