use Carp ();
-use Math::BigFloat '1.999718';
+use Math::BigFloat 1.999718;
-our $VERSION = '0.2611';
+our $VERSION = '0.2613';
our @ISA = qw(Math::BigFloat);
my $gcd_sq = $LIB -> _gcd($LIB -> _copy($y->{_n}), $x->{_d});
$x->{_n} = $LIB -> _mul(scalar $LIB -> _div($x->{_n}, $gcd_pr),
- scalar $LIB -> _div($y->{_n}, $gcd_sq));
+ scalar $LIB -> _div($LIB -> _copy($y->{_n}),
+ $gcd_sq));
$x->{_d} = $LIB -> _mul(scalar $LIB -> _div($x->{_d}, $gcd_sq),
- scalar $LIB -> _div($y->{_d}, $gcd_pr));
+ scalar $LIB -> _div($LIB -> _copy($y->{_d}),
+ $gcd_pr));
# compute new sign
$x->{sign} = $x->{sign} eq $y->{sign} ? '+' : '-';
# value is used as the base, otherwise the base is assumed to be Euler's
# constant.
+ my ($class, $x, $base, @r);
+
# Don't objectify the base, since an undefined base, as in $x->blog() or
# $x->blog(undef) signals that the base is Euler's number.
- # set up parameters
- my ($class, $x, $base, @r) = (ref($_[0]), @_);
-
- # objectify is costly, so avoid it
- if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) {
- ($class, $x, $base, @r) = objectify(1, @_);
+ if (!ref($_[0]) && $_[0] =~ /^[A-Za-z]|::/) {
+ # E.g., Math::BigFloat->blog(256, 2)
+ ($class, $x, $base, @r) =
+ defined $_[2] ? objectify(2, @_) : objectify(1, @_);
+ } else {
+ # E.g., Math::BigFloat::blog(256, 2) or $x->blog(2)
+ ($class, $x, $base, @r) =
+ defined $_[1] ? objectify(2, @_) : objectify(1, @_);
}
return $x if $x->modify('blog');
# objectify is costly, so avoid it
if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) {
- ($class, $x, $y, @r) = objectify(2, @_);
+ ($class, $x, $y, @r) = objectify(1, @_);
}
return $x->binf(@r) if $x->{sign} eq '+inf';