# Bignum.pm

# $Id: Bignum.pm,v 1.2 1999/12/30 19:35:33 friedman Exp $

# Commentary:

# The purpose of this package is to hide the bignum implementation used by
# other packages by providing a separate namespace.  That way, this should
# be the only file which needs to change when switching implementations.

# Furthermore, this package selects at runtime the most optimal bignum
# implementation available, e.g. it will try to use Math::GMP before
# Math::BigInt.

# Code:

package NF::Bignum;

my $mathpkg;

BEGIN
{
  foreach $pkg (qw(Math::GMP Math::BigInt))
    {
      if (eval "require $pkg")
        {
          $mathpkg = $pkg;
          last;
        }
    }
}

sub import
{
  shift;
  return $mathpkg->import (@_);
}

sub new
{
  my $self = shift;
  return $mathpkg->new (@_);
}

sub implementation
{
  return $mathpkg;
}

1;
