1#!perl
2
3package Math::BigInt::Trace;
4
5require 5.010;
6use strict;
7use warnings;
8
9use Exporter;
10use Math::BigInt;
11
12our ($accuracy, $precision, $round_mode, $div_scale);
13
14our @ISA = qw(Exporter Math::BigInt);
15
16our $VERSION = '0.51';
17
18use overload;                   # inherit overload from Math::BigInt
19
20# Globals
21$accuracy = $precision = undef;
22$round_mode = 'even';
23$div_scale = 40;
24
25sub new {
26    my $proto = shift;
27    my $class = ref($proto) || $proto;
28
29    my $value = shift;
30    my $a = $accuracy;
31    $a = $_[0] if defined $_[0];
32    my $p = $precision;
33    $p = $_[1] if defined $_[1];
34    my $self = Math::BigInt->new($value, $a, $p, $round_mode);
35    bless $self, $class;
36    print "MBI new '$value' => '$self' (", ref($self), ")";
37    return $self;
38}
39
40sub import {
41    print "MBI import ", join(' ', @_);
42    my $self = shift;
43    Math::BigInt::import($self, @_);            # need it for subclasses
44#    $self->export_to_level(1, $self, @_);       # need this ?
45    @_ = ();
46}
47
481;
49