Hello community,

here is the log from the commit of package perl-Math-BigInt for 
openSUSE:Factory checked in at 2015-11-15 12:46:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Math-BigInt (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Math-BigInt.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Math-BigInt"

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Math-BigInt/perl-Math-BigInt.changes        
2015-11-12 19:41:29.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.perl-Math-BigInt.new/perl-Math-BigInt.changes   
2015-11-15 12:48:07.000000000 +0100
@@ -1,0 +2,15 @@
+Sat Nov 14 09:55:10 UTC 2015 - [email protected]
+
+- updated to 1.999710
+   see /usr/share/doc/packages/perl-Math-BigInt/CHANGES
+
+  2015-11-12 v1.999710 pjacklam
+  
+   * New method Math::BigFloat -> from_hex() which supports hexadecimal 
floating
+     point numbers, e.g., "0x1.999ap-4".
+  
+   * New test file t/from_hex-mbf.t for testing Math::BigFloat -> from_hex().
+  
+   * Add 'from_hex' and 'from_bin' to list of methods in the Math::BigInt POD.
+
+-------------------------------------------------------------------

Old:
----
  Math-BigInt-1.999709.tar.gz

New:
----
  Math-BigInt-1.999710.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Math-BigInt.spec ++++++
--- /var/tmp/diff_new_pack.7DQ5K1/_old  2015-11-15 12:48:08.000000000 +0100
+++ /var/tmp/diff_new_pack.7DQ5K1/_new  2015-11-15 12:48:08.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           perl-Math-BigInt
-Version:        1.999709
+Version:        1.999710
 Release:        0
 %define cpan_name Math-BigInt
 Summary:        Arbitrary size integer/float math package

++++++ Math-BigInt-1.999709.tar.gz -> Math-BigInt-1.999710.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999709/CHANGES 
new/Math-BigInt-1.999710/CHANGES
--- old/Math-BigInt-1.999709/CHANGES    2015-11-08 21:06:25.000000000 +0100
+++ new/Math-BigInt-1.999710/CHANGES    2015-11-12 20:34:42.000000000 +0100
@@ -1500,6 +1500,15 @@
 
  * Required version of Test::More is 0.9301.
 
+2015-11-12 v1.999710 pjacklam
+
+ * New method Math::BigFloat -> from_hex() which supports hexadecimal floating
+   point numbers, e.g., "0x1.999ap-4".
+
+ * New test file t/from_hex-mbf.t for testing Math::BigFloat -> from_hex().
+
+ * Add 'from_hex' and 'from_bin' to list of methods in the Math::BigInt POD.
+
 Please send us test-reports, your experiences with this and your ideas - we 
love
 to hear about our work!
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999709/MANIFEST 
new/Math-BigInt-1.999710/MANIFEST
--- old/Math-BigInt-1.999709/MANIFEST   2015-11-08 21:20:51.000000000 +0100
+++ new/Math-BigInt-1.999710/MANIFEST   2015-11-13 19:26:37.000000000 +0100
@@ -50,6 +50,7 @@
 t/const_mbf.t
 t/constant.t
 t/downgrade.t
+t/from_hex-mbf.t
 t/inf_nan.t
 t/isa.t
 t/lib_load.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999709/META.json 
new/Math-BigInt-1.999710/META.json
--- old/Math-BigInt-1.999709/META.json  2015-11-08 21:20:51.000000000 +0100
+++ new/Math-BigInt-1.999710/META.json  2015-11-13 19:26:37.000000000 +0100
@@ -40,6 +40,6 @@
       }
    },
    "release_status" : "stable",
-   "version" : "1.999709",
+   "version" : "1.999710",
    "x_serialization_backend" : "JSON::PP version 2.27300"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999709/META.yml 
new/Math-BigInt-1.999710/META.yml
--- old/Math-BigInt-1.999709/META.yml   2015-11-08 21:20:48.000000000 +0100
+++ new/Math-BigInt-1.999710/META.yml   2015-11-13 19:26:35.000000000 +0100
@@ -22,5 +22,5 @@
   Math::Complex: '1.39'
   Test::More: '0.9301'
   perl: '5.006002'
-version: '1.999709'
+version: '1.999710'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.016'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999709/SIGNATURE 
new/Math-BigInt-1.999710/SIGNATURE
--- old/Math-BigInt-1.999709/SIGNATURE  2015-11-08 21:32:15.000000000 +0100
+++ new/Math-BigInt-1.999710/SIGNATURE  2015-11-13 19:26:40.000000000 +0100
@@ -16,15 +16,15 @@
 
 SHA1 f6ef98e8f3f6a4f670d569f279ef5a3c05c16d0c BENCHMARK
 SHA1 d681b992c9e027633a59fbd52530805ee4e1621c BUGS
-SHA1 5176439f04e5492e6a3993a316d248175f83b594 CHANGES
+SHA1 08a0302bf5a54d348b1c315933d0db360edfc645 CHANGES
 SHA1 f27c8bd98e754f96c9825fa6ce9f1244c93bdbe6 CREDITS
 SHA1 bc2db74538d3acd53f71b5512a144fe18c253ecd GOALS
 SHA1 fe61299e80a1dca48fbaa33f0869e3238ec07c70 HISTORY
 SHA1 d6a6c30ee6d9ba6b9afab8bbf6a25e1b23c744e0 LICENSE
-SHA1 e717092a11b1e42a0a7b340c68e75fa84b8a68b8 MANIFEST
+SHA1 d474e87288ac041eaac13acb7d6e4131602b1602 MANIFEST
 SHA1 86df44fbe1ea7a68897113f0e327d0f0c25b91e3 MANIFEST.SKIP
-SHA1 ea13a151a65b0bf6ddc87fcd38c599537d09f4bb META.json
-SHA1 d197f1cef69a1c988a1c41d0269ac41b9766bd37 META.yml
+SHA1 fa8f8556cf7f660211d5068468401e4215d54b69 META.json
+SHA1 edbaf9b0f89f112d153397e9a7191cf80eb7f634 META.yml
 SHA1 a57852f7db8fc4f38351154644964b93ff06f04d Makefile.PL
 SHA1 4e2191d1724e699862efc5350f480c8e02755112 NEW
 SHA1 813c62e6d3edd18b7b634765ecbd75b2cd6389a0 README
@@ -40,10 +40,10 @@
 SHA1 2e33e87882d60db3913da6284dd5295e5315e18a inc/Module/Install/Metadata.pm
 SHA1 c830b819e61bda5eca077c6291293bba61b3b9f2 inc/Module/Install/Win32.pm
 SHA1 cb52b9d6f88d512d448a6f35ed0af0d1201a134b inc/Module/Install/WriteAll.pm
-SHA1 c7305d30bfa5d45468488580049d988484493e3a lib/Math/BigFloat.pm
-SHA1 2499a3661b1b55d85a40b30d6536adf27b1eff3d lib/Math/BigInt.pm
-SHA1 312cf1302bbd003016413393e5393752dcc56103 lib/Math/BigInt/Calc.pm
-SHA1 5dda5ab049013116c3a35983f511fb7f20171b06 lib/Math/BigInt/CalcEmu.pm
+SHA1 d927168e9cd177fe10ec24a463b64736dc8bab67 lib/Math/BigFloat.pm
+SHA1 6109fdc265786cbeafb3cb4cfbe4dfce6edacbea lib/Math/BigInt.pm
+SHA1 29966b0d690396bc9ecca5c667e6039ead92c215 lib/Math/BigInt/Calc.pm
+SHA1 1f1b2469c429aa69994ff1a197645dabfae6bca4 lib/Math/BigInt/CalcEmu.pm
 SHA1 385cc7ed3bf3e6290640b9880445ca9a3dea629e t/00sig.t
 SHA1 4463fdcebb8421cc2e63f87d678adb47856bf58c t/01load.t
 SHA1 b2ed9206ca5b69ec3b8bbf850bf4b6dfde518e7e t/02pod.t
@@ -73,6 +73,7 @@
 SHA1 7c75531325efd55f15ef14e5ca22875d6d53e366 t/const_mbf.t
 SHA1 b7891121243029ae078ca952205ce3d037b145d8 t/constant.t
 SHA1 d5b1f2d01e954a8b0c41d51f79ec878a305cedf7 t/downgrade.t
+SHA1 9c27ba015253129c87d7626f665704cef89a40ab t/from_hex-mbf.t
 SHA1 048e4b172645392bac2d5b42a31c01b8ad74f5e2 t/inf_nan.t
 SHA1 4ee46eecc74e97f27ef47b208576d179ab01cfb9 t/isa.t
 SHA1 95d41431bb5147f2cd97d2f160c1ce220a365142 t/lib_load.t
@@ -113,11 +114,11 @@
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
-iQEcBAEBAgAGBQJWP66kAAoJEGcmPl2fr166V70IAJp04sCaNomoPTo+ATvoOWCN
-p2+HVnlmW3Ly2anaDGrB5t8TZDVS7qUAC+jx3RJBkFZ0n+PfO+VkeTi7QWCd3FyB
-uuYvIMn8eOrQyLEWzOD6M8MgL7pvwmBX08HzwnEkNHvF4sE/MCA76RWwEzDhabD4
-NIe2BAvCqjbs38oMcYIP3noULOiEUA7yydGV4bH04AzogNAN7NQhrEKQRjNuaddT
-73WvhM2r1uBXA04o3weV0l62y94H0b9ILxNCqQLKeOBZ1L81/c+KKvk3EUpY8mdP
-d9Nz6GexWknBiB7SrZ2871Fn/Z6c40NFez9FTaiMP3e0Bj+JudglEzq6omKDN3U=
-=JOu/
+iQEcBAEBAgAGBQJWRiteAAoJEGcmPl2fr166BocIALs7gPxfU64rHXW1qYmLP3rg
+3q9mOGllBtPA7rDPFw9Byf9Q4BI/fa2FFfo3KaM71dcvOjRJIEoEHJKw87Jp7lwS
+h/nQfaEdzPX52BL/aVi1PFzG2gfCMzerGYTq9hSmO3kL+mOO7wjq4n5GOUNU9rxo
+q7YW0owDbrr0H0Bb8Z+1ymBp9oZvRvt+pYXs+Mc4CyyIVhmyheEfGHt35/wjSilG
+znb5HVqQtqHVH8HS1q9NCx74Plrlq8CYPnqvcTenQtGoJVkv2zcfOSX9oIdEUv38
+ma5l9DXw4lDxUHHvJqFgHVVW9Vyu50zLAn2mZuE02bdzoiYdlDRbufujtRkXl94=
+=GT79
 -----END PGP SIGNATURE-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999709/lib/Math/BigFloat.pm 
new/Math-BigInt-1.999710/lib/Math/BigFloat.pm
--- old/Math-BigInt-1.999709/lib/Math/BigFloat.pm       2015-11-07 
18:08:09.000000000 +0100
+++ new/Math-BigInt-1.999710/lib/Math/BigFloat.pm       2015-11-12 
15:02:11.000000000 +0100
@@ -16,7 +16,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '1.999709';
+our $VERSION = '1.999710';
 
 require Exporter;
 our @ISA       = qw/Math::BigInt/;
@@ -4007,6 +4007,89 @@
   $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__
@@ -4030,6 +4113,9 @@
  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
 
@@ -4496,6 +4582,17 @@
 
 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
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999709/lib/Math/BigInt/Calc.pm 
new/Math-BigInt-1.999710/lib/Math/BigInt/Calc.pm
--- old/Math-BigInt-1.999709/lib/Math/BigInt/Calc.pm    2015-11-07 
18:08:32.000000000 +0100
+++ new/Math-BigInt-1.999710/lib/Math/BigInt/Calc.pm    2015-11-12 
09:14:21.000000000 +0100
@@ -4,7 +4,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '1.999709';
+our $VERSION = '1.999710';
 
 # Package to store unsigned big integers in decimal and do math with them
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999709/lib/Math/BigInt/CalcEmu.pm 
new/Math-BigInt-1.999710/lib/Math/BigInt/CalcEmu.pm
--- old/Math-BigInt-1.999709/lib/Math/BigInt/CalcEmu.pm 2015-11-08 
14:08:07.000000000 +0100
+++ new/Math-BigInt-1.999710/lib/Math/BigInt/CalcEmu.pm 2015-11-12 
09:14:21.000000000 +0100
@@ -4,7 +4,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '1.999709';
+our $VERSION = '1.999710';
 
 package Math::BigInt;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999709/lib/Math/BigInt.pm 
new/Math-BigInt-1.999710/lib/Math/BigInt.pm
--- old/Math-BigInt-1.999709/lib/Math/BigInt.pm 2015-11-07 18:05:11.000000000 
+0100
+++ new/Math-BigInt-1.999710/lib/Math/BigInt.pm 2015-11-12 15:34:03.000000000 
+0100
@@ -19,7 +19,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '1.999709';
+our $VERSION = '1.999710';
 
 our @ISA = qw(Exporter);
 our @EXPORT_OK = qw(objectify bgcd blcm);
@@ -3505,6 +3505,8 @@
   $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)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Math-BigInt-1.999709/t/from_hex-mbf.t 
new/Math-BigInt-1.999710/t/from_hex-mbf.t
--- old/Math-BigInt-1.999709/t/from_hex-mbf.t   1970-01-01 01:00:00.000000000 
+0100
+++ new/Math-BigInt-1.999710/t/from_hex-mbf.t   2015-11-12 13:51:23.000000000 
+0100
@@ -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


Reply via email to