@@ -1,5 +1,14 @@
Revision history for Perl extension Math::Int128.
+0.15 Nov 30, 2014
+ - improve clang version detection code (bug report by Olaf
+ Alders)
+ - relax gcc version detection
+
+0.14 Nov 29, 2014
+ - tests were broken on perls compiled with -Dusequadmath (bug
+ report by Sisyphus)
+
0.13 Sep 7, 2013
- fix unaligned memory access problems happening on
Windows+Strawerry Perl (bug report by Sisyphus)
@@ -4,7 +4,7 @@
"Salvador Fandino <sfandino@yahoo.com>"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112150",
+ "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142690",
"license" : [
"unknown"
],
@@ -22,17 +22,18 @@
"prereqs" : {
"build" : {
"requires" : {
- "ExtUtils::MakeMaker" : 0
+ "ExtUtils::MakeMaker" : "0",
+ "Test::More" : "0.88"
}
},
"configure" : {
"requires" : {
- "ExtUtils::MakeMaker" : 0
+ "ExtUtils::MakeMaker" : "0"
}
},
"runtime" : {
"requires" : {
- "Math::Int64" : "0.27_04"
+ "Math::Int64" : "0.34"
}
}
},
@@ -42,5 +43,5 @@
"url" : "https://github.com/salva/p5-Math-Int128"
}
},
- "version" : "0.13"
+ "version" : "0.15"
}
@@ -3,22 +3,23 @@ abstract: 'Manipulate 128 bits integers in Perl'
author:
- 'Salvador Fandino <sfandino@yahoo.com>'
build_requires:
- ExtUtils::MakeMaker: 0
+ ExtUtils::MakeMaker: '0'
+ Test::More: '0.88'
configure_requires:
- ExtUtils::MakeMaker: 0
+ ExtUtils::MakeMaker: '0'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112150'
+generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142690'
license: unknown
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: Math-Int128
no_index:
directory:
- t
- inc
requires:
- Math::Int64: 0.27_04
+ Math::Int64: '0.34'
resources:
repository: https://github.com/salva/p5-Math-Int128
-version: 0.13
+version: '0.15'
@@ -2,7 +2,7 @@ use ExtUtils::MakeMaker;
use Config;
-my %deps = ('Math::Int64' => '0.27_04');
+my %deps = ('Math::Int64' => '0.34');
unless (-f "c_api.h") {
$deps{'Module::CAPIMaker'} = '0.01';
@@ -30,20 +30,21 @@ my $mm = WriteMakefile(NAME => 'Math::Int128',
},
);
-my $cc = (grep defined, $mm->{CC}, $Config{cc}, 'cc')[0];
+my $cc = 'cc';#(grep defined, $mm->{CC}, $Config{cc}, 'cc')[0];
my $cc_version = `$cc --version --verbose 2>&1`;
-if (($cc_version =~ /^GNU\s+C\s+\([^)]*\)\s+version\s+(4\.(\d+)\S*)/im or
- $cc_version =~ /^g?cc\s+\(GCC\)\s+(4\.(\d+)\S*)/im ) and
- $2 >= 4) {
+if ( ($cc_version =~ /^GNU\s+C\s+\([^)]*\)\s+version\s+((\d+\.\d+)\S*)/im or
+ $cc_version =~ /^g?cc\s+\(GCC\)\s+((\d+.\d+)\S*)/im or
+ $cc_version =~ /^gcc\s+version\s+((\d+\.\d+)\S*)/im) and
+ $2 >= 4.4) {
print "GNU C compiler version $1 found, good!\n";
}
-elsif ($cc_version =~ /\bclang\s+version\s+(3.(\d+)\S*)/im and
- $2 >= 2) {
+elsif ($cc_version =~ /\bclang\s+version\s+((\d+\.\d+)\S*)/im and
+ $2 >= 3.2) {
print "Clang compiler version $1 found, good!\n";
}
else {
unlink $mm->{MAKEFILE};
- die "This module requires version 4.4 or above of the GCC compiler.\nAborting!\n\n"
+ die "This module requires gcc 4.4 or clang 3.2 or above.\nAborting!\n\n"
}
@@ -9,7 +9,7 @@ See the POD documentation.
COPYRIGHT AND LICENCE
-Copyright (C) 2007, 2009, 2011-2013 by Salvador Fandino
+Copyright (C) 2007, 2009, 2011-2014 by Salvador Fandino
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.10.1 or,
@@ -3,8 +3,8 @@
* c_api.h - This file is in the public domain
* Author: Salvador Fandino <sfandino@yahoo.com>
*
- * Generated on: 2013-09-06 20:42:10
- * Math::Int128 version: 0.13
+ * Generated on: 2012-09-10 13:21:21
+ * Math::Int128 version: 0.06_07
* Module::CAPIMaker version: 0.02
*/
@@ -2,8 +2,8 @@
* perl_math_int128.c - This file is in the public domain
* Author: Salvador Fandino <sfandino@yahoo.com>
*
- * Generated on: 2013-09-06 20:42:10
- * Math::Int128 version: 0.13
+ * Generated on: 2012-09-10 13:21:21
+ * Math::Int128 version: 0.06_07
* Module::CAPIMaker version: 0.02
*/
@@ -2,8 +2,8 @@
* perl_math_int128.h - This file is in the public domain
* Author: Salvador Fandino <sfandino@yahoo.com>
*
- * Generated on: 2013-09-06 20:42:10
- * Math::Int128 version: 0.13
+ * Generated on: 2012-09-10 13:21:21
+ * Math::Int128 version: 0.06_07
* Module::CAPIMaker version: 0.02
*/
@@ -2,8 +2,8 @@
* sample.xs - This file is in the public domain
* Author: Salvador Fandino <sfandino@yahoo.com>
*
- * Generated on: 2013-09-06 20:42:10
- * Math::Int128 version: 0.13
+ * Generated on: 2012-09-10 13:21:21
+ * Math::Int128 version: 0.06_07
*/
#include "EXTERN.h"
@@ -4,7 +4,7 @@ use strict;
use warnings;
BEGIN {
- our $VERSION = '0.13';
+ our $VERSION = '0.15';
require XSLoader;
XSLoader::load('Math::Int128', $VERSION);
@@ -245,7 +245,7 @@ L<http://perlmonks.org/?node_id=886488>.
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2007, 2009, 2011-2013 by Salvador FandiE<ntilde>o
+Copyright (C) 2007, 2009, 2011-2014 by Salvador FandiE<ntilde>o
(sfandino@yahoo.com)
This library is free software; you can redistribute it and/or modify
@@ -2,8 +2,8 @@
* perl_math_int64.c - This file is in the public domain
* Author: Salvador Fandino <sfandino@yahoo.com>
*
- * Generated on: 2013-01-07 20:05:31
- * Math::Int64 version: 0.29
+ * Generated on: 2014-10-30 11:43:56
+ * Math::Int64 version: 0.33
* Module::CAPIMaker version: 0.02
*/
@@ -1,10 +1,10 @@
/*
* perl_math_int64.h - This file is in the public domain
* Author: Salvador Fandino <sfandino@yahoo.com>
- * Version: 2.0
+ * Version: 2.1
*
- * Generated on: 2013-01-07 20:05:31
- * Math::Int64 version: 0.29
+ * Generated on: 2014-10-30 11:43:56
+ * Math::Int64 version: 0.33
* Module::CAPIMaker version: 0.02
*/
@@ -54,6 +54,14 @@ extern uint64_t (*math_int64_c_api_randU64)(pTHX);
#undef newSVu64
#define newSVu64 newSVuv
+#define sv_seti64 sv_setiv_mg
+#define sv_setu64 sv_setuv_mg
+
+#else
+
+#define sv_seti64(target, i64) (sv_setsv_mg(target, sv_2mortal(newSVi64(i64))))
+#define sv_setu64(target, u64) (sv_setsv_mg(target, sv_2mortal(newSVu64(u64))))
+
#endif
#endif
\ No newline at end of file
@@ -5,7 +5,7 @@ use warnings;
use Test::More 0.88;
-use Math::Int128 qw(int128 int128_to_number
+use Math::Int128 qw(int128 int128_to_number uint128
net_to_int128 int128_to_net
native_to_int128 int128_to_native);
@@ -138,7 +138,24 @@ my $four = int128(4);
is ($two ** -1, 0, "signed pow 2**-1");
is ($four ** -1, 0, "signed pow 4**-1");
-for my $j (0..127) {
+sub slow_pow_int128 {
+ my ($a, $b) = @_;
+ my $acu = int128(1);
+ $acu *= $a for 1..$b;
+ $acu;
+}
+
+sub slow_pow_nv {
+ my ($base, $exp) = @_;
+ my $r = 1;
+ $r *= $base for 1..$exp;
+ $r
+}
+
+use Math::BigInt;
+
+my $max = (((int128(2) ** 126) - 1) * 2) + 1; # 2 ** 127 - 1
+for my $j (0..126) {
my $one = int128(1);
is($two ** $j, $one << $j, "signed pow 2**$j");
@@ -151,26 +168,25 @@ for my $j (0..127) {
next unless $j;
- my $max = (((int128(2)**126)-1)*2)+1;
- is($max >> $j, $max / ( 2**$j ), "max int128 >> $j");
+ my $pow2j = slow_pow_nv(2, $j);
+
+ is(uint128($pow2j), uint128(2)**$j, "int128 pow and NV to int128 conversion");
+ is($max >> $j, $max / $pow2j, "max int128 >> $j")
+ or diag '$max >> $j = ' . ($max >> $j) . ', $max / 2 ** $j = ' . ($max / $pow2j) .
+ ", \$max = $max, \$j = $j, 2 ** \$j = " . sprintf("%f", $pow2j) .
+ ", int128(2 ** \$j) = " . int128($pow2j);
my $copy = int128($max);
$copy >>= $j;
- is($copy, $max / ( 2**$j ), "max int128 >>= $j");
+ is($copy, $max / $pow2j, "max int128 >>= $j");
}
for my $i (5..9) {
for my $j (0..40) { # 9**40 < 2**127
- is(int128($i) ** $j, slow_pow($i, $j), "signed pow $i ** $j");
+ is(int128($i) ** $j, slow_pow_int128($i, $j), "signed pow $i ** $j");
}
}
done_testing();
-sub slow_pow {
- my ($a, $b) = @_;
- my $acu = int128(1);
- $acu *= $a for 1..$b;
- $acu;
-}
@@ -139,6 +139,21 @@ my $four = uint128(4);
is ($two ** -1, 0, "signed pow 2**-1");
is ($four ** -1, 0, "signed pow 4**-1");
+sub slow_pow_uint128 {
+ my ($a, $b) = @_;
+ my $acu = uint128(1);
+ $acu *= $a for 1..$b;
+ $acu;
+}
+
+sub slow_pow_nv {
+ my ($base, $exp) = @_;
+ my $r = 1;
+ $r *= $base for 1..$exp;
+ $r
+}
+
+my $max = (((uint128(2) ** 127) - 1) * 2) + 1;
for my $j (0..127) {
my $one = uint128(1);
@@ -152,25 +167,19 @@ for my $j (0..127) {
next unless $j;
- my $max = (((uint128(2)**127)-1)*2)+1;
- is($max >> $j, $max / ( 2**$j ), "max uint128 >> $j");
+ my $pow2j = slow_pow_nv(2, $j);
+
+ is($max >> $j, $max / $pow2j, "max uint128 >> $j");
my $copy = uint128($max);
$copy >>= $j;
- is($copy, $max / ( 2**$j ), "max uint128 >>= $j");
+ is($copy, $max / $pow2j, "max uint128 >>= $j");
}
for my $i (5..9) {
for my $j (0..40) { # 9**40 < 2**127
- is(uint128($i) ** $j, slow_pow($i, $j), "signed pow $i ** $j");
+ is(uint128($i) ** $j, slow_pow_uint128($i, $j), "signed pow $i ** $j");
}
}
done_testing();
-
-sub slow_pow {
- my ($a, $b) = @_;
- my $acu = uint128(1);
- $acu *= $a for 1..$b;
- $acu;
-}