gmp 0.5.23-x86-mingw32 → 0.5.41-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +13 -0
- data/FEATURES.html +145 -2
- data/README.rdoc +70 -68
- data/benchmark/multiply.fnl +47 -0
- data/ext/extconf.rb +4 -0
- data/ext/gmp.so +0 -0
- data/ext/gmpf.c +1 -0
- data/ext/gmpz.c +302 -4
- data/ext/ruby_gmp.h +10 -4
- data/manual.pdf +0 -0
- data/manual.tex +84 -61
- data/test/tc_f_precision.rb +1 -1
- data/test/tc_hashes.rb +2 -0
- data/test/tc_logical_roots.rb +2 -0
- data/test/tc_mpfr_constants.rb +2 -0
- data/test/tc_mpfr_functions.rb +2 -0
- data/test/tc_mpfr_random.rb +2 -0
- data/test/tc_mpfr_rounding.rb +2 -0
- data/test/tc_q.rb +2 -0
- data/test/tc_q_basic.rb +2 -0
- data/test/tc_random.rb +2 -0
- data/test/tc_sgn_neg_abs.rb +2 -0
- data/test/tc_swap.rb +2 -0
- data/test/tc_z.rb +2 -2
- data/test/tc_z_addmul.rb +2 -0
- data/test/tc_z_basic.rb +2 -0
- data/test/tc_z_exponentiation.rb +3 -1
- data/test/tc_z_functional_mappings.rb +100 -0
- data/test/tc_z_gcd_lcm_invert.rb +2 -0
- data/test/tc_z_jac_leg_rem.rb +2 -0
- data/test/tc_zerodivisionexceptions.rb +3 -1
- data/test/unit_tests.rb +5 -4
- metadata +6 -4
data/test/tc_f_precision.rb
CHANGED
@@ -98,7 +98,7 @@ class TC_precision < Test::Unit::TestCase
|
|
98
98
|
assert_raise(RangeError) { GMP::F.default_prec = -64 }
|
99
99
|
assert_raise(TypeError) { GMP::F.default_prec = "Cow" }
|
100
100
|
rescue NameError => err
|
101
|
-
raise unless err.to_s
|
101
|
+
raise unless err.to_s =~ /uninitialized constant:? GMP::MPFR_VERSION/
|
102
102
|
GMP::F.default_prec = 100
|
103
103
|
assert_equal(128, GMP::F.default_prec, "GMP::F.default_prec should be assignable.")
|
104
104
|
GMP::F.default_prec = 130
|
data/test/tc_hashes.rb
CHANGED
data/test/tc_logical_roots.rb
CHANGED
data/test/tc_mpfr_constants.rb
CHANGED
data/test/tc_mpfr_functions.rb
CHANGED
data/test/tc_mpfr_random.rb
CHANGED
data/test/tc_mpfr_rounding.rb
CHANGED
data/test/tc_q.rb
CHANGED
data/test/tc_q_basic.rb
CHANGED
data/test/tc_random.rb
CHANGED
data/test/tc_sgn_neg_abs.rb
CHANGED
data/test/tc_swap.rb
CHANGED
data/test/tc_z.rb
CHANGED
@@ -57,7 +57,7 @@ class TC_Z < Test::Unit::TestCase
|
|
57
57
|
b = GMP::Z(17)
|
58
58
|
a_factors = [1,2,3,4,5,6,8,10,12,15,20,24,30,40,60,120]
|
59
59
|
a_factors.each do |d|
|
60
|
-
assert_true(a.divisible?(d), "GMP::Z#divisible? ui should be
|
60
|
+
assert_true(a.divisible?(d), "GMP::Z#divisible? ui should be true: #{a}.divisible? #{d}")
|
61
61
|
end
|
62
62
|
((1..120).to_a - a_factors).each do |d|
|
63
63
|
assert_false(a.divisible?(d), "GMP::Z#divisible? ui should be false: #{a}.divisible? #{d}")
|
@@ -74,7 +74,7 @@ class TC_Z < Test::Unit::TestCase
|
|
74
74
|
743*109_582_894_312_963_583,
|
75
75
|
29*743*109_582_894_312_963_583]
|
76
76
|
a_factors.each do |d|
|
77
|
-
assert_true(a.divisible?(d), "GMP::Z#divisible? bignum should be
|
77
|
+
assert_true(a.divisible?(d), "GMP::Z#divisible? bignum should be true: #{a}.divisible? #{d}")
|
78
78
|
end
|
79
79
|
a_factors.map { |n| n*2 }.each do |d|
|
80
80
|
assert_false(a.divisible?(d), "GMP::Z#divisible? ui should be false: #{a}.divisible? #{d}")
|
data/test/tc_z_addmul.rb
CHANGED
data/test/tc_z_basic.rb
CHANGED
data/test/tc_z_exponentiation.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require './test_helper'
|
2
|
+
|
1
3
|
class TC_Z_Exponentiation < Test::Unit::TestCase
|
2
4
|
def setup
|
3
5
|
@a = GMP::Z.new(100)
|
@@ -6,7 +8,7 @@ class TC_Z_Exponentiation < Test::Unit::TestCase
|
|
6
8
|
end
|
7
9
|
|
8
10
|
def test_exponentiation
|
9
|
-
assert_equal(GMP::Z(10000000000),
|
11
|
+
assert_equal(@a**5, GMP::Z(10000000000), "GMP::Z should **(Fixnum) correctly")
|
10
12
|
assert_equal(GMP::Z("100000000000000000000000000000000"), @a**@b, "GMP::Z should **(GMP::Z) correctly")
|
11
13
|
assert_equal(GMP::Z(65536), 2**@b, "Fixnum should **(GMP::Z) correctly")
|
12
14
|
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require './test_helper'
|
2
|
+
|
3
|
+
class TC_Z_Functional_Mappings < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@_64bit = 1_000_000_000_000.is_a? Fixnum
|
6
|
+
@xp1 = 7
|
7
|
+
@xn1 = -5
|
8
|
+
@b1 = 2**70
|
9
|
+
# TODO: Add edge cases along Fixnum/Bignum border!!
|
10
|
+
@z1 = GMP::Z(12)
|
11
|
+
end
|
12
|
+
|
13
|
+
# 01 mpz_t__mpz_t_or_ui__to__mpz_t__returns__void
|
14
|
+
def test_FUNC_MAP__Z_ZUI__TO__Z__RETURNS__VOID
|
15
|
+
functions = [:add, :addmul, :submul, :divexact, :lcm]
|
16
|
+
rop = GMP::Z(0)
|
17
|
+
op1s = [@z1]
|
18
|
+
op2s = [@xp1, @xn1, @b1, @z1]
|
19
|
+
functions.each do |f|
|
20
|
+
op1s.each do |op1|
|
21
|
+
op2s.each do |op2|
|
22
|
+
assert_nothing_raised("GMP::Z.#{f.to_s} should not raise when passed (#{rop.class}, #{op1.class}, #{op2.class})") {
|
23
|
+
GMP::Z.send(f, rop, op1, op2)
|
24
|
+
}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# 02 mpz_t_or_ui__mpz_t_or_ui__to__mpz_t__returns__void
|
31
|
+
def test_FUNC_MAP__ZUI_ZUI__TO__Z__RETURNS__VOID
|
32
|
+
functions = [:sub]
|
33
|
+
rop = GMP::Z(0)
|
34
|
+
op1s = [@xp1, @xn1, @b1, @z1]
|
35
|
+
op2s = [@xp1, @xn1, @b1, @z1]
|
36
|
+
functions.each do |f|
|
37
|
+
op1s.each do |op1|
|
38
|
+
op2s.each do |op2|
|
39
|
+
assert_nothing_raised("GMP::Z.#{f.to_s} should not raise when passed (#{rop.class}, #{op1.class}, #{op2.class})") {
|
40
|
+
GMP::Z.send(f, rop, op1, op2)
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# 03 mpz_t__mpz_t_or_si_or_ui__to__mpz_t__returns__void
|
48
|
+
def test_FUNC_MAP__Z_ZSIUI__TO__Z__RETURNS__VOID
|
49
|
+
functions = [:mul]
|
50
|
+
rop = GMP::Z(0)
|
51
|
+
op1s = [@z1]
|
52
|
+
op2s = [@xp1, @xn1, @b1, @z1]
|
53
|
+
functions.each do |f|
|
54
|
+
op1s.each do |op1|
|
55
|
+
op2s.each do |op2|
|
56
|
+
assert_nothing_raised("GMP::Z.#{f.to_s} should not raise when passed (#{rop.class}, #{op1.class}, #{op2.class})") {
|
57
|
+
GMP::Z.send(f, rop, op1, op2)
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# 04 mpz_t__mp_bitcnt_t__to__mpz_t__returns__void
|
65
|
+
def test_FUNC_MAP__Z_BITCNT__TO__Z__RETURNS__VOID
|
66
|
+
functions = [:mul_2exp, :cdiv_q_2exp, :cdiv_r_2exp, :fdiv_q_2exp, :fdiv_r_2exp, :tdiv_q_2exp, :tdiv_r_2exp]
|
67
|
+
rop = GMP::Z(0)
|
68
|
+
op1s = [@z1]
|
69
|
+
functions.each do |f|
|
70
|
+
op1s.each do |op1|
|
71
|
+
op2s = [@xp1]
|
72
|
+
op2s.each do |op2|
|
73
|
+
assert_nothing_raised("GMP::Z.#{f.to_s} should not raise when passed (#{rop.class}, #{op1.class}, #{op2.class})") {
|
74
|
+
GMP::Z.send(f, rop, op1, op2)
|
75
|
+
}
|
76
|
+
end
|
77
|
+
op2s = [@xn1]
|
78
|
+
op2s.each do |op2|
|
79
|
+
assert_raise(RangeError, "GMP::Z.#{f.to_s} should raise a RangeError when passed (#{rop.class}, #{op1.class}, #{op2.class})") {
|
80
|
+
GMP::Z.send(f, rop, op1, op2)
|
81
|
+
}
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# 05 mpz_t__to__mpz_t__returns__void
|
88
|
+
def test_FUNC_MAP__Z__TO__Z__RETURNS__VOID
|
89
|
+
functions = [:neg, :abs, :sqrt, :nextprime, :com]
|
90
|
+
rop = GMP::Z(0)
|
91
|
+
op1s = [@z1]
|
92
|
+
functions.each do |f|
|
93
|
+
op1s.each do |op1|
|
94
|
+
assert_nothing_raised("GMP::Z.#{f.to_s} should not raise when passed (#{rop.class}, #{op1.class})") {
|
95
|
+
GMP::Z.send(f, rop, op1)
|
96
|
+
}
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
data/test/tc_z_gcd_lcm_invert.rb
CHANGED
data/test/tc_z_jac_leg_rem.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require './test_helper'
|
2
|
+
|
1
3
|
class TC_ZeroDivisionExceptions < Test::Unit::TestCase
|
2
4
|
def setup
|
3
5
|
@a = GMP::Z.new(10)
|
@@ -14,4 +16,4 @@ class TC_ZeroDivisionExceptions < Test::Unit::TestCase
|
|
14
16
|
assert_raise(ZeroDivisionError) { @c/0 }
|
15
17
|
assert_raise(ZeroDivisionError) { @c/@d }
|
16
18
|
end
|
17
|
-
end
|
19
|
+
end
|
data/test/unit_tests.rb
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
require './test_helper'
|
4
4
|
|
5
5
|
require './tc_constants'
|
6
|
+
require './tc_division'
|
7
|
+
require './tc_f_precision'
|
8
|
+
require './tc_f_arithmetics_coersion'
|
6
9
|
require './tc_z'
|
7
10
|
require './tc_z_basic'
|
8
11
|
require './tc_z_addmul'
|
@@ -14,19 +17,17 @@ require './tc_z_shifts_last_bits'
|
|
14
17
|
require './tc_z_jac_leg_rem'
|
15
18
|
require './tc_z_gcd_lcm_invert'
|
16
19
|
require './tc_q'
|
17
|
-
require './tc_cmp'
|
18
20
|
require './tc_q_basic'
|
21
|
+
require './tc_cmp'
|
19
22
|
require './tc_zerodivisionexceptions'
|
20
23
|
require './tc_sgn_neg_abs'
|
21
24
|
require './tc_fib_fac_nextprime'
|
22
25
|
require './tc_swap'
|
23
26
|
require './tc_floor_ceil_truncate'
|
24
27
|
require './tc_logical_roots'
|
25
|
-
require './tc_f_precision'
|
26
|
-
require './tc_f_arithmetics_coersion'
|
27
|
-
require './tc_division'
|
28
28
|
require './tc_random'
|
29
29
|
require './tc_hashes'
|
30
|
+
require './tc_z_functional_mappings'
|
30
31
|
|
31
32
|
require './gmp_tgcd'
|
32
33
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 89
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 41
|
10
|
+
version: 0.5.41
|
11
11
|
platform: x86-mingw32
|
12
12
|
authors:
|
13
13
|
- Tomasz Wegrzanowski
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-11-17 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- test/tc_z_addmul.rb
|
80
80
|
- test/tc_z_basic.rb
|
81
81
|
- test/tc_z_exponentiation.rb
|
82
|
+
- test/tc_z_functional_mappings.rb
|
82
83
|
- test/tc_z_gcd_lcm_invert.rb
|
83
84
|
- test/tc_z_jac_leg_rem.rb
|
84
85
|
- test/tc_z_logic.rb
|
@@ -99,6 +100,7 @@ files:
|
|
99
100
|
- benchmark/gexpr.c
|
100
101
|
- benchmark/gexpr.exe
|
101
102
|
- benchmark/multiply
|
103
|
+
- benchmark/multiply.fnl
|
102
104
|
- benchmark/multiply.gc
|
103
105
|
- benchmark/pi
|
104
106
|
- benchmark/README
|