This module wraps the MPFI C library functions.

This version of Math::MPFI needs mpfi-1.5 or later.

The MPFI library is intended to be a portable library written in C
for arbitrary precision interval arithmetic with intervals represented
using MPFR reliable floating-point numbers. It is based on the GNU MP
(GMP) library and on the MPFR library.

MPFI, like MPFR and GMP, is free. It is distributed under the
GNU Lesser General Public License (GNU Lesser GPL).

Because this module wraps the MPFI functions, it requires that the
MPFI library (version 1.5 or later), the GMP library (version 4.2.0
or later) and the MPFR library (version 3.0.0 or later) have been
installed.

For the GMP library see:
http://gmplib.org

For the MPFR library see:
http://www.mpfr.org
Do not use the (outdated) MPFR library source that ships with the
GMP source.

For the MPFI library see:
https://gforge.inria.fr/projects/mpfi/

You'll also need to have Math::MPFR (version 3.23 or later) installed.

To build this module you need perl 5.6.0 or later. I'm not sure of all
the requirements to get it to build with earlier versions of perl, but
it's definite that the XS code relating to operator overloading will
not compile with perl versions prior to 5.6.

Build in the usual way:

 perl Makefile.PL
 make
 make test
 make install

When building this module, the MPFI, GMP and MPFR libraries will need to be
accessible. If those files are in a location where your compiler does
not find them by default, then instead of running 'perl Makefile.PL',
you'll need to run:

perl Makefile.pl INC="-I/path/to/gmp_includes -I/path/to/mpfr_includes -I/path/to/mpfi/include"
 LIBS="-L/path/to/mpfi_lib -lmpfi -L/path/to/mpfr_lib -lmpfr -L/path/to/gmp_lib -lgmp"

==================================
64-bit-int and long double support
==================================

If your perl's Config reports that 'ivsize' is greater than or
equal to 8 && 'ivtype' is not 'long', then Math::MPFI will, by default,
be built with access to the mpfr_*_uj and mpfr_*_sj functions. Else,
access to those functions is, by default, denied. You can override the
default by opening up the Makefile.PL and uncommenting the appropriate
line (just a few lines down from the top of the file ... the comments in
that file should make it clear).

Similarly, if your perl's Config reports that 'nvsize' is greater than
8 then Math::MPFI will be built with access to the mpfr_*_ld functions.
Else, access to those functions is, by default, denied. Again, you can
override the default by opening up the Makefile.PL and uncommenting the
appropriate line.

==================
__float128 support
==================

Beginning perl-5.21.3 (or thereabouts) it is possible to build perl with
nvtype of __float128 (if the architecture and compiler support that data type).
The Makefile.PL should automatically detect and set the appropriate level of
__float128 support.

===============================
MS WINDOWS (Visual Studio 2019)
===============================

I don't know how to build the gmp, mpfr and mpfi libraries using Visual
Studio 2019, so when building this module with Visual Studio 2019 I build
against gmp, mpfr and mpfi libraries that were built using MinGW-w64.

Building with Visual Studio 2019 against  *dynamic* gmp/mpfr/mpfi libraries
that were built using a MinGW-w64 compiler is not recommended, as strange
results can then arise when calling mpfr functions that take a FILE*
argument.

If building with Visual Studio 2019 against static gmp/mpfr libs that were
built using a MinGW-w64 compiler I first make a copy of the gmp, mpfr and
mpfi libraries (libgmp.a, libmpfr.a and libmpfi.a) along with copies of
the following MinGW-w64 library files:
libgcc.a
libgcc_s.a
libmingwex.a
libmingw32.a

For each of the 7 copied files, I leave the filename unchanged (though the
"lib" at the begining of the name is optional), and change the file
extension to ".lib".
In making those copies, I've left them in the same directory as the
original, but I assume (untested) that the copies could be moved to any
location of your choice.

Then build this module by cd'ing to the top level Math::MPFR source folder
and running:

perl Makefile.PL INC="-IC:/path/to/gmp_header" LIBS="-LC:/path/to/libgcc -lgcc -LC:/path/to/libgcc_s -lgcc_s -LC:/path/to/standard_libs -lmingwex -lmingw32 -LC:/path/to/libgmp -lmpfi -lmpfr -lgmp"
nmake test
nmake install

NOTES
 The given example "perl Makefile.PL ..." command assumes:
  1) that mpfi.h, mpfr.h and gmp.h are all in C:/path/to/gmp_header;
  2) that libmingwex and libmingw32 libraries are in the same location;
  3) that libmpfi.lib, libmpfr.lib and libgmp.lib are in C:/path/to/libgmp.
 Modify as necessary.

I am contactable by email at sisyphus at(@) cpan dot (.) org.