1*0Sstevel@tonic-gate#!/usr/bin/perl -w 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gatepackage Math::BigInt::Trace; 4*0Sstevel@tonic-gate 5*0Sstevel@tonic-gaterequire 5.005_02; 6*0Sstevel@tonic-gateuse strict; 7*0Sstevel@tonic-gate 8*0Sstevel@tonic-gateuse Exporter; 9*0Sstevel@tonic-gateuse Math::BigInt; 10*0Sstevel@tonic-gateuse vars qw($VERSION @ISA $PACKAGE @EXPORT_OK 11*0Sstevel@tonic-gate $accuracy $precision $round_mode $div_scale); 12*0Sstevel@tonic-gate 13*0Sstevel@tonic-gate@ISA = qw(Exporter Math::BigInt); 14*0Sstevel@tonic-gate 15*0Sstevel@tonic-gate$VERSION = 0.01; 16*0Sstevel@tonic-gate 17*0Sstevel@tonic-gateuse overload; # inherit overload from BigInt 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gate# Globals 20*0Sstevel@tonic-gate$accuracy = $precision = undef; 21*0Sstevel@tonic-gate$round_mode = 'even'; 22*0Sstevel@tonic-gate$div_scale = 40; 23*0Sstevel@tonic-gate 24*0Sstevel@tonic-gatesub new 25*0Sstevel@tonic-gate{ 26*0Sstevel@tonic-gate my $proto = shift; 27*0Sstevel@tonic-gate my $class = ref($proto) || $proto; 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate my $value = shift; 30*0Sstevel@tonic-gate my $a = $accuracy; $a = $_[0] if defined $_[0]; 31*0Sstevel@tonic-gate my $p = $precision; $p = $_[1] if defined $_[1]; 32*0Sstevel@tonic-gate my $self = Math::BigInt->new($value,$a,$p,$round_mode); 33*0Sstevel@tonic-gate bless $self,$class; 34*0Sstevel@tonic-gate print "MBI new '$value' => '$self' (",ref($self),")"; 35*0Sstevel@tonic-gate return $self; 36*0Sstevel@tonic-gate} 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gatesub import 39*0Sstevel@tonic-gate { 40*0Sstevel@tonic-gate print "MBI import ",join(' ',@_); 41*0Sstevel@tonic-gate my $self = shift; 42*0Sstevel@tonic-gate Math::BigInt::import($self,@_); # need it for subclasses 43*0Sstevel@tonic-gate# $self->export_to_level(1,$self,@_); # need this ? 44*0Sstevel@tonic-gate @_ = (); 45*0Sstevel@tonic-gate } 46*0Sstevel@tonic-gate 47*0Sstevel@tonic-gate1; 48