Track /etc/gitconfig
[msysgit.git] / lib / perl5 / 5.8.8 / Math / BigFloat / Trace.pm
blob871b2a969e8687bf13bf3dcdc696ae8e82506b9f
1 #!/usr/bin/perl -w
3 package Math::BigFloat::Trace;
5 require 5.005_02;
6 use strict;
8 use Exporter;
9 use Math::BigFloat;
10 use vars qw($VERSION @ISA $PACKAGE @EXPORT_OK
11 $accuracy $precision $round_mode $div_scale);
13 @ISA = qw(Exporter Math::BigFloat);
15 $VERSION = 0.01;
17 use overload; # inherit overload from BigFloat
19 # Globals
20 $accuracy = $precision = undef;
21 $round_mode = 'even';
22 $div_scale = 40;
24 sub new
26 my $proto = shift;
27 my $class = ref($proto) || $proto;
29 my $value = shift;
30 my $a = $accuracy; $a = $_[0] if defined $_[0];
31 my $p = $precision; $p = $_[1] if defined $_[1];
32 my $self = Math::BigFloat->new($value,$a,$p,$round_mode);
34 # remember, downgrading may return a BigInt, so don't meddle with class
35 # bless $self,$class;
37 print "MBF new '$value' => '$self' (",ref($self),")";
38 return $self;
41 sub import
43 print "MBF import ",join(' ',@_);
44 my $self = shift;
46 # we catch the constants, the rest goes go BigFloat
47 my @a = ();
48 foreach (@_)
50 push @a, $_ if $_ ne ':constant';
52 overload::constant float => sub { $self->new(shift); };
54 Math::BigFloat->import(@a); # need it for subclasses
55 # $self->export_to_level(1,$self,@_); # need this ?