This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade Math::BigInt from version 1.999707 to 1.999710
authorSteve Hay <steve.m.hay@googlemail.com>
Tue, 17 Nov 2015 13:18:20 +0000 (13:18 +0000)
committerSteve Hay <steve.m.hay@googlemail.com>
Tue, 17 Nov 2015 13:18:20 +0000 (13:18 +0000)
14 files changed:
MANIFEST
Porting/Maintainers.pl
cpan/Math-BigInt/lib/Math/BigFloat.pm
cpan/Math-BigInt/lib/Math/BigInt.pm
cpan/Math-BigInt/lib/Math/BigInt/Calc.pm
cpan/Math-BigInt/lib/Math/BigInt/CalcEmu.pm
cpan/Math-BigInt/t/bigfltpm.inc
cpan/Math-BigInt/t/bigfltpm.t
cpan/Math-BigInt/t/bigintpm.inc
cpan/Math-BigInt/t/calling.t
cpan/Math-BigInt/t/from_hex-mbf.t [new file with mode: 0644]
cpan/Math-BigInt/t/mbimbf.inc
cpan/Math-BigInt/t/mbimbf.t
cpan/Math-BigInt/t/upgrade.inc

index bf2414b..ad20f6f 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -1664,6 +1664,7 @@ cpan/Math-BigInt/t/constant.t             Test Math::BigInt/BigFloat under :constant
 cpan/Math-BigInt/t/const_mbf.t         Test Math::BigInt
 cpan/Math-BigInt/t/downgrade.t         Test if use Math::BigInt(); under downgrade works
 cpan/Math-BigInt/t/_e_math.t           Helper routine in BigFloat for _e math
 cpan/Math-BigInt/t/const_mbf.t         Test Math::BigInt
 cpan/Math-BigInt/t/downgrade.t         Test if use Math::BigInt(); under downgrade works
 cpan/Math-BigInt/t/_e_math.t           Helper routine in BigFloat for _e math
+cpan/Math-BigInt/t/from_hex-mbf.t      Test Math::BigInt
 cpan/Math-BigInt/t/inf_nan.t           Special tests for inf and *NaN* handling
 cpan/Math-BigInt/t/isa.t               Test for Math::BigInt inheritance
 cpan/Math-BigInt/t/lib_load.t          Test sane lib names
 cpan/Math-BigInt/t/inf_nan.t           Special tests for inf and *NaN* handling
 cpan/Math-BigInt/t/isa.t               Test for Math::BigInt inheritance
 cpan/Math-BigInt/t/lib_load.t          Test sane lib names
index 3060225..7554876 100755 (executable)
@@ -722,7 +722,7 @@ use File::Glob qw(:case);
     },
 
     'Math::BigInt' => {
     },
 
     'Math::BigInt' => {
-        'DISTRIBUTION' => 'PJACKLAM/Math-BigInt-1.999707.tar.gz',
+        'DISTRIBUTION' => 'PJACKLAM/Math-BigInt-1.999710.tar.gz',
         'FILES'        => q[cpan/Math-BigInt],
         'EXCLUDED'     => [
             qr{^inc/},
         'FILES'        => q[cpan/Math-BigInt],
         'EXCLUDED'     => [
             qr{^inc/},
index f89d562..a36c854 100644 (file)
@@ -16,7 +16,7 @@ use 5.006002;
 use strict;
 use warnings;
 
 use strict;
 use warnings;
 
-our $VERSION = '1.999707';
+our $VERSION = '1.999710';
 
 require Exporter;
 our @ISA       = qw/Math::BigInt/;
 
 require Exporter;
 our @ISA       = qw/Math::BigInt/;
@@ -223,10 +223,10 @@ sub new
       }
     $self->{sign} = $$mis;
 
       }
     $self->{sign} = $$mis;
 
-    # for something like 0Ey, set y to 1, and -0 => +0
+    # for something like 0Ey, set y to 0, and -0 => +0
     # Check $$miv for being '0' and $$mfv eq '', because otherwise _m could not
     # have become 0. That's faster than to call $MBI->_is_zero().
     # Check $$miv for being '0' and $$mfv eq '', because otherwise _m could not
     # have become 0. That's faster than to call $MBI->_is_zero().
-    $self->{sign} = '+', $self->{_e} = $MBI->_one()
+    $self->{sign} = '+', $self->{_e} = $MBI->_zero()
      if $$miv eq '0' and $$mfv eq '';
 
     return $self->round(@r) if !$downgrade;
      if $$miv eq '0' and $$mfv eq '';
 
     return $self->round(@r) if !$downgrade;
@@ -321,11 +321,11 @@ sub _bone
 
 sub _bzero
   {
 
 sub _bzero
   {
-  # used by parent class bone() to initialize number to 0
+  # used by parent class bzero() to initialize number to 0
   my $self = shift;
   $IMPORT=1;                                   # call our import only once
   $self->{_m} = $MBI->_zero();
   my $self = shift;
   $IMPORT=1;                                   # call our import only once
   $self->{_m} = $MBI->_zero();
-  $self->{_e} = $MBI->_one();
+  $self->{_e} = $MBI->_zero();
   $self->{_es} = '+';
   }
 
   $self->{_es} = '+';
   }
 
@@ -4007,6 +4007,89 @@ sub length
   $len;
   }
 
   $len;
   }
 
+sub from_hex {
+    my $self    = shift;
+    my $selfref = ref $self;
+    my $class   = $selfref || $self;
+
+    my $str = shift;
+
+    $self = $class -> bzero() unless $selfref;
+
+    if ($str =~ s/
+                     ^
+
+                     # sign
+                     ( [+-]? )
+
+                     # optional "hex marker"
+                     (?: 0? x )?
+
+                     # significand using the hex digits 0..9 and a..f
+                     (
+                         [0-9a-fA-F]+ (?: _ [0-9a-fA-F]+ )*
+                         (?:
+                             \.
+                             (?: [0-9a-fA-F]+ (?: _ [0-9a-fA-F]+ )* )?
+                         )?
+                     |
+                         \.
+                         [0-9a-fA-F]+ (?: _ [0-9a-fA-F]+ )*
+                     )
+
+                     # exponent (power of 2) using decimal digits
+                     (?:
+                         [Pp]
+                         ( [+-]? )
+                         ( \d+ (?: _ \d+ )* )
+                     )?
+
+                     $
+                 //x)
+    {
+        my $s_sign  = $1 || '+';
+        my $s_value = $2;
+        my $e_sign  = $3 || '+';
+        my $e_value = $4 || '0';
+        $s_value =~ tr/_//d;
+        $e_value =~ tr/_//d;
+
+        # The significand must be multiplied by 2 raised to this exponent.
+
+        my $two_expon = $class -> new($e_value);
+        $two_expon -> bneg() if $e_sign eq '-';
+
+        # If there is a dot in the significand, remove it and adjust the
+        # exponent according to the number of digits in the fraction part of
+        # the significand. Multiply the exponent adjustment value by 4 since
+        # the digits in the significand are in base 16, but the exponent is
+        # only in base 2.
+
+        my $idx = index($s_value, '.');
+        if ($idx >= 0) {
+            substr($s_value, $idx, 1) = '';
+            $two_expon -= $class -> new(CORE::length($s_value))
+                                 -> bsub($idx)
+                                 -> bmul("4");
+        }
+
+        $self -> {sign} = $s_sign;
+        $self -> {_m}   = $MBI -> _from_hex('0x' . $s_value);
+
+        if ($two_expon > 0) {
+            my $factor = $class -> new("2") -> bpow($two_expon);
+            $self -> bmul($factor);
+        } elsif ($two_expon < 0) {
+            my $factor = $class -> new("0.5") -> bpow(-$two_expon);
+            $self -> bmul($factor);
+        }
+
+        return $self;
+    }
+
+    return $self->bnan();
+}
+
 1;
 
 __END__
 1;
 
 __END__
@@ -4030,6 +4113,9 @@ Math::BigFloat - Arbitrary size floating point math package
  my $inf = Math::BigFloat->binf('-');  # create a -inf
  my $one = Math::BigFloat->bone();     # create a +1
  my $mone = Math::BigFloat->bone('-'); # create a -1
  my $inf = Math::BigFloat->binf('-');  # create a -inf
  my $one = Math::BigFloat->bone();     # create a +1
  my $mone = Math::BigFloat->bone('-'); # create a -1
+ my $x = Math::BigFloat->bone('-');    #
+
+ my $h = Math::BigFloat->from_hex('0xc.afep+3');    # from hexadecimal
 
  my $pi = Math::BigFloat->bpi(100);    # PI to 100 digits
 
 
  my $pi = Math::BigFloat->bpi(100);    # PI to 100 digits
 
@@ -4219,8 +4305,6 @@ as BigInts such that:
 
 C<< ($m,$e) = $x->parts(); >> is just a shortcut giving you both of them.
 
 
 C<< ($m,$e) = $x->parts(); >> is just a shortcut giving you both of them.
 
-A zero is represented and returned as C<0E1>, B<not> C<0E0> (after Knuth).
-
 Currently the mantissa is reduced as much as possible, favouring higher
 exponents over lower ones (e.g. returning 1e7 instead of 10e6 or 10000000e0).
 This might change in the future, so do not depend on it.
 Currently the mantissa is reduced as much as possible, favouring higher
 exponents over lower ones (e.g. returning 1e7 instead of 10e6 or 10000000e0).
 This might change in the future, so do not depend on it.
@@ -4286,26 +4370,26 @@ functions like so:
 
 =over
 
 
 =over
 
-=item ffround ( +$scale )
+=item bfround ( +$scale )
 
 Rounds to the $scale'th place left from the '.', counting from the dot.
 The first digit is numbered 1. 
 
 
 Rounds to the $scale'th place left from the '.', counting from the dot.
 The first digit is numbered 1. 
 
-=item ffround ( -$scale )
+=item bfround ( -$scale )
 
 Rounds to the $scale'th place right from the '.', counting from the dot.
 
 
 Rounds to the $scale'th place right from the '.', counting from the dot.
 
-=item ffround ( 0 )
+=item bfround ( 0 )
 
 Rounds to an integer.
 
 
 Rounds to an integer.
 
-=item fround  ( +$scale )
+=item bround  ( +$scale )
 
 Preserves accuracy to $scale digits from the left (aka significant digits)
 and pads the rest with zeros. If the number is between 1 and -1, the
 significant digits count from the first non-zero after the '.'
 
 
 Preserves accuracy to $scale digits from the left (aka significant digits)
 and pads the rest with zeros. If the number is between 1 and -1, the
 significant digits count from the first non-zero after the '.'
 
-=item fround  ( -$scale ) and fround ( 0 )
+=item bround  ( -$scale ) and bround ( 0 )
 
 These are effectively no-ops.
 
 
 These are effectively no-ops.
 
@@ -4498,6 +4582,17 @@ C<ref($x)-E<gt>new()> can parse to create an object.
 
 In Math::BigFloat, C<as_float()> has the same effect as C<copy()>.
 
 
 In Math::BigFloat, C<as_float()> has the same effect as C<copy()>.
 
+=item from_hex()
+
+    $x -> from_hex("0x1.921fb54442d18p+1");
+    $x = Math::BigFloat -> from_hex("0x1.921fb54442d18p+1");
+
+Interpret input as a hexadecimal string. A "0x" or "x" prefix is optional. A
+single underscore character may be placed between any two digits. If the input
+is invalid, a NaN is returned. The exponent is in base 2 using decimal digits.
+
+If called as an instance method, the value is assigned to the invocand.
+
 =back
 
 =head1 Autocreating constants
 =back
 
 =head1 Autocreating constants
index 5a134fc..23f9401 100644 (file)
@@ -19,7 +19,7 @@ use 5.006002;
 use strict;
 use warnings;
 
 use strict;
 use warnings;
 
-our $VERSION = '1.999707';
+our $VERSION = '1.999710';
 
 our @ISA = qw(Exporter);
 our @EXPORT_OK = qw(objectify bgcd blcm);
 
 our @ISA = qw(Exporter);
 our @EXPORT_OK = qw(objectify bgcd blcm);
@@ -887,7 +887,7 @@ sub _find_round_parameters
 
   # This procedure finds the round parameters, but it is for speed reasons
   # duplicated in round. Otherwise, it is tested by the testsuite and used
 
   # This procedure finds the round parameters, but it is for speed reasons
   # duplicated in round. Otherwise, it is tested by the testsuite and used
-  # by fdiv().
+  # by bdiv().
 
   # returns ($self) or ($self,$a,$p,$r) - sets $self to NaN of both A and P
   # were requested/defined (locally or globally or both)
 
   # returns ($self) or ($self,$a,$p,$r) - sets $self to NaN of both A and P
   # were requested/defined (locally or globally or both)
@@ -1003,7 +1003,7 @@ sub round
     require Carp; Carp::croak ("Unknown round mode '$r'");
     }
 
     require Carp; Carp::croak ("Unknown round mode '$r'");
     }
 
-  # now round, by calling either fround or ffround:
+  # now round, by calling either bround or bfround:
   if (defined $a)
     {
     $self->bround(int($a),$r) if !defined $self->{_a} || $self->{_a} >= $a;
   if (defined $a)
     {
     $self->bround(int($a),$r) if !defined $self->{_a} || $self->{_a} >= $a;
@@ -2510,7 +2510,7 @@ sub exponent
     my $s = $x->{sign}; $s =~ s/^[+-]//;  # NaN, -inf,+inf => NaN or inf
     return $self->new($s);
     }
     my $s = $x->{sign}; $s =~ s/^[+-]//;  # NaN, -inf,+inf => NaN or inf
     return $self->new($s);
     }
-  return $self->bone() if $x->is_zero();
+  return $self->bzero() if $x->is_zero();
 
   # 12300 => 2 trailing zeros => exponent is 2
   $self->new( $CALC->_zeros($x->{value}) );
 
   # 12300 => 2 trailing zeros => exponent is 2
   $self->new( $CALC->_zeros($x->{value}) );
@@ -3505,6 +3505,8 @@ Math::BigInt - Arbitrary size integer/float math package
   $h = Math::BigInt->new('0x123');     # from hexadecimal
   $b = Math::BigInt->new('0b101');     # from binary
   $o = Math::BigInt->from_oct('0101'); # from octal
   $h = Math::BigInt->new('0x123');     # from hexadecimal
   $b = Math::BigInt->new('0b101');     # from binary
   $o = Math::BigInt->from_oct('0101'); # from octal
+  $h = Math::BigInt->from_hex('cafe'); # from hexadecimal
+  $b = Math::BigInt->from_bin('0101'); # from binary
 
   # Testing (don't modify their arguments)
   # (return true if the condition is met, otherwise false)
 
   # Testing (don't modify their arguments)
   # (return true if the condition is met, otherwise false)
@@ -4605,21 +4607,21 @@ versions <= 5.7.2) is like this:
 
 =item Precision
 
 
 =item Precision
 
-  * ffround($p) is able to round to $p number of digits after the decimal
+  * bfround($p) is able to round to $p number of digits after the decimal
     point
   * otherwise P is unused
 
 =item Accuracy (significant digits)
 
     point
   * otherwise P is unused
 
 =item Accuracy (significant digits)
 
-  * fround($a) rounds to $a significant digits
-  * only fdiv() and fsqrt() take A as (optional) parameter
-    + other operations simply create the same number (fneg etc), or
-      more (fmul) of digits
+  * bround($a) rounds to $a significant digits
+  * only bdiv() and bsqrt() take A as (optional) parameter
+    + other operations simply create the same number (bneg etc), or
+      more (bmul) of digits
     + rounding/truncating is only done when explicitly calling one
     + rounding/truncating is only done when explicitly calling one
-      of fround or ffround, and never for BigInt (not implemented)
-  * fsqrt() simply hands its accuracy argument over to fdiv.
+      of bround or bfround, and never for BigInt (not implemented)
+  * bsqrt() simply hands its accuracy argument over to bdiv.
   * the documentation and the comment in the code indicate two
   * the documentation and the comment in the code indicate two
-    different ways on how fdiv() determines the maximum number
+    different ways on how bdiv() determines the maximum number
     of digits it should calculate, and the actual code does yet
     another thing
     POD:
     of digits it should calculate, and the actual code does yet
     another thing
     POD:
@@ -4717,22 +4719,22 @@ This is how it works now:
     effect, and the other P, this results in an error (NaN).
   * A takes precedence over P (Hint: A comes before P).
     If neither of them is defined, nothing is used, i.e. the result will have
     effect, and the other P, this results in an error (NaN).
   * A takes precedence over P (Hint: A comes before P).
     If neither of them is defined, nothing is used, i.e. the result will have
-    as many digits as it can (with an exception for fdiv/fsqrt) and will not
+    as many digits as it can (with an exception for bdiv/bsqrt) and will not
     be rounded.
     be rounded.
-  * There is another setting for fdiv() (and thus for fsqrt()). If neither of
-    A or P is defined, fdiv() will use a fallback (F) of $div_scale digits.
+  * There is another setting for bdiv() (and thus for bsqrt()). If neither of
+    A or P is defined, bdiv() will use a fallback (F) of $div_scale digits.
     If either the dividend's or the divisor's mantissa has more digits than
     the value of F, the higher value will be used instead of F.
     This is to limit the digits (A) of the result (just consider what would
     happen with unlimited A and P in the case of 1/3 :-)
     If either the dividend's or the divisor's mantissa has more digits than
     the value of F, the higher value will be used instead of F.
     This is to limit the digits (A) of the result (just consider what would
     happen with unlimited A and P in the case of 1/3 :-)
-  * fdiv will calculate (at least) 4 more digits than required (determined by
+  * bdiv will calculate (at least) 4 more digits than required (determined by
     A, P or F), and, if F is not used, round the result
     (this will still fail in the case of a result like 0.12345000000001 with A
     or P of 5, but this can not be helped - or can it?)
   * Thus you can have the math done by on Math::Big* class in two modi:
     + never round (this is the default):
       This is done by setting A and P to undef. No math operation
     A, P or F), and, if F is not used, round the result
     (this will still fail in the case of a result like 0.12345000000001 with A
     or P of 5, but this can not be helped - or can it?)
   * Thus you can have the math done by on Math::Big* class in two modi:
     + never round (this is the default):
       This is done by setting A and P to undef. No math operation
-      will round the result, with fdiv() and fsqrt() as exceptions to guard
+      will round the result, with bdiv() and bsqrt() as exceptions to guard
       against overflows. You must explicitly call bround(), bfround() or
       round() (the latter with parameters).
       Note: Once you have rounded a number, the settings will 'stick' on it
       against overflows. You must explicitly call bround(), bfround() or
       round() (the latter with parameters).
       Note: Once you have rounded a number, the settings will 'stick' on it
@@ -4743,7 +4745,7 @@ This is how it works now:
         $x = Math::BigFloat->new(12.34);
         $y = Math::BigFloat->new(98.76);
         $z = $x * $y;                           # 1218.6984
         $x = Math::BigFloat->new(12.34);
         $y = Math::BigFloat->new(98.76);
         $z = $x * $y;                           # 1218.6984
-        print $x->copy()->fround(3);            # 12.3 (but A is now 3!)
+        print $x->copy()->bround(3);            # 12.3 (but A is now 3!)
         $z = $x * $y;                           # still 1218.6984, without
                                                 # copy would have been 1210!
 
         $z = $x * $y;                           # still 1218.6984, without
                                                 # copy would have been 1210!
 
@@ -4773,7 +4775,7 @@ This is how it works now:
       + global A
       + global P
       + global F
       + global A
       + global P
       + global F
-  * fsqrt() will hand its arguments to fdiv(), as it used to, only now for two
+  * bsqrt() will hand its arguments to bdiv(), as it used to, only now for two
     arguments (A and P) instead of one
 
 =item Local settings
     arguments (A and P) instead of one
 
 =item Local settings
@@ -4787,8 +4789,7 @@ This is how it works now:
 =item Rounding
 
   * the rounding routines will use the respective global or local settings.
 =item Rounding
 
   * the rounding routines will use the respective global or local settings.
-    fround()/bround() is for accuracy rounding, while ffround()/bfround()
-    is for precision
+    bround() is for accuracy rounding, while bfround() is for precision
   * the two rounding functions take as the second parameter one of the
     following rounding modes (R):
     'even', 'odd', '+inf', '-inf', 'zero', 'trunc', 'common'
   * the two rounding functions take as the second parameter one of the
     following rounding modes (R):
     'even', 'odd', '+inf', '-inf', 'zero', 'trunc', 'common'
@@ -4819,7 +4820,7 @@ This is how it works now:
 =item Remarks
 
   * The defaults are set up so that the new code gives the same results as
 =item Remarks
 
   * The defaults are set up so that the new code gives the same results as
-    the old code (except in a few cases on fdiv):
+    the old code (except in a few cases on bdiv):
     + Both A and P are undefined and thus will not be used for rounding
       after each operation.
     + round() is thus a no-op, unless given extra parameters A and P
     + Both A and P are undefined and thus will not be used for rounding
       after each operation.
     + round() is thus a no-op, unless given extra parameters A and P
@@ -4990,20 +4991,20 @@ Examples for rounding:
   $y = Math::BigFloat->new(123.456789);
   Math::BigFloat->accuracy(4);         # no more A than 4
 
   $y = Math::BigFloat->new(123.456789);
   Math::BigFloat->accuracy(4);         # no more A than 4
 
-  is ($x->copy()->fround(),123.4);     # even rounding
-  print $x->copy()->fround(),"\n";     # 123.4
+  is ($x->copy()->bround(),123.4);     # even rounding
+  print $x->copy()->bround(),"\n";     # 123.4
   Math::BigFloat->round_mode('odd');   # round to odd
   Math::BigFloat->round_mode('odd');   # round to odd
-  print $x->copy()->fround(),"\n";     # 123.5
+  print $x->copy()->bround(),"\n";     # 123.5
   Math::BigFloat->accuracy(5);         # no more A than 5
   Math::BigFloat->round_mode('odd');   # round to odd
   Math::BigFloat->accuracy(5);         # no more A than 5
   Math::BigFloat->round_mode('odd');   # round to odd
-  print $x->copy()->fround(),"\n";     # 123.46
-  $y = $x->copy()->fround(4),"\n";     # A = 4: 123.4
+  print $x->copy()->bround(),"\n";     # 123.46
+  $y = $x->copy()->bround(4),"\n";     # A = 4: 123.4
   print "$y, ",$y->accuracy(),"\n";    # 123.4, 4
 
   Math::BigFloat->accuracy(undef);     # A not important now
   Math::BigFloat->precision(2);        # P important
   print $x->copy()->bnorm(),"\n";      # 123.46
   print "$y, ",$y->accuracy(),"\n";    # 123.4, 4
 
   Math::BigFloat->accuracy(undef);     # A not important now
   Math::BigFloat->precision(2);        # P important
   print $x->copy()->bnorm(),"\n";      # 123.46
-  print $x->copy()->fround(),"\n";     # 123.46
+  print $x->copy()->bround(),"\n";     # 123.46
 
 Examples for converting:
 
 
 Examples for converting:
 
@@ -5617,15 +5618,15 @@ Mark Biggar, overloaded interface by Ilya Zakharevich, 1996-2001.
 
 =item *
 
 
 =item *
 
-Completely rewritten by Tels L<http://bloodgate.com> in 2001-2008.
+Completely rewritten by Tels L<http://bloodgate.com>, 2001-2008.
 
 =item *
 
 
 =item *
 
-Florian Ragwitz L<flora@cpan.org>, 2010.
+Florian Ragwitz E<lt>flora@cpan.orgE<gt>, 2010.
 
 =item *
 
 
 =item *
 
-Peter John Acklam, L<pjacklam@online.no>, 2011-.
+Peter John Acklam E<lt>pjacklam@online.noE<gt>, 2011-.
 
 =back
 
 
 =back
 
index 394c835..46b41e1 100644 (file)
@@ -4,7 +4,7 @@ use 5.006002;
 use strict;
 use warnings;
 
 use strict;
 use warnings;
 
-our $VERSION = '1.999707';
+our $VERSION = '1.999710';
 
 # Package to store unsigned big integers in decimal and do math with them
 
 
 # Package to store unsigned big integers in decimal and do math with them
 
index e12b151..973566f 100644 (file)
@@ -4,7 +4,7 @@ use 5.006002;
 use strict;
 use warnings;
 
 use strict;
 use warnings;
 
-our $VERSION = '1.999707';
+our $VERSION = '1.999710';
 
 package Math::BigInt;
 
 
 package Math::BigInt;
 
index c601cc2..158b3aa 100644 (file)
@@ -33,18 +33,18 @@ while (<DATA>)
       @args = split(/:/,$_,99); $ans = pop(@args);
       }
     $try = "\$x = $class->new(\"$args[0]\");";
       @args = split(/:/,$_,99); $ans = pop(@args);
       }
     $try = "\$x = $class->new(\"$args[0]\");";
-    if ($f eq "fnorm")
+    if ($f eq "bnorm")
       {
         $try .= "\$x;";
       {
         $try .= "\$x;";
-      } elsif ($f eq "finf") {
-        $try .= "\$x->finf('$args[1]');";
+      } elsif ($f eq "binf") {
+        $try .= "\$x->binf('$args[1]');";
       } elsif ($f eq "is_inf") {
         $try .= "\$x->is_inf('$args[1]');"; 
       } elsif ($f eq "is_inf") {
         $try .= "\$x->is_inf('$args[1]');"; 
-      } elsif ($f eq "fone") {
+      } elsif ($f eq "bone") {
         $try .= "\$x->bone('$args[1]');";
         $try .= "\$x->bone('$args[1]');";
-      } elsif ($f eq "fstr") {
+      } elsif ($f eq "bstr") {
         $try .= "\$x->accuracy($args[1]); \$x->precision($args[2]);";
         $try .= "\$x->accuracy($args[1]); \$x->precision($args[2]);";
-        $try .= '$x->fstr();';
+        $try .= '$x->bstr();';
       } elsif ($f eq "parts") {
         # ->bstr() to see if an object is returned
         $try .= '($a,$b) = $x->parts(); $a = $a->bstr(); $b = $b->bstr();';
       } elsif ($f eq "parts") {
         # ->bstr() to see if an object is returned
         $try .= '($a,$b) = $x->parts(); $a = $a->bstr(); $b = $b->bstr();';
@@ -57,9 +57,9 @@ while (<DATA>)
         $try .= '$x->mantissa()->bstr();';
       } elsif ($f =~ /^(numify|length|as_number|as_hex|as_bin)$/) {
         $try .= "\$x->$f();";
         $try .= '$x->mantissa()->bstr();';
       } elsif ($f =~ /^(numify|length|as_number|as_hex|as_bin)$/) {
         $try .= "\$x->$f();";
-      # some unary ops (test the fxxx form, since that is done by AUTOLOAD)
-      } elsif ($f =~ /^f(nan|sstr|neg|floor|ceil|int|abs)$/) {
-        $try .= "\$x->f$1();";
+      # some unary ops
+      } elsif ($f =~ /^b(nan|sstr|neg|floor|ceil|int|abs)$/) {
+        $try .= "\$x->$f();";
       # overloaded functions
       } elsif ($f =~ /^(log|exp|sin|cos|atan2|int|neg|abs|sqrt)$/) {
         $try .= "\$x = $f(\$x);";
       # overloaded functions
       } elsif ($f =~ /^(log|exp|sin|cos|atan2|int|neg|abs|sqrt)$/) {
         $try .= "\$x = $f(\$x);";
@@ -68,27 +68,27 @@ while (<DATA>)
         $try .= "\$x->$f();";
       } elsif ($f eq "bpi") {
         $try .= '$class->bpi($x);';
         $try .= "\$x->$f();";
       } elsif ($f eq "bpi") {
         $try .= '$class->bpi($x);';
-      } elsif ($f eq "finc") {
+      } elsif ($f eq "binc") {
         $try .= '++$x;';
         $try .= '++$x;';
-      } elsif ($f eq "fdec") {
+      } elsif ($f eq "bdec") {
         $try .= '--$x;';
         $try .= '--$x;';
-      }elsif ($f eq "fround") {
-        $try .= "$setup; \$x->fround($args[1]);";
-      } elsif ($f eq "ffround") {
-        $try .= "$setup; \$x->ffround($args[1]);";
-      } elsif ($f eq "fsqrt") {
-        $try .= "$setup; \$x->fsqrt();";
-      } elsif ($f eq "ffac") {
-        $try .= "$setup; \$x->ffac();";
-      } elsif ($f eq "flog") {
+      }elsif ($f eq "bround") {
+        $try .= "$setup; \$x->bround($args[1]);";
+      } elsif ($f eq "bfround") {
+        $try .= "$setup; \$x->bfround($args[1]);";
+      } elsif ($f eq "bsqrt") {
+        $try .= "$setup; \$x->bsqrt();";
+      } elsif ($f eq "bfac") {
+        $try .= "$setup; \$x->bfac();";
+      } elsif ($f eq "blog") {
         if (defined $args[1] && $args[1] ne '')
           {
           $try .= "\$y = $class->new($args[1]);";
         if (defined $args[1] && $args[1] ne '')
           {
           $try .= "\$y = $class->new($args[1]);";
-          $try .= "$setup; \$x->flog(\$y);";
+          $try .= "$setup; \$x->blog(\$y);";
           }
         else
           {
           }
         else
           {
-          $try .= "$setup; \$x->flog();";
+          $try .= "$setup; \$x->blog();";
           }
       }
     else
           }
       }
     else
@@ -114,11 +114,11 @@ while (<DATA>)
         $try .= "$class\::blcm(\$x, \$y";
         $try .= ", \$z" if (defined $args[2]);
         $try .= " );";
         $try .= "$class\::blcm(\$x, \$y";
         $try .= ", \$z" if (defined $args[2]);
         $try .= " );";
-      } elsif ($f eq "fcmp") {
-        $try .= '$x->fcmp($y);';
-      } elsif ($f eq "facmp") {
-        $try .= '$x->facmp($y);';
-      } elsif ($f eq "fpow") {
+      } elsif ($f eq "bcmp") {
+        $try .= '$x->bcmp($y);';
+      } elsif ($f eq "bacmp") {
+        $try .= '$x->bacmp($y);';
+      } elsif ($f eq "bpow") {
         $try .= '$x ** $y;';
       } elsif ($f eq "bnok") {
         $try .= '$x->bnok($y);';
         $try .= '$x ** $y;';
       } elsif ($f eq "bnok") {
         $try .= '$x->bnok($y);';
@@ -128,23 +128,23 @@ while (<DATA>)
         $try .= '$x->bsin($y);';
       } elsif ($f eq "batan") {
         $try .= '$x->batan($y);';
         $try .= '$x->bsin($y);';
       } elsif ($f eq "batan") {
         $try .= '$x->batan($y);';
-      } elsif ($f eq "froot") {
-        $try .= "$setup; \$x->froot(\$y);";
-      } elsif ($f eq "fadd") {
+      } elsif ($f eq "broot") {
+        $try .= "$setup; \$x->broot(\$y);";
+      } elsif ($f eq "badd") {
         $try .= '$x + $y;';
         $try .= '$x + $y;';
-      } elsif ($f eq "fsub") {
+      } elsif ($f eq "bsub") {
         $try .= '$x - $y;';
         $try .= '$x - $y;';
-      } elsif ($f eq "fmul") {
+      } elsif ($f eq "bmul") {
         $try .= '$x * $y;';
         $try .= '$x * $y;';
-      } elsif ($f eq "fdiv") {
+      } elsif ($f eq "bdiv") {
         $try .= "$setup; \$x / \$y;";
         $try .= "$setup; \$x / \$y;";
-      } elsif ($f eq "fdiv-list") {
-        $try .= "$setup; join(',',\$x->fdiv(\$y));";
-      } elsif ($f eq "frsft") {
+      } elsif ($f eq "bdiv-list") {
+        $try .= "$setup; join(',',\$x->bdiv(\$y));";
+      } elsif ($f eq "brsft") {
         $try .= '$x >> $y;';
         $try .= '$x >> $y;';
-      } elsif ($f eq "flsft") {
+      } elsif ($f eq "blsft") {
         $try .= '$x << $y;';
         $try .= '$x << $y;';
-      } elsif ($f eq "fmod") {
+      } elsif ($f eq "bmod") {
         $try .= '$x % $y;';
        } else {
        # Functions with three arguments
         $try .= '$x % $y;';
        } else {
        # Functions with three arguments
@@ -233,23 +233,23 @@ is ($class->new($monster)->mantissa(),
 ###############################################################################
 # zero,inf,one,nan
 
 ###############################################################################
 # zero,inf,one,nan
 
-$x = $class->new(2); $x->fzero(); is ($x->{_a}, undef); is ($x->{_p}, undef);
-$x = $class->new(2); $x->finf();  is ($x->{_a}, undef); is ($x->{_p}, undef);
-$x = $class->new(2); $x->fone();  is ($x->{_a}, undef); is ($x->{_p}, undef);
-$x = $class->new(2); $x->fnan();  is ($x->{_a}, undef); is ($x->{_p}, undef);
+$x = $class->new(2); $x->bzero(); is ($x->{_a}, undef); is ($x->{_p}, undef);
+$x = $class->new(2); $x->binf();  is ($x->{_a}, undef); is ($x->{_p}, undef);
+$x = $class->new(2); $x->bone();  is ($x->{_a}, undef); is ($x->{_p}, undef);
+$x = $class->new(2); $x->bnan();  is ($x->{_a}, undef); is ($x->{_p}, undef);
 
 ###############################################################################
 # bone/binf etc as plain calls (Lite failed them)
 
 
 ###############################################################################
 # bone/binf etc as plain calls (Lite failed them)
 
-is ($class->fzero(),0);
-is ($class->fone(),1);
-is ($class->fone('+'),1);
-is ($class->fone('-'),-1);
-is ($class->fnan(),'NaN');
-is ($class->finf(),'inf');
-is ($class->finf('+'),'inf');
-is ($class->finf('-'),'-inf');
-is ($class->finf('-inf'),'-inf');
+is ($class->bzero(),0);
+is ($class->bone(),1);
+is ($class->bone('+'),1);
+is ($class->bone('-'),-1);
+is ($class->bnan(),'NaN');
+is ($class->binf(),'inf');
+is ($class->binf('+'),'inf');
+is ($class->binf('-'),'-inf');
+is ($class->binf('-inf'),'-inf');
         
 $class->accuracy(undef); $class->precision(undef);     # reset
 
         
 $class->accuracy(undef); $class->precision(undef);     # reset
 
@@ -272,7 +272,8 @@ unlike($class->new("1e9999")->numify(), qr/^1(\.0*)?e\+?9+$/);   # overflow
 # Check numify on non-finite objects.
 
 {
 # Check numify on non-finite objects.
 
 {
-    my $inf = 1e99 ** 1e99;
+    require Math::Complex;
+    my $inf = Math::Complex::Inf();
     my $nan = $inf - $inf;
     is($class -> binf("+") -> numify(),  $inf, "numify of +Inf");
     is($class -> binf("-") -> numify(), -$inf, "numify of -Inf");
     my $nan = $inf - $inf;
     is($class -> binf("+") -> numify(),  $inf, "numify of +Inf");
     is($class -> binf("-") -> numify(), -$inf, "numify of -Inf");
@@ -280,24 +281,24 @@ unlike($class->new("1e9999")->numify(), qr/^1(\.0*)?e\+?9+$/);   # overflow
 }
 
 ###############################################################################
 }
 
 ###############################################################################
-# fsqrt() with set global A/P or A/P enabled on $x, also a test whether fsqrt()
+# bsqrt() with set global A/P or A/P enabled on $x, also a test whether bsqrt()
 # correctly modifies $x
 
 
 # correctly modifies $x
 
 
-$x = $class->new(12); $class->precision(-2); $x->fsqrt(); is ($x,'3.46');
+$x = $class->new(12); $class->precision(-2); $x->bsqrt(); is ($x,'3.46');
 
 $class->precision(undef);
 
 $class->precision(undef);
-$x = $class->new(12); $class->precision(0); $x->fsqrt(); is ($x,'3');
+$x = $class->new(12); $class->precision(0); $x->bsqrt(); is ($x,'3');
 
 
-$class->precision(-3); $x = $class->new(12); $x->fsqrt(); is ($x,'3.464');
+$class->precision(-3); $x = $class->new(12); $x->bsqrt(); is ($x,'3.464');
 
 {
   no strict 'refs';
   # A and P set => NaN
   ${${class}.'::accuracy'} = 4; $x = $class->new(12);
 
 {
   no strict 'refs';
   # A and P set => NaN
   ${${class}.'::accuracy'} = 4; $x = $class->new(12);
-  $x->fsqrt(3); is ($x,'NaN');
+  $x->bsqrt(3); is ($x,'NaN');
   # supplied arg overrides set global
   # supplied arg overrides set global
-  $class->precision(undef); $x = $class->new(12); $x->fsqrt(3); is ($x,'3.46');
+  $class->precision(undef); $x = $class->new(12); $x->bsqrt(3); is ($x,'3.46');
   $class->accuracy(undef); $class->precision(undef); # reset for further tests
 }
 
   $class->accuracy(undef); $class->precision(undef); # reset for further tests
 }
 
@@ -321,7 +322,7 @@ is ($class->new(-1)->is_one('-'),1);
 #############################################################################
 # bug 1/0.5 leaving 2e-0 instead of 2e0
 
 #############################################################################
 # bug 1/0.5 leaving 2e-0 instead of 2e0
 
-is ($class->new(1)->fdiv('0.5')->bsstr(),'2e+0');
+is ($class->new(1)->bdiv('0.5')->bsstr(),'2e+0');
 
 ###############################################################################
 # [perl #30609] bug with $x -= $x not being 0, but 2*$x
 
 ###############################################################################
 # [perl #30609] bug with $x -= $x not being 0, but 2*$x
@@ -512,7 +513,7 @@ NaN:1:NaN
 2:0:1
 7:0:1
 2:1:2
 2:0:1
 7:0:1
 2:1:2
-&flog
+&blog
 0::-inf
 -1::NaN
 -2::NaN
 0::-inf
 -1::NaN
 -2::NaN
@@ -543,25 +544,25 @@ $div_scale = 15;
 # reset for further tests
 $div_scale = 40;
 1::0
 # reset for further tests
 $div_scale = 40;
 1::0
-&frsft
-NaNfrsft:2:NaN
+&brsft
+NaNbrsft:2:NaN
 0:2:0
 1:1:0.5
 2:1:1
 4:1:2
 123:1:61.5
 32:3:4
 0:2:0
 1:1:0.5
 2:1:1
 4:1:2
 123:1:61.5
 32:3:4
-&flsft
-NaNflsft:0:NaN
+&blsft
+NaNblsft:0:NaN
 2:1:4
 4:3:32
 5:3:40
 1:2:4
 0:5:0
 2:1:4
 4:3:32
 5:3:40
 1:2:4
 0:5:0
-&fnorm
+&bnorm
 1:1
 -0:0
 1:1
 -0:0
-fnormNaN:NaN
+bnormNaN:NaN
 +inf:inf
 -inf:-inf
 123:123
 +inf:inf
 -inf:-inf
 123:123
@@ -639,7 +640,7 @@ NaN:NaN
 0.1234567:0
 0.12345678:0
 0.123456789:0
 0.1234567:0
 0.12345678:0
 0.123456789:0
-&finf
+&binf
 1:+:inf
 2:-:-inf
 3:abc:inf
 1:+:inf
 2:-:-inf
 3:abc:inf
@@ -665,12 +666,12 @@ hexNaN:NaN
 -5:-5
 100:100
 -100:-100
 -5:-5
 100:100
 -100:-100
-&fnan
+&bnan
 abc:NaN
 2:NaN
 -2:NaN
 0:NaN
 abc:NaN
 2:NaN
 -2:NaN
 0:NaN
-&fone
+&bone
 2:+:1
 -2:-:-1
 -2:+:1
 2:+:1
 -2:-:-1
 -2:+:1
@@ -679,7 +680,7 @@ abc:NaN
 -2::1
 abc::1
 2:abc:1
 -2::1
 abc::1
 2:abc:1
-&fsstr
+&bsstr
 +inf:inf
 -inf:-inf
 abcfsstr:NaN
 +inf:inf
 -inf:-inf
 abcfsstr:NaN
@@ -688,7 +689,7 @@ abcfsstr:NaN
 123:123e+0
 -5:-5e+0
 -100:-1e+2
 123:123e+0
 -5:-5e+0
 -100:-1e+2
-&fstr
+&bstr
 +inf:::inf
 -inf:::-inf
 abcfstr:::NaN
 +inf:::inf
 -inf:::-inf
 abcfstr:::NaN
@@ -699,7 +700,7 @@ abcfstr:::NaN
 0.001234::-8:0.00123400
 0:4::0
 0::-4:0.0000
 0.001234::-8:0.00123400
 0:4::0
 0::-4:0.0000
-&fnorm
+&bnorm
 inf:inf
 +inf:inf
 -inf:-inf
 inf:inf
 +inf:inf
 -inf:-inf
@@ -755,7 +756,7 @@ abc:NaN
   1.1e1:11
 -3e111:-3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 -4e-1111:-0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004
   1.1e1:11
 -3e111:-3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 -4e-1111:-0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004
-&fpow
+&bpow
 NaN:1:NaN
 1:NaN:NaN
 NaN:-1:NaN
 NaN:1:NaN
 1:NaN:NaN
 NaN:-1:NaN
@@ -799,8 +800,8 @@ abc:123.456:NaN
 $div_scale = 20;
 #62.5:12.5:26447206647554886213592.3959144
 $div_scale = 40;
 $div_scale = 20;
 #62.5:12.5:26447206647554886213592.3959144
 $div_scale = 40;
-&fneg
-fnegNaN:NaN
+&bneg
+bnegNaN:NaN
 +inf:-inf
 -inf:inf
 +0:0
 +inf:-inf
 -inf:inf
 +0:0
@@ -810,8 +811,8 @@ fnegNaN:NaN
 -123456789:123456789
 +123.456789:-123.456789
 -123456.789:123456.789
 -123456789:123456789
 +123.456789:-123.456789
 -123456.789:123456.789
-&fabs
-fabsNaN:NaN
+&babs
+babsNaN:NaN
 +inf:inf
 -inf:inf
 +0:0
 +inf:inf
 -inf:inf
 +0:0
@@ -821,7 +822,7 @@ fabsNaN:NaN
 -123456789:123456789
 +123.456789:123.456789
 -123456.789:123456.789
 -123456789:123456789
 +123.456789:123.456789
 -123456.789:123456.789
-&fround
+&bround
 $round_mode = "trunc"
 +inf:5:inf
 -inf:5:-inf
 $round_mode = "trunc"
 +inf:5:inf
 -inf:5:-inf
@@ -896,7 +897,7 @@ $round_mode = "common"
 +601234300:6:601234000
 +60123456789.0123:5:60123000000
 -60123456789.0123:5:-60123000000
 +601234300:6:601234000
 +60123456789.0123:5:60123000000
 -60123456789.0123:5:-60123000000
-&ffround
+&bfround
 $round_mode = "trunc"
 +inf:5:inf
 -inf:5:-inf
 $round_mode = "trunc"
 +inf:5:inf
 -inf:5:-inf
@@ -1031,10 +1032,10 @@ $round_mode = "even"
 0.01234567:-8:0.01234567
 0.01234567:-9:0.012345670
 0.01234567:-12:0.012345670000
 0.01234567:-8:0.01234567
 0.01234567:-9:0.012345670
 0.01234567:-12:0.012345670000
-&fcmp
-fcmpNaN:fcmpNaN:
-fcmpNaN:+0:
-+0:fcmpNaN:
+&bcmp
+bcmpNaN:bcmpNaN:
+bcmpNaN:+0:
++0:bcmpNaN:
 +0:+0:0
 -1:+0:-1
 +0:-1:1
 +0:+0:0
 -1:+0:-1
 +0:-1:1
@@ -1103,10 +1104,10 @@ fcmpNaN:+0:
 NaN:inf:
 -inf:NaN:
 NaN:-inf:
 NaN:inf:
 -inf:NaN:
 NaN:-inf:
-&facmp
-fcmpNaN:fcmpNaN:
-fcmpNaN:+0:
-+0:fcmpNaN:
+&bacmp
+bcmpNaN:bcmpNaN:
+bcmpNaN:+0:
++0:bcmpNaN:
 +0:+0:0
 -1:+0:1
 +0:-1:-1
 +0:+0:0
 -1:+0:1
 +0:-1:-1
@@ -1173,12 +1174,12 @@ fcmpNaN:+0:
 5:-inf:-1
 -1:-inf:-1
 # return undef
 5:-inf:-1
 -1:-inf:-1
 # return undef
-+inf:facmpNaN:
-facmpNaN:inf:
--inf:facmpNaN:
-facmpNaN:-inf:
-&fdec
-fdecNaN:NaN
++inf:bacmpNaN:
+bacmpNaN:inf:
+-inf:bacmpNaN:
+bacmpNaN:-inf:
+&bdec
+bdecNaN:NaN
 +inf:inf
 -inf:-inf
 +0:-1
 +inf:inf
 -inf:-inf
 +0:-1
@@ -1192,8 +1193,8 @@ fdecNaN:NaN
 -99:-100
 -98:-99
 99:98
 -99:-100
 -98:-99
 99:98
-&finc
-fincNaN:NaN
+&binc
+bincNaN:NaN
 +inf:inf
 -inf:-inf
 +0:1
 +inf:inf
 -inf:-inf
 +0:1
@@ -1206,7 +1207,7 @@ fincNaN:NaN
 -99:-98
 -101:-100
 99:100
 -99:-98
 -101:-100
 99:100
-&fadd
+&badd
 abc:abc:NaN
 abc:+0:NaN
 +0:abc:NaN
 abc:abc:NaN
 abc:+0:NaN
 +0:abc:NaN
@@ -1253,7 +1254,7 @@ baddNaN:+inf:NaN
 -123456789:-987654321:-1111111110
 +123456789:-987654321:-864197532
 0.001234:0.0001234:0.0013574
 -123456789:-987654321:-1111111110
 +123456789:-987654321:-864197532
 0.001234:0.0001234:0.0013574
-&fsub
+&bsub
 abc:abc:NaN
 abc:+0:NaN
 +0:abc:NaN
 abc:abc:NaN
 abc:+0:NaN
 +0:abc:NaN
@@ -1366,7 +1367,7 @@ NaNmul:-inf:0:NaN
 3:4:7:4
 77777:777:123456789:99995084
 3.2:6.2:5.2:2.970579856718063040273642739529400818
 3:4:7:4
 77777:777:123456789:99995084
 3.2:6.2:5.2:2.970579856718063040273642739529400818
-&fmul
+&bmul
 abc:abc:NaN
 abc:+0:NaN
 +0:abc:NaN
 abc:abc:NaN
 abc:+0:NaN
 +0:abc:NaN
@@ -1417,7 +1418,7 @@ NaNmul:-inf:NaN
 +99999999999:+9:899999999991
 6:120:720
 10:10000:100000
 +99999999999:+9:899999999991
 6:120:720
 10:10000:100000
-&fdiv-list
+&bdiv-list
 0:0:NaN,0
 0:1:0,0
 9:4:2,1
 0:0:NaN,0
 0:1:0,0
 9:4:2,1
@@ -1427,7 +1428,7 @@ NaNmul:-inf:NaN
 2.1:1:2.1,0
 -2.1:-1:2.1,0
 -2.1:1:-2.1,0
 2.1:1:2.1,0
 -2.1:-1:2.1,0
 -2.1:1:-2.1,0
-&fdiv
+&bdiv
 $div_scale = 40; $round_mode = 'even'
 abc:abc:NaN
 abc:+1:abc:NaN
 $div_scale = 40; $round_mode = 'even'
 abc:abc:NaN
 abc:+1:abc:NaN
@@ -1504,7 +1505,7 @@ $div_scale = 1
 123456789.1234:1:100000000
 # reset scale for further tests
 $div_scale = 40
 123456789.1234:1:100000000
 # reset scale for further tests
 $div_scale = 40
-&fmod
+&bmod
 +9:4:1
 +9:5:4
 +9000:56:40
 +9:4:1
 +9:5:4
 +9000:56:40
@@ -1594,7 +1595,7 @@ abc:1:abc:NaN
 3:1:0
 -3:-1:0
 3:-1:0
 3:1:0
 -3:-1:0
 3:-1:0
-&ffac
+&bfac
 Nanfac:NaN
 -1:NaN
 +inf:inf
 Nanfac:NaN
 -1:NaN
 +inf:inf
@@ -1609,12 +1610,12 @@ Nanfac:NaN
 10:3628800
 11:39916800
 12:479001600
 10:3628800
 11:39916800
 12:479001600
-&froot
+&broot
 # sqrt()
 +0:2:0
 +1:2:1
 -1:2:NaN
 # sqrt()
 +0:2:0
 +1:2:1
 -1:2:NaN
-# -$x ** (1/2) => -$y, but not in froot()
+# -$x ** (1/2) => -$y, but not in broot()
 -123.456:2:NaN
 +inf:2:inf
 -inf:2:NaN
 -123.456:2:NaN
 +inf:2:inf
 -inf:2:NaN
@@ -1659,13 +1660,13 @@ NaN:inf:NaN
 16:4:2
 81:4:3
 # see t/bigroot() for more tests
 16:4:2
 81:4:3
 # see t/bigroot() for more tests
-&fsqrt
+&bsqrt
 +0:0
 -1:NaN
 -2:NaN
 -16:NaN
 -123.45:NaN
 +0:0
 -1:NaN
 -2:NaN
 -16:NaN
 -123.45:NaN
-nanfsqrt:NaN
+nanbsqrt:NaN
 +inf:inf
 -inf:NaN
 1:1
 +inf:inf
 -inf:NaN
 1:1
@@ -1766,7 +1767,7 @@ NaN:0
 -inf:1
 +inf:0
 &parts
 -inf:1
 +inf:0
 &parts
-0:0 1
+0:0 0
 1:1 0
 123:123 0
 -123:-123 0
 1:1 0
 123:123 0
 -123:-123 0
@@ -1775,7 +1776,7 @@ NaNparts:NaN NaN
 +inf:inf inf
 -inf:-inf inf
 &exponent
 +inf:inf inf
 -inf:-inf inf
 &exponent
-0:1
+0:0
 1:0
 123:0
 -123:0
 1:0
 123:0
 -123:0
@@ -1814,7 +1815,7 @@ NaNone:0
 1:1
 -1:0
 -2:0
 1:1
 -1:0
 -2:0
-&ffloor
+&bfloor
 0:0
 abc:NaN
 +inf:inf
 0:0
 abc:NaN
 +inf:inf
@@ -1828,7 +1829,7 @@ abc:NaN
 0.1234567:0
 0.12345678:0
 0.123456789:0
 0.1234567:0
 0.12345678:0
 0.123456789:0
-&fceil
+&bceil
 0:0
 abc:NaN
 +inf:inf
 0:0
 abc:NaN
 +inf:inf
@@ -1838,7 +1839,7 @@ abc:NaN
 -51.2:-51
 12.2:13
 -0.4:0
 -51.2:-51
 12.2:13
 -0.4:0
-&fint
+&bint
 0:0
 NaN:NaN
 +inf:inf
 0:0
 NaN:NaN
 +inf:inf
index 9e33d48..e84b602 100644 (file)
@@ -17,7 +17,7 @@ is ($class->config()->{with}, $CL);
 
 # bug #17447: Can't call method Math::BigFloat->bsub, not a valid method
 my $c = Math::BigFloat->new( '123.3' );
 
 # bug #17447: Can't call method Math::BigFloat->bsub, not a valid method
 my $c = Math::BigFloat->new( '123.3' );
-is ($c->fsub(123), '0.3'); # calling fsub on a BigFloat works
+is ($c->bsub(123), '0.3'); # calling bsub on a BigFloat works
 
 # Bug until BigInt v1.86, the scale wasn't treated as a scalar:
 $c = Math::BigFloat->new('0.008'); my $d = Math::BigFloat->new(3);
 
 # Bug until BigInt v1.86, the scale wasn't treated as a scalar:
 $c = Math::BigFloat->new('0.008'); my $d = Math::BigFloat->new(3);
index 2e027de..82168d0 100644 (file)
@@ -523,7 +523,8 @@ is (ref($x),'Math::Foo');
 # Check numify on non-finite objects.
 
 {
 # Check numify on non-finite objects.
 
 {
-    my $inf = 1e99 ** 1e99;
+    require Math::Complex;
+    my $inf = Math::Complex::Inf();
     my $nan = $inf - $inf;
     is($class -> binf("+") -> numify(),  $inf, "numify of +Inf");
     is($class -> binf("-") -> numify(), -$inf, "numify of -Inf");
     my $nan = $inf - $inf;
     is($class -> binf("+") -> numify(),  $inf, "numify of +Inf");
     is($class -> binf("-") -> numify(), -$inf, "numify of -Inf");
@@ -2300,7 +2301,7 @@ abc:NaN
 123:0
 -1:0
 -2:0
 123:0
 -1:0
 -2:0
-0:1
+0:0
 +inf:inf
 -inf:inf
 &parts
 +inf:inf
 -inf:inf
 &parts
@@ -2310,7 +2311,7 @@ abc:NaN,NaN
 123:123,0
 -1:-1,0
 -2:-2,0
 123:123,0
 -1:-1,0
 -2:-2,0
-0:0,1
+0:0,0
 +inf:inf,inf
 -inf:-inf,inf
 &bfac
 +inf:inf,inf
 -inf:-inf,inf
 &bfac
@@ -2432,7 +2433,7 @@ inf:-inf:NaN
 +0:2:0
 +1:2:1
 -1:2:NaN
 +0:2:0
 +1:2:1
 -1:2:NaN
-# -$x ** (1/2) => -$y, but not in froot()
+# -$x ** (1/2) => -$y, but not in broot()
 -123:2:NaN
 +inf:2:inf
 -inf:2:NaN
 -123:2:NaN
 +inf:2:inf
 -inf:2:NaN
index 6cdb4ac..9036b5e 100644 (file)
@@ -121,7 +121,7 @@ abc:NaN
 '-inf':-inf
 &bsstr
 1:1e+0
 '-inf':-inf
 &bsstr
 1:1e+0
-0:0e+1
+0:0e+0
 2:2e+0
 200:2e+2
 -5:-5e+0
 2:2e+0
 200:2e+2
 -5:-5e+0
diff --git a/cpan/Math-BigInt/t/from_hex-mbf.t b/cpan/Math-BigInt/t/from_hex-mbf.t
new file mode 100644 (file)
index 0000000..1322916
--- /dev/null
@@ -0,0 +1,75 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 27;
+
+my $class;
+
+BEGIN { $class = 'Math::BigFloat'; }
+BEGIN { use_ok($class, '1.999710'); }
+
+while (<DATA>) {
+    s/\s+\z//;
+    next if /^#/ || ! /\S/;
+
+    my ($in0, $out0) = split /:/;
+    my $x;
+
+    my $test = qq|\$x = $class -> from_hex("$in0");|;
+
+    my $desc = $test;
+
+    print("#\n",
+          "# Now about to execute the following test.\n",
+          "#\n",
+          "# $test\n",
+          "#\n");
+
+    eval $test;
+    die $@ if $@;       # this should never happen
+
+    subtest $desc, sub {
+        plan tests => 2,
+
+        # Check output.
+
+        is(ref($x), $class, "output arg is a $class");
+        is($x, $out0, 'output arg has the right value');
+    };
+
+}
+
+__END__
+0x1p+0:1
+0x.8p+1:1
+0x.4p+2:1
+0x.2p+3:1
+0x.1p+4:1
+0x2p-1:1
+0x4p-2:1
+0x8p-3:1
+
+-0x1p+0:-1
+
+0x0p+0:0
+0x0p+7:0
+0x0p-7:0
+0x0.p+0:0
+0x.0p+0:0
+0x0.0p+0:0
+
+0xcafe:51966
+xcafe:51966
+cafe:51966
+
+0x1.9p+3:12.5
+0x12.34p-1:9.1015625
+-0x.789abcdefp+32:-2023406814.9375
+0x12.3456789ap+31:39093746765
+
+NaN:NaN
++inf:NaN
+-inf:NaN
+0x.p+0:NaN
index 7b2c946..c22603e 100644 (file)
@@ -316,9 +316,9 @@ is ($x->bnot(),-123400);                    # not -1234001
 $x = $mbi->new(-123401); $x->{_a} = 4; is ($x->babs(),123401);
 $x = $mbi->new(-123401); $x->{_a} = 4; is ($x->bneg(),123401);
 
 $x = $mbi->new(-123401); $x->{_a} = 4; is ($x->babs(),123401);
 $x = $mbi->new(-123401); $x->{_a} = 4; is ($x->bneg(),123401);
 
-# test fdiv rounding to A and R (bug in v1.48 and maybe earlier versions)
+# test bdiv rounding to A and R (bug in v1.48 and maybe earlier versions)
 $mbf->round_mode('even');
 $mbf->round_mode('even');
-$x = $mbf->new('740.7')->fdiv('6',4,undef,'zero'); is ($x,'123.4');
+$x = $mbf->new('740.7')->bdiv('6',4,undef,'zero'); is ($x,'123.4');
 
 $x = $mbi->new('123456'); $y = $mbi->new('123456'); $y->{_a} = 6;
 is ($x->bdiv($y),1); is ($x->{_a},6);                  # carried over
 
 $x = $mbi->new('123456'); $y = $mbi->new('123456'); $y->{_a} = 6;
 is ($x->bdiv($y),1); is ($x->{_a},6);                  # carried over
index 89559a2..f3d34ec 100644 (file)
@@ -63,7 +63,7 @@ foreach my $class (qw/Math::BigInt Math::BigFloat/)
   $class->accuracy(undef);     # reset for further tests
   $class->precision(undef);
   }
   $class->accuracy(undef);     # reset for further tests
   $class->precision(undef);
   }
-# bug with flog(Math::BigFloat,Math::BigInt)
+# bug with blog(Math::BigFloat,Math::BigInt)
 $x = Math::BigFloat->new(100);
 $x = $x->blog(Math::BigInt->new(10));
 
 $x = Math::BigFloat->new(100);
 $x = $x->blog(Math::BigInt->new(10));
 
index 16ca05e..edb3ce1 100644 (file)
@@ -1214,7 +1214,7 @@ abc:NaN
 123:0
 -1:0
 -2:0
 123:0
 -1:0
 -2:0
-0:1
+0:0
 +inf:inf
 -inf:inf
 &parts
 +inf:inf
 -inf:inf
 &parts
@@ -1224,7 +1224,7 @@ abc:NaN,NaN
 123:123,0
 -1:-1,0
 -2:-2,0
 123:123,0
 -1:-1,0
 -2:-2,0
-0:0,1
+0:0,0
 +inf:inf,inf
 -inf:-inf,inf
 &bfac
 +inf:inf,inf
 -inf:-inf,inf
 &bfac