summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dist/Math-BigInt/lib/Math/BigFloat.pm26
-rw-r--r--dist/Math-BigInt/lib/Math/BigInt.pm71
-rw-r--r--dist/Math-BigInt/lib/Math/BigInt/Calc.pm14
-rw-r--r--dist/Math-BigInt/lib/Math/BigInt/CalcEmu.pm4
4 files changed, 57 insertions, 58 deletions
diff --git a/dist/Math-BigInt/lib/Math/BigFloat.pm b/dist/Math-BigInt/lib/Math/BigFloat.pm
index 0830105d30..83853c286a 100644
--- a/dist/Math-BigInt/lib/Math/BigFloat.pm
+++ b/dist/Math-BigInt/lib/Math/BigFloat.pm
@@ -12,7 +12,7 @@ package Math::BigFloat;
# _a : accuracy
# _p : precision
-$VERSION = '1.99_03';
+$VERSION = '1.99_04';
require 5.006002;
require Exporter;
@@ -3864,7 +3864,7 @@ Math::BigFloat - Arbitrary size floating point math package
# The following all modify their first argument. If you want to preserve
# $x, use $z = $x->copy()->bXXX($y); See under L<CAVEATS> for why this is
# necessary when mixing $a = $b assignments with non-overloaded math.
-
+
# set
$x->bzero(); # set $i to 0
$x->bnan(); # set $i to NaN
@@ -3879,7 +3879,7 @@ Math::BigFloat - Arbitrary size floating point math package
$x->bnot(); # two's complement (bit wise not)
$x->binc(); # increment x by 1
$x->bdec(); # decrement x by 1
-
+
$x->badd($y); # addition (add $y to $x)
$x->bsub($y); # subtraction (subtract $y from $x)
$x->bmul($y); # multiplication (multiply $x by $y)
@@ -3892,20 +3892,20 @@ Math::BigFloat - Arbitrary size floating point math package
$x->blsft($y, $n); # left shift by $y places in base $n
$x->brsft($y, $n); # right shift by $y places in base $n
# returns (quo,rem) or quo if in scalar context
-
+
$x->blog(); # logarithm of $x to base e (Euler's number)
$x->blog($base); # logarithm of $x to base $base (f.i. 2)
$x->bexp(); # calculate e ** $x where e is Euler's number
-
+
$x->band($y); # bit-wise and
$x->bior($y); # bit-wise inclusive or
$x->bxor($y); # bit-wise exclusive or
$x->bnot(); # bit-wise not (two's complement)
-
+
$x->bsqrt(); # calculate square-root
$x->broot($y); # $y'th root of $x (e.g. $y == 3 => cubic root)
$x->bfac(); # factorial of $x (1*2*3*4*..$x)
-
+
$x->bround($N); # accuracy: preserve $N digits
$x->bfround($N); # precision: round to the $Nth digit
@@ -3916,7 +3916,7 @@ Math::BigFloat - Arbitrary size floating point math package
bgcd(@values); # greatest common divisor
blcm(@values); # lowest common multiplicator
-
+
$x->bstr(); # return string
$x->bsstr(); # return string in scientific notation
@@ -3926,7 +3926,7 @@ Math::BigFloat - Arbitrary size floating point math package
$x->parts(); # return (mantissa,exponent) as BigInt
$x->length(); # number of digits (w/o sign and '.')
- ($l,$f) = $x->length(); # number of digits, and length of fraction
+ ($l,$f) = $x->length(); # number of digits, and length of fraction
$x->precision(); # return P of $x (or global, if P of $x undef)
$x->precision($n); # set P of $x to $n
@@ -4071,14 +4071,14 @@ It is less confusing to either calculate the result fully, and afterwards
round it explicitly, or use the additional parameters to the math
functions like so:
- use Math::BigFloat;
+ use Math::BigFloat;
$x = Math::BigFloat->new(2);
$y = $x->copy()->bdiv(3);
print $y->bround(5),"\n"; # will give 0.66667
or
- use Math::BigFloat;
+ use Math::BigFloat;
$x = Math::BigFloat->new(2);
$y = $x->copy()->bdiv(3,5); # will give 0.66667
print "$y\n";
@@ -4252,7 +4252,7 @@ This method was added in v1.87 of Math::BigInt (June 2007).
=head2 bmuladd()
- $x->bmuladd($y,$z);
+ $x->bmuladd($y,$z);
Multiply $x by $y, and then add $z to the result.
@@ -4382,7 +4382,7 @@ The following will probably not print what you expect:
It prints both quotient and remainder since print works in list context. Also,
bdiv() will modify $c, so be careful. You probably want to use
-
+
print $c / 123.456,"\n";
print scalar $c->bdiv(123.456),"\n"; # or if you want to modify $c
diff --git a/dist/Math-BigInt/lib/Math/BigInt.pm b/dist/Math-BigInt/lib/Math/BigInt.pm
index 9ad6dd70f8..45a0f01072 100644
--- a/dist/Math-BigInt/lib/Math/BigInt.pm
+++ b/dist/Math-BigInt/lib/Math/BigInt.pm
@@ -18,7 +18,7 @@ package Math::BigInt;
my $class = "Math::BigInt";
use 5.006002;
-$VERSION = '1.99_03';
+$VERSION = '1.99_04';
@ISA = qw(Exporter);
@EXPORT_OK = qw(objectify bgcd blcm);
@@ -3261,7 +3261,7 @@ Math::BigInt - Arbitrary size integer/float math package
$x->bnot(); # two's complement (bit wise not)
$x->binc(); # increment $x by 1
$x->bdec(); # decrement $x by 1
-
+
$x->badd($y); # addition (add $y to $x)
$x->bsub($y); # subtraction (subtract $y from $x)
$x->bmul($y); # multiplication (multiply $x by $y)
@@ -3280,7 +3280,7 @@ Math::BigInt - Arbitrary size integer/float math package
$x->blsft($y,$n); # left shift by $y places in base $n
$x->brsft($y,$n); # right shift by $y places in base $n
# returns (quo,rem) or quo if in scalar context
-
+
$x->band($y); # bitwise and
$x->bior($y); # bitwise inclusive or
$x->bxor($y); # bitwise exclusive or
@@ -3295,7 +3295,7 @@ Math::BigInt - Arbitrary size integer/float math package
$x->blog(); # logarithm of $x to base e (Euler's number)
$x->blog($base); # logarithm of $x to base $base (f.i. 2)
$x->bexp(); # calculate e ** $x where e is Euler's number
-
+
$x->round($A,$P,$mode); # round to accuracy or precision using mode $mode
$x->bround($n); # accuracy: preserve $n digits
$x->bfround($n); # $n > 0: round $nth digits,
@@ -3325,7 +3325,7 @@ Math::BigInt - Arbitrary size integer/float math package
$x->copy(); # make a true copy of $x (unlike $y = $x;)
$x->as_int(); # return as BigInt (in BigInt: same as copy())
$x->numify(); # return as scalar (might overflow!)
-
+
# conversion to string (do not modify their argument)
$x->bstr(); # normalized string (e.g. '3')
$x->bsstr(); # norm. string in scientific notation (e.g. '3E0')
@@ -3381,7 +3381,7 @@ are accepted, too. Please note that octal numbers are not recognized
by new(), so the following will print "123":
perl -MMath::BigInt -le 'print Math::BigInt->new("0123")'
-
+
To convert an octal number, use from_oct();
perl -MMath::BigInt -le 'print Math::BigInt->from_oct("0123")'
@@ -3390,8 +3390,8 @@ Currently, Math::BigInt::new() defaults to 0, while Math::BigInt::new('')
results in 'NaN'. This might change in the future, so use always the following
explicit forms to get a zero or NaN:
- $zero = Math::BigInt->bzero();
- $nan = Math::BigInt->bnan();
+ $zero = Math::BigInt->bzero();
+ $nan = Math::BigInt->bnan();
C<bnorm()> on a BigInt object is now effectively a no-op, since the numbers
are always stored in normalized form. If passed a string, creates a BigInt
@@ -3460,7 +3460,7 @@ The following values can be set by passing C<config()> a reference to a hash:
upgrade downgrade precision accuracy round_mode div_scale
Example:
-
+
$new_cfg = Math::BigInt->config( { trap_inf => 1, precision => 5 } );
=head2 accuracy()
@@ -3477,7 +3477,7 @@ results have. If you set a global accuracy, then this also applies to new()!
Warning! The accuracy I<sticks>, e.g. once you created a number under the
influence of C<< CLASS->accuracy($A) >>, all results from math operations with
-that number will also be rounded.
+that number will also be rounded.
In most cases, you should probably round the results explicitly using one of
L<round()>, L<bround()> or L<bfround()> or by passing the desired accuracy
@@ -3523,7 +3523,7 @@ Math::BigInt.
# This also applies to new()!
CLASS->precision(-5); # ditto
- $P = CLASS->precision(); # read out global precision
+ $P = CLASS->precision(); # read out global precision
$P = $x->precision(); # read out precision that affects $x
Note: You probably want to use L<accuracy()> instead. With L<accuracy> you
@@ -3561,7 +3561,7 @@ Math::BigInt.
=head2 brsft()
- $x->brsft($y,$n);
+ $x->brsft($y,$n);
Shifts $x right by $y in base $n. Default is base 2, used are usually 10 and
2, but others work, too.
@@ -3648,7 +3648,6 @@ If used on an object, it will set it to one:
=head2 is_one()/is_zero()/is_nan()/is_inf()
-
$x->is_zero(); # true if arg is +0
$x->is_nan(); # true if arg is NaN
$x->is_one(); # true if arg is +1
@@ -3663,7 +3662,7 @@ like:
if ($x == 0)
=head2 is_pos()/is_neg()/is_positive()/is_negative()
-
+
$x->is_pos(); # true if > 0
$x->is_neg(); # true if < 0
@@ -3743,7 +3742,7 @@ numbers.
=head2 bnot()
- $x->bnot();
+ $x->bnot();
Two's complement (bitwise not). This is equivalent to
@@ -3971,7 +3970,7 @@ Calculates the N'th root of C<$x>.
=head2 round()
$x->round($A,$P,$round_mode);
-
+
Round $x to accuracy C<$A> or precision C<$P> using the round mode
C<$round_mode>.
@@ -3998,7 +3997,7 @@ Examples:
=head2 bfloor()
- $x->bfloor();
+ $x->bfloor();
Set $x to the integer less or equal than $x. This is a no-op in BigInt, but
does change $x in BigFloat.
@@ -4049,14 +4048,14 @@ Return the signed mantissa of $x as BigInt.
=head2 as_int()/as_number()
- $x->as_int();
+ $x->as_int();
Returns $x as a BigInt (truncated towards zero). In BigInt this is the same as
-C<copy()>.
+C<copy()>.
C<as_number()> is an alias to this method. C<as_number> was introduced in
v1.22, while C<as_int()> was only introduced in v1.68.
-
+
=head2 bstr()
$x->bstr();
@@ -4148,7 +4147,7 @@ was). It could also have p < 0, when the digits after the decimal point
are zero.
The string output (of floating point numbers) will be padded with zeros:
-
+
Initial value P A Result String
------------------------------------------------------------
1234.01 -3 1000 1000
@@ -4343,7 +4342,7 @@ This is how it works now:
Math::BigInt->accuracy(2);
Math::BigInt::SomeSubClass->accuracy(3);
- $x = Math::BigInt::SomeSubClass->new(1234);
+ $x = Math::BigInt::SomeSubClass->new(1234);
$x is now 1230, and not 1200. A subclass might choose to implement
this otherwise, e.g. falling back to the parent's A and P.
@@ -4405,7 +4404,7 @@ This is how it works now:
and P to -2, globally.
?Maybe an extra option that forbids local A & P settings would be in order,
- ?so that intermediate rounding does not 'poison' further math?
+ ?so that intermediate rounding does not 'poison' further math?
=item Overriding globals
@@ -4518,7 +4517,7 @@ have real numbers as results, the result is NaN.
=item exp(), cos(), sin(), atan2()
These all might have problems handling infinity right.
-
+
=back
=head1 INTERNALS
@@ -4610,7 +4609,7 @@ C<$e> and C<$m> will stay always the same, though their real values might
change.
=head1 EXAMPLES
-
+
use Math::BigInt;
sub bint { Math::BigInt->new(shift); }
@@ -4897,7 +4896,7 @@ So, the following examples will now work all as expected:
print "$x eq 9" if $x eq 3*3;
Additionally, the following still works:
-
+
print "$x == 9" if $x == $y;
print "$x == 9" if $x == 9;
print "$x == 9" if $x == 3*3;
@@ -4962,8 +4961,8 @@ The following will probably not do what you expect:
It prints both the number of digits in the number and in the fraction part
since print calls C<length()> in list context. Use something like:
-
- print scalar $c->length(),"\n"; # prints 3
+
+ print scalar $c->length(),"\n"; # prints 3
=item bdiv
@@ -4974,7 +4973,7 @@ The following will probably not do what you expect:
It prints both quotient and remainder since print calls C<bdiv()> in list
context. Also, C<bdiv()> will modify $c, so be careful. You probably want
to use
-
+
print $c / 10000,"\n";
print scalar $c->bdiv(10000),"\n"; # or if you want to modify $c
@@ -5038,8 +5037,8 @@ clearly the reasoning:
-inf/-inf = 1, 0 1 * -inf + 0 = -inf
inf/-inf = -1, 0 -1 * -inf + 0 = inf
-inf/ inf = -1, 0 1 * -inf + 0 = -inf
- 8/ 0 = inf, 8 inf * 0 + 8 = 8
- inf/ 0 = inf, inf inf * 0 + inf = inf
+ 8/ 0 = inf, 8 inf * 0 + 8 = 8
+ inf/ 0 = inf, inf inf * 0 + inf = inf
0/ 0 = NaN
These cases below violate the "remainder has the sign of the second of the two
@@ -5047,8 +5046,8 @@ arguments", since they wouldn't match up otherwise.
A / B = C, R so that C * B + R = A
========================================================
- -inf/ 0 = -inf, -inf -inf * 0 + inf = -inf
- -8/ 0 = -inf, -8 -inf * 0 + 8 = -8
+ -inf/ 0 = -inf, -inf -inf * 0 + inf = -inf
+ -8/ 0 = -inf, -8 -inf * 0 + 8 = -8
=item Modifying and =
@@ -5087,7 +5086,7 @@ modify $x, the last one won't:
print bpow($x,$i),"\n"; # modify $x
print $x->bpow($i),"\n"; # ditto
print $x **= $i,"\n"; # the same
- print $x ** $i,"\n"; # leave $x alone
+ print $x ** $i,"\n"; # leave $x alone
The form C<$x **= $y> is faster than C<$x = $x ** $y;>, though.
@@ -5137,7 +5136,7 @@ the result should be a Math::BigFloat or the second operant is one.
To get a Math::BigFloat you either need to call the operation manually,
make sure the operands are already of the proper type or casted to that type
via Math::BigFloat->new():
-
+
$float = Math::BigFloat->new($mbi2) / $mbi; # = 2.5
Beware of simple "casting" the entire expression, this would only convert
@@ -5154,7 +5153,7 @@ If in doubt, break the expression into simpler terms, or cast all operands
to the desired resulting type.
Scalar values are a bit different, since:
-
+
$float = 2 + $mbf;
$float = $mbf + 2;
diff --git a/dist/Math-BigInt/lib/Math/BigInt/Calc.pm b/dist/Math-BigInt/lib/Math/BigInt/Calc.pm
index 6a68579439..2033cef996 100644
--- a/dist/Math-BigInt/lib/Math/BigInt/Calc.pm
+++ b/dist/Math-BigInt/lib/Math/BigInt/Calc.pm
@@ -4,7 +4,7 @@ use 5.006002;
use strict;
# use warnings; # dont use warnings for older Perls
-our $VERSION = '1.99_03';
+our $VERSION = '1.99_04';
# Package to store unsigned big integers in decimal and do math with them
@@ -2480,7 +2480,7 @@ Math::BigInt v1.70 or later:
NOTE: because of Perl numeric notation defaults,
the _num'ified obj may lose accuracy due to
machine-dependent floating point size limitations
-
+
_add(obj,obj) Simple addition of two objects
_mul(obj,obj) Multiplication of two objects
_div(obj,obj) Division of the 1st object by the 2nd
@@ -2518,17 +2518,17 @@ Math::BigInt v1.70 or later:
_from_hex(str) return new object from a hexadecimal string
_from_bin(str) return new object from a binary string
_from_oct(str) return new object from an octal string
-
+
_as_hex(str) return string containing the value as
unsigned hex string, with the '0x' prepended.
Leading zeros must be stripped.
_as_bin(str) Like as_hex, only as binary string containing only
zeros and ones. Leading zeros must be stripped and a
'0b' must be prepended.
-
+
_rsft(obj,N,B) shift object in base B by N 'digits' right
_lsft(obj,N,B) shift object in base B by N 'digits' left
-
+
_xor(obj1,obj2) XOR (bit-wise) object 1 with object 2
Note: XOR, AND and OR pad with zeros if size mismatches
_and(obj1,obj2) AND (bit-wise) object 1 with object 2
@@ -2562,7 +2562,7 @@ The following functions are REQUIRED for an api_version of 2 or greater:
The following functions are optional, and can be defined if the underlying lib
has a fast way to do them. If undefined, Math::BigInt will use pure Perl (hence
slow) fallback routines to emulate these:
-
+
_signed_or
_signed_and
_signed_xor
@@ -2599,7 +2599,7 @@ by this:
This way you ensure that your library really works 100% within Math::BigInt.
=head1 LICENSE
-
+
This program is free software; you may redistribute it and/or modify it under
the same terms as Perl itself.
diff --git a/dist/Math-BigInt/lib/Math/BigInt/CalcEmu.pm b/dist/Math-BigInt/lib/Math/BigInt/CalcEmu.pm
index 9b614598a2..cf2a76f029 100644
--- a/dist/Math-BigInt/lib/Math/BigInt/CalcEmu.pm
+++ b/dist/Math-BigInt/lib/Math/BigInt/CalcEmu.pm
@@ -5,7 +5,7 @@ use strict;
# use warnings; # dont use warnings for older Perls
use vars qw/$VERSION/;
-$VERSION = '1.99_02';
+$VERSION = '1.99_03';
package Math::BigInt;
@@ -312,7 +312,7 @@ using a call to the native lib.
=head2 __emu_bior
=head1 LICENSE
-
+
This program is free software; you may redistribute it and/or modify it under
the same terms as Perl itself.