3 # Some sample GMP module operations
5 # Copyright 2001, 2004 Free Software Foundation, Inc.
7 # This file is part of the GNU MP Library.
9 # The GNU MP Library is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU Lesser General Public License as published
11 # by the Free Software Foundation; either version 3 of the License, or (at
12 # your option) any later version.
14 # The GNU MP Library is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 # License for more details.
19 # You should have received a copy of the GNU Lesser General Public License
20 # along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
26 print "using GMP module $GMP::VERSION and GMP library ",GMP::version(),"\n";
29 use GMP::Mpz qw(:all);
30 print "the 200th fibonacci number is ", fib(200), "\n";
31 print "next prime after 10**30 is (probably) ", nextprime(mpz(10)**30), "\n";
34 use GMP::Mpq qw(:constants);
35 print "the 7th harmonic number is ", 1+1/2+1/3+1/4+1/5+1/6+1/7, "\n";
36 use GMP::Mpq qw(:noconstants);
43 print "a sample mpf is $f\n";