Hello community,

here is the log from the commit of package perl-Sub-Quote for openSUSE:Factory 
checked in at 2019-10-14 12:31:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Sub-Quote (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Sub-Quote.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Sub-Quote"

Mon Oct 14 12:31:30 2019 rev:6 rq:735809 version:2.006006

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Sub-Quote/perl-Sub-Quote.changes    
2019-03-19 11:07:06.186105776 +0100
+++ /work/SRC/openSUSE:Factory/.perl-Sub-Quote.new.2352/perl-Sub-Quote.changes  
2019-10-14 12:31:31.540265102 +0200
@@ -1,0 +2,30 @@
+Fri Oct  4 09:38:38 UTC 2019 -  <[email protected]>
+
+- updated to 2.006006
+   see /usr/share/doc/packages/perl-Sub-Quote/Changes
+
+  2.006006 - 2019-10-01
+    - change quotify to use longest form of floating point numbers if unable to
+      find a perfectly accurate representation
+    - updated documentation for quotify to reflect handling of floating point
+      numbers
+    - don't try to copy hints hash entries that look like references 
(RT#122698)
+  
+  2.006_005 - 2019-09-06
+    - additional fixes for quotify for floating point numbers to be faster and
+      should always be able to maintain accuracy
+  
+  2.006_004 - 2019-04-24
+    - change quotify of NaNs to simpler calculation
+    - avoid ever triggering exceptions when testing for quotify on false values
+    - skip quotify Inf and NaN tests if perl is compiled without support for
+      them
+    - fix quotify of very large or very small numbers
+    - fix accuracy of quotify on high precision numbers when perl is compiled
+      with quadmath
+    - quotify will use hex floats when needed for full accuracy if they are
+      available
+    - change tests of quotify for floating point numbers to allow a small 
amount
+      of inaccuracy, since decimal floats can't always be accurate
+
+-------------------------------------------------------------------

Old:
----
  Sub-Quote-2.006003.tar.gz

New:
----
  Sub-Quote-2.006006.tar.gz

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

Other differences:
------------------
++++++ perl-Sub-Quote.spec ++++++
--- /var/tmp/diff_new_pack.E9tRoQ/_old  2019-10-14 12:31:32.412262829 +0200
+++ /var/tmp/diff_new_pack.E9tRoQ/_new  2019-10-14 12:31:32.416262819 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           perl-Sub-Quote
-Version:        2.006003
+Version:        2.006006
 Release:        0
 %define cpan_name Sub-Quote
 Summary:        Efficient generation of subroutines via string eval

++++++ Sub-Quote-2.006003.tar.gz -> Sub-Quote-2.006006.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Quote-2.006003/Changes 
new/Sub-Quote-2.006006/Changes
--- old/Sub-Quote-2.006003/Changes      2019-03-10 23:31:42.000000000 +0100
+++ new/Sub-Quote-2.006006/Changes      2019-10-01 19:31:20.000000000 +0200
@@ -1,5 +1,29 @@
 Revision history for Sub::Quote
 
+2.006006 - 2019-10-01
+  - change quotify to use longest form of floating point numbers if unable to
+    find a perfectly accurate representation
+  - updated documentation for quotify to reflect handling of floating point
+    numbers
+  - don't try to copy hints hash entries that look like references (RT#122698)
+
+2.006_005 - 2019-09-06
+  - additional fixes for quotify for floating point numbers to be faster and
+    should always be able to maintain accuracy
+
+2.006_004 - 2019-04-24
+  - change quotify of NaNs to simpler calculation
+  - avoid ever triggering exceptions when testing for quotify on false values
+  - skip quotify Inf and NaN tests if perl is compiled without support for
+    them
+  - fix quotify of very large or very small numbers
+  - fix accuracy of quotify on high precision numbers when perl is compiled
+    with quadmath
+  - quotify will use hex floats when needed for full accuracy if they are
+    available
+  - change tests of quotify for floating point numbers to allow a small amount
+    of inaccuracy, since decimal floats can't always be accurate
+
 2.006003 - 2019-03-10
   - releasing as stable
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Quote-2.006003/MANIFEST 
new/Sub-Quote-2.006006/MANIFEST
--- old/Sub-Quote-2.006003/MANIFEST     2019-03-10 23:31:57.000000000 +0100
+++ new/Sub-Quote-2.006006/MANIFEST     2019-10-01 19:33:15.000000000 +0200
@@ -12,6 +12,7 @@
 t/lib/InlineModule.pm
 t/lib/ThreadsCheck.pm
 t/quotify-5.6.t
+t/quotify-no-hex.t
 t/quotify.t
 t/sub-defer-no-subname.t
 t/sub-defer-threads.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Quote-2.006003/META.json 
new/Sub-Quote-2.006006/META.json
--- old/Sub-Quote-2.006003/META.json    2019-03-10 23:31:57.000000000 +0100
+++ new/Sub-Quote-2.006006/META.json    2019-10-01 19:33:14.000000000 +0200
@@ -4,7 +4,7 @@
       "mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter 
version 2.150010",
+   "generated_by" : "ExtUtils::MakeMaker version 7.38, CPAN::Meta::Converter 
version 2.150010",
    "license" : [
       "perl_5"
    ],
@@ -63,7 +63,7 @@
       },
       "x_IRC" : "irc://irc.perl.org/#moose"
    },
-   "version" : "2.006003",
+   "version" : "2.006006",
    "x_authority" : "cpan:MSTROUT",
-   "x_serialization_backend" : "JSON::PP version 4.02"
+   "x_serialization_backend" : "JSON::PP version 4.04"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Quote-2.006003/META.yml 
new/Sub-Quote-2.006006/META.yml
--- old/Sub-Quote-2.006003/META.yml     2019-03-10 23:31:56.000000000 +0100
+++ new/Sub-Quote-2.006006/META.yml     2019-10-01 19:33:14.000000000 +0200
@@ -8,7 +8,7 @@
 configure_requires:
   ExtUtils::MakeMaker: '0'
 dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 
2.150010'
+generated_by: 'ExtUtils::MakeMaker version 7.38, CPAN::Meta::Converter version 
2.150010'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -28,6 +28,6 @@
   bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Sub-Quote
   license: http://dev.perl.org/licenses/
   repository: https://github.com/moose/Sub-Quote.git
-version: '2.006003'
+version: '2.006006'
 x_authority: cpan:MSTROUT
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Quote-2.006003/README 
new/Sub-Quote-2.006006/README
--- old/Sub-Quote-2.006003/README       2019-03-10 23:31:57.000000000 +0100
+++ new/Sub-Quote-2.006006/README       2019-10-01 19:33:15.000000000 +0200
@@ -130,8 +130,12 @@
      my $quoted_value = quotify $value;
 
     Quotes a single (non-reference) scalar value for use in a code string.
-    Numbers aren't treated specially and will be quoted as strings, but
-    undef will quoted as "undef()".
+    The result should reproduce the original value, including strings,
+    undef, integers, and floating point numbers. The resulting floating
+    point numbers (including infinites and not a number) should be precisely
+    equal to the original, if possible. The exact format of the resulting
+    number should not be relied on, as it may include hex floats or math
+    expressions.
 
   capture_unroll
      my $prelude = capture_unroll '$captures', {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Quote-2.006003/lib/Sub/Defer.pm 
new/Sub-Quote-2.006006/lib/Sub/Defer.pm
--- old/Sub-Quote-2.006003/lib/Sub/Defer.pm     2019-03-10 23:30:43.000000000 
+0100
+++ new/Sub-Quote-2.006006/lib/Sub/Defer.pm     2019-10-01 19:31:09.000000000 
+0200
@@ -5,7 +5,7 @@
 use Scalar::Util qw(weaken);
 use Carp qw(croak);
 
-our $VERSION = '2.006003';
+our $VERSION = '2.006006';
 $VERSION = eval $VERSION;
 
 our @EXPORT = qw(defer_sub undefer_sub undefer_all);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Quote-2.006003/lib/Sub/Quote.pm 
new/Sub-Quote-2.006006/lib/Sub/Quote.pm
--- old/Sub-Quote-2.006003/lib/Sub/Quote.pm     2019-03-10 23:30:43.000000000 
+0100
+++ new/Sub-Quote-2.006006/lib/Sub/Quote.pm     2019-10-01 19:31:09.000000000 
+0200
@@ -15,10 +15,30 @@
   *_HAVE_IS_UTF8 = defined &utf8::is_utf8 ? sub(){1} : sub(){0};
   *_HAVE_PERLSTRING = defined &B::perlstring ? sub(){1} : sub(){0};
   *_BAD_BACKSLASH_ESCAPE = _HAVE_PERLSTRING() && "$]" == 5.010_000 ? sub(){1} 
: sub(){0};
+  *_HAVE_HEX_FLOAT = !$ENV{SUB_QUOTE_NO_HEX_FLOAT} && "$]" >= 5.022 ? sub(){1} 
: sub(){0};
+
+  # This may not be perfect, as we can't tell the format purely from the size
+  # but it should cover the common cases, and other formats are more likely to
+  # be less precise.
+  my $nvsize = 8 * length pack 'F', 0;
+  my $nvmantbits
+    = $nvsize == 16   ? 11
+    : $nvsize == 32   ? 24
+    : $nvsize == 64   ? 53
+    : $nvsize == 80   ? 64
+    : $nvsize == 128  ? 113
+    : $nvsize == 256  ? 237
+                      : 237 # unknown float format
+    ;
+  my $precision = int( log(2)/log(10)*$nvmantbits );
+
+  *_NVSIZE = sub(){$nvsize};
+  *_NVMANTBITS = sub(){$nvmantbits};
+  *_FLOAT_PRECISION = sub(){$precision};
 }
 
-our $VERSION = '2.006003';
-$VERSION = eval $VERSION;
+our $VERSION = '2.006006';
+$VERSION =~ tr/_//d;
 
 our @EXPORT = qw(quote_sub unquote_sub quoted_from_sub qsub);
 our @EXPORT_OK = qw(quotify capture_unroll inlinify sanitize_identifier);
@@ -50,20 +70,52 @@
     && 0 + $value eq $value
   ) ? (
     $value != $value ? (
-      $value eq -CORE::sin(9**9**9)
-        ? '(-CORE::sin(9**9**9))' # -nan
-        : 'CORE::sin(9**9**9)'    # nan
+      $value eq (9**9**9*0)
+        ? '(9**9**9*0)'    # nan
+        : '(-(9**9**9*0))' # -nan
     )
-    : $value == 9**9**9 ? '(9**9**9)'      # inf
+    : $value == 9**9**9  ? '(9**9**9)'     # inf
     : $value == -9**9**9 ? '(-9**9**9)'    # -inf
-    : int($value) == $value ? $value       # integer
+    : $value == 0 ? (
+      sprintf('%g', $value) eq '-0' ? '-0.0' : '0',
+    )
+    : $value !~ /[e.]/i ? (
+      $value > 0 ? (sprintf '%u', $value)
+                 : (sprintf '%d', $value)
+    )
     : do {
-      my $float = sprintf('%.20f', $value);
-      $float =~ s/(\.[0-9]+?)0+\z/$1/;
-      $float;
+      my $float = $value;
+      my $max_factor = int( log( abs($value) ) / log(2) ) - _NVMANTBITS;
+      my $ex_sign = $max_factor > 0 ? 1 : -1;
+      FACTOR: for my $ex (0 .. abs($max_factor)) {
+        my $num = $value / 2**($ex_sign * $ex);
+        for my $precision (_FLOAT_PRECISION .. _FLOAT_PRECISION+2) {
+          my $formatted = sprintf '%.'.$precision.'g', $num;
+          $float = $formatted
+            if $ex == 0;
+          if ($formatted == $num) {
+            if ($ex) {
+              $float
+                = $formatted
+                . ($ex_sign == 1 ? '*' : '/')
+                . (
+                  $ex > _NVMANTBITS
+                    ? "2**$ex"
+                    : sprintf('%u', 2**$ex)
+                );
+            }
+            last FACTOR;
+          }
+        }
+        if (_HAVE_HEX_FLOAT) {
+          $float = sprintf '%a', $value;
+          last FACTOR;
+        }
+      }
+      "$float";
     }
   )
-  : !length($value) && eval { use warnings 'FATAL' => 'numeric'; $value == 0 } 
? '(!1)' # false
+  : !length($value) && length( (my $dummy2 = '') & $value ) ? '(!1)' # false
   : _BAD_BACKSLASH_ESCAPE && _HAVE_IS_UTF8 && utf8::is_utf8($value) ? do {
     $value =~ s/(["\$\@\\[:cntrl:]]|[^\x00-\x7f])/
       $escape{$1} || sprintf('\x{%x}', ord($1))
@@ -216,6 +268,7 @@
       ."  \%^H = (\n"
       . join('', map
       "    ".quotify($_)." => ".quotify($hintshash->{$_}).",\n",
+        grep !(ref $hintshash->{$_} && $hintshash->{$_} =~ 
/\A(?:\w+(?:::\w+)*=)?[A-Z]+\(0x[[0-9a-fA-F]+\)\z/),
         keys %$hintshash)
       ."  );\n"
       ."}\n"
@@ -482,9 +535,12 @@
 
  my $quoted_value = quotify $value;
 
-Quotes a single (non-reference) scalar value for use in a code string.  Numbers
-aren't treated specially and will be quoted as strings, but undef will quoted 
as
-C<undef()>.
+Quotes a single (non-reference) scalar value for use in a code string.  The
+result should reproduce the original value, including strings, undef, integers,
+and floating point numbers.  The resulting floating point numbers (including
+infinites and not a number) should be precisely equal to the original, if
+possible.  The exact format of the resulting number should not be relied on, as
+it may include hex floats or math expressions.
 
 =head2 capture_unroll
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Quote-2.006003/t/quotify-no-hex.t 
new/Sub-Quote-2.006006/t/quotify-no-hex.t
--- old/Sub-Quote-2.006003/t/quotify-no-hex.t   1970-01-01 01:00:00.000000000 
+0100
+++ new/Sub-Quote-2.006006/t/quotify-no-hex.t   2019-09-05 22:54:08.000000000 
+0200
@@ -0,0 +1,5 @@
+use strict;
+use warnings;
+no warnings 'once';
+$::SUB_QUOTE_NO_HEX_FLOAT = 1;
+do './t/quotify.t' or die $@ || $!;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Sub-Quote-2.006003/t/quotify.t 
new/Sub-Quote-2.006006/t/quotify.t
--- old/Sub-Quote-2.006003/t/quotify.t  2019-01-28 16:16:37.000000000 +0100
+++ new/Sub-Quote-2.006006/t/quotify.t  2019-09-05 22:54:08.000000000 +0200
@@ -2,15 +2,28 @@
 use warnings;
 no warnings 'once';
 use Test::More;
-use Test::Fatal;
 use Data::Dumper;
 use B;
+BEGIN {
+  $ENV{SUB_QUOTE_NO_HEX_FLOAT} = $::SUB_QUOTE_NO_HEX_FLOAT ? 1 : 0;
+}
 
 use Sub::Quote qw(
   quotify
 );
 
-use constant HAVE_UTF8 => Sub::Quote::_HAVE_IS_UTF8;
+use constant HAVE_UTF8       => Sub::Quote::_HAVE_IS_UTF8;
+use constant FLOAT_PRECISION => Sub::Quote::_FLOAT_PRECISION;
+use constant HAVE_HEX_FLOAT  => Sub::Quote::_HAVE_HEX_FLOAT;
+use constant INF => 9**9**9**9;
+use constant NAN => INF * 0;
+use constant MAXUINT => ~0;
+use constant MAXINT  => ~0 >> 1;
+use constant MININT  => -(~0 >> 1) - 1;
+use constant INF_NAN_SUPPORT => (
+  INF == 10 * INF
+  and !(NAN == 0 || NAN == 0.1 || NAN + 0 == 0)
+);
 
 sub _dump {
   my $value = shift;
@@ -32,6 +45,13 @@
   !!( $flags & ( B::SVp_IOK | B::SVp_NOK ) )
 }
 
+sub is_float {
+  my $num = shift;
+    $num != int($num)
+  || $num > ~0
+  || $num < -(~0>>1)-1;
+}
+
 sub is_strict_numeric {
   my $flags = B::svref_2object(\($_[0]))->FLAGS;
 
@@ -88,12 +108,34 @@
 
 my @numbers = (
   -20 .. 20,
-  qw(00 01 .0 .1 0.0 0.00 00.00 0.10 0.101 1e5 1e-5 1e50), '0 but true',
+  -0.0,
+  qw(00 01 .0 .1 0.0 0.00 00.00 0.10 0.101),
+  '0 but true',
+  '0e0',
+  (map +("1e$_", "-1e$_"), -50, -5, 0, 1, 5, 50),
   (map 1 / $_, -10 .. -2, 2 .. 10),
-  9**9**9,        # inf
-  -9**9**9,       # -inf
-  sin(9**9**9),   # nan
-  -sin(9**9**9),  # -nan
+  (map +(1 / 9) * $_, -9 .. -1, 1 .. 9),
+  (map $_ x 100, 1 .. 9),
+  3.14159265358979323846264338327950288419716939937510,
+  2.71828182845904523536028747135266249775724709369995,
+  sqrt(2),
+  1.4142135623730951,
+  1.4142135623730954,
+  sqrt(3),
+  1.7320508075688772935274463415058722,
+  1.73205080756887729352744634150587224,
+  sqrt(5),
+  2.2360679774997896963,
+  2.23606797749978969634,
+  MAXUINT,
+  MAXUINT-1,
+  MAXINT,
+  MAXINT+1,
+  MININT,
+  (INF_NAN_SUPPORT ? (
+    INF, -(INF),
+    NAN, -(NAN),
+  ) : ()),
 );
 
 my @strings = (
@@ -175,8 +217,24 @@
 
     if (is_numeric($value)) {
       if ($value == $value) {
+        my $todo;
+        if (!HAVE_HEX_FLOAT && $check_value != $value && is_float($value)) {
+          my $diff = abs($check_value - $value);
+          my $accuracy = abs($value)/$diff;
+          my $precision = FLOAT_PRECISION + 1;
+          $todo = "not always accurate beyond $precision digits"
+            if $accuracy <= 10**$precision;
+        }
+
+        local $TODO = $todo
+          if $todo;
         cmp_ok $check_value, '==', $value,
-          "$value_name: numeric value maintained$suffix";
+          "$value_name: numeric value maintained$suffix"
+          or do {
+            diag "quotified as $quoted";
+            diag "got float      : ".uc unpack("h*", pack("F", $check_value));
+            diag "expected float : ".uc unpack("h*", pack("F", $value));
+          };
       }
       else {
         cmp_ok $check_value, '!=', $check_value,


Reply via email to