gmp 0.6.47 → 0.7.19
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.
- checksums.yaml +7 -0
- data/CHANGELOG +21 -1
- data/README.markdown +29 -9
- data/ext/extconf.rb +8 -0
- data/ext/gmp.c +7 -7
- data/ext/gmpf.c +620 -139
- data/ext/gmpq.c +218 -90
- data/ext/gmprandstate.c +57 -53
- data/ext/gmpz.c +492 -440
- data/ext/mprnd.c +44 -35
- data/ext/ruby_gmp.h +6 -6
- data/manual.pdf +0 -0
- data/manual.tex +2 -2
- data/test/mpfr_thypot.rb +60 -0
- data/test/tc_cmp.rb +1 -1
- data/test/tc_constants.rb +1 -1
- data/test/tc_division.rb +1 -1
- data/test/tc_f_abs_neg.rb +1 -1
- data/test/tc_f_arithmetics_coersion.rb +1 -1
- data/test/tc_f_precision.rb +2 -1
- data/test/tc_f_to_s.rb +1 -1
- data/test/tc_hashes.rb +1 -4
- data/test/tc_mpfr_cmp.rb +1 -1
- data/test/tc_mpfr_constants.rb +1 -1
- data/test/tc_mpfr_functions.rb +43 -10
- data/test/tc_mpfr_inf_nan_zero.rb +1 -1
- data/test/tc_mpfr_integer.rb +1 -1
- data/test/tc_mpfr_new_rounding.rb +24 -1
- data/test/tc_mpfr_pow.rb +17 -0
- data/test/tc_mpfr_random.rb +1 -1
- data/test/tc_mpfr_rounding.rb +1 -1
- data/test/tc_q.rb +53 -32
- data/test/tc_q_basic.rb +1 -1
- data/test/{tc_floor_ceil_truncate.rb → tc_q_floor_ceil_truncate.rb} +2 -2
- data/test/tc_q_num_den.rb +18 -0
- data/test/tc_random.rb +1 -4
- data/test/tc_sgn_neg_abs.rb +1 -1
- data/test/tc_swap.rb +1 -1
- data/test/tc_z.rb +1 -1
- data/test/tc_z_addmul.rb +1 -1
- data/test/tc_z_basic.rb +3 -2
- data/test/tc_z_exponentiation.rb +5 -5
- data/test/tc_z_export_import.rb +1 -1
- data/test/{tc_fib_fac_nextprime.rb → tc_z_fib_fac_nextprime.rb} +1 -1
- data/test/tc_z_functional_mappings.rb +2 -2
- data/test/tc_z_gcd_lcm_invert.rb +1 -1
- data/test/tc_z_hamdist.rb +1 -1
- data/test/tc_z_io.rb +2 -1
- data/test/tc_z_jac_leg_rem.rb +1 -1
- data/test/tc_z_logic.rb +1 -1
- data/test/{tc_logical_roots.rb → tc_z_logical_roots.rb} +7 -7
- data/test/tc_z_shifts_last_bits.rb +2 -2
- data/test/tc_z_submul.rb +1 -1
- data/test/tc_z_to_dis.rb +1 -1
- data/test/{tc_zerodivisionexceptions.rb → tc_zero_division_exceptions.rb} +2 -2
- data/test/unit_tests.rb +30 -17
- metadata +16 -16
- data/INSTALL +0 -4
data/test/tc_z_logic.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
2
2
|
|
3
|
-
class
|
3
|
+
class TcIntegerLogicalRoots < Test::Unit::TestCase
|
4
4
|
def setup
|
5
5
|
@a = GMP::Z.new(100)
|
6
6
|
@b = GMP::Z.new( 27)
|
7
7
|
@c = GMP::Z.new( 99)
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
def test_parity
|
11
11
|
assert @a.even?, "GMP::Z should even? correctly."
|
12
12
|
assert !@b.even?, "GMP::Z should even? correctly."
|
@@ -15,31 +15,31 @@ class TC_logical_roots < Test::Unit::TestCase
|
|
15
15
|
assert @b.odd?, "GMP::Z should odd? correctly."
|
16
16
|
assert @c.odd?, "GMP::Z should odd? correctly."
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def test_square
|
20
20
|
assert @a.square?, "GMP::Z should square? correctly."
|
21
21
|
assert !@b.square?, "GMP::Z should square? correctly."
|
22
22
|
assert !@c.square?, "GMP::Z should square? correctly."
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
def test_power
|
26
26
|
assert @a.power?, "GMP::Z should power? correctly."
|
27
27
|
assert @b.power?, "GMP::Z should power? correctly."
|
28
28
|
assert !@c.power?, "GMP::Z should power? correctly."
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
def sqrtrem
|
32
32
|
assert_equal([10, 0], @a.sqrtrem, "GMP::Z should sqrtrem correctly.")
|
33
33
|
assert_equal([ 5, 2], @b.sqrtrem, "GMP::Z should sqrtrem correctly.")
|
34
34
|
assert_equal([ 9, 18], @c.sqrtrem, "GMP::Z should sqrtrem correctly.")
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def sqrt
|
38
38
|
assert_equal(10, @a.sqrt, "GMP::Z should sqrt correctly.")
|
39
39
|
assert_equal( 5, @b.sqrt, "GMP::Z should sqrt correctly.")
|
40
40
|
assert_equal( 9, @c.sqrt, "GMP::Z should sqrt correctly.")
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
def root
|
44
44
|
assert_equal(4, @a.root(3), "GMP::Z should root correctly.")
|
45
45
|
assert_equal(3, @b.root(3), "GMP::Z should root correctly.")
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
2
2
|
|
3
|
-
class
|
3
|
+
class TcIntegerShiftsLastBits < Test::Unit::TestCase
|
4
4
|
def setup
|
5
5
|
@a = GMP::Z.new(100) # 01100100
|
6
|
-
@b
|
6
|
+
@b = -@a # 10011100
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_shifts
|
data/test/tc_z_submul.rb
CHANGED
@@ -4,7 +4,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
|
4
4
|
# Z op (Fixnum,Z), Z op (Fixnum,Fixnum), Z op (Fixnum,Bignum)
|
5
5
|
# Z op (Bignum,Z), Z op (Bignum,Bignum), Z op (Bignum,Fixnum)]
|
6
6
|
# Things are tested both ways because the implementation is asymetrical
|
7
|
-
class
|
7
|
+
class TcIntegerSubmul < Test::Unit::TestCase
|
8
8
|
def setup
|
9
9
|
@_64bit = 1_000_000_000_000.is_a? Fixnum
|
10
10
|
end
|
data/test/tc_z_to_dis.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
2
2
|
|
3
|
-
class
|
3
|
+
class TCZeroDivisionExceptions < Test::Unit::TestCase
|
4
4
|
def setup
|
5
5
|
@a = GMP::Z.new(10)
|
6
6
|
@b = GMP::Z.new()
|
7
7
|
@c = GMP::Q.new(1)
|
8
8
|
@d = GMP::Q.new()
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def test_division_by_zero
|
12
12
|
assert_raise(ZeroDivisionError) { @a.tdiv(0) }
|
13
13
|
assert_raise(ZeroDivisionError) { @a.tdiv(@b) }
|
data/test/unit_tests.rb
CHANGED
@@ -2,37 +2,47 @@
|
|
2
2
|
|
3
3
|
DIR = File.expand_path(File.dirname(__FILE__))
|
4
4
|
|
5
|
+
# miscellaneous tests
|
6
|
+
require File.join(DIR, 'tc_cmp')
|
5
7
|
require File.join(DIR, 'tc_constants')
|
6
8
|
require File.join(DIR, 'tc_division')
|
7
|
-
require File.join(DIR, '
|
9
|
+
require File.join(DIR, 'tc_hashes')
|
10
|
+
require File.join(DIR, 'tc_random')
|
11
|
+
require File.join(DIR, 'tc_sgn_neg_abs')
|
12
|
+
require File.join(DIR, 'tc_swap')
|
13
|
+
require File.join(DIR, 'tc_zero_division_exceptions')
|
14
|
+
|
15
|
+
# float tests
|
16
|
+
require File.join(DIR, 'tc_f_abs_neg')
|
8
17
|
require File.join(DIR, 'tc_f_arithmetics_coersion')
|
18
|
+
require File.join(DIR, 'tc_f_precision')
|
9
19
|
require File.join(DIR, 'tc_f_to_s')
|
20
|
+
|
21
|
+
# integer tests
|
10
22
|
require File.join(DIR, 'tc_z')
|
11
|
-
require File.join(DIR, 'tc_z_basic')
|
12
23
|
require File.join(DIR, 'tc_z_addmul')
|
13
|
-
require File.join(DIR, '
|
14
|
-
require File.join(DIR, 'tc_z_logic')
|
24
|
+
require File.join(DIR, 'tc_z_basic')
|
15
25
|
require File.join(DIR, 'tc_z_exponentiation')
|
16
26
|
require File.join(DIR, 'tc_z_export_import')
|
27
|
+
require File.join(DIR, 'tc_z_fib_fac_nextprime')
|
28
|
+
require File.join(DIR, 'tc_z_functional_mappings')
|
29
|
+
require File.join(DIR, 'tc_z_gcd_lcm_invert')
|
17
30
|
require File.join(DIR, 'tc_z_hamdist')
|
18
31
|
require File.join(DIR, 'tc_z_io')
|
19
|
-
require File.join(DIR, 'tc_z_to_dis')
|
20
|
-
require File.join(DIR, 'tc_z_shifts_last_bits')
|
21
32
|
require File.join(DIR, 'tc_z_jac_leg_rem')
|
22
|
-
require File.join(DIR, '
|
33
|
+
require File.join(DIR, 'tc_z_logic')
|
34
|
+
require File.join(DIR, 'tc_z_logical_roots')
|
35
|
+
require File.join(DIR, 'tc_z_shifts_last_bits')
|
36
|
+
require File.join(DIR, 'tc_z_submul')
|
37
|
+
require File.join(DIR, 'tc_z_to_dis')
|
38
|
+
|
39
|
+
# rational tests
|
23
40
|
require File.join(DIR, 'tc_q')
|
24
41
|
require File.join(DIR, 'tc_q_basic')
|
25
|
-
require File.join(DIR, '
|
26
|
-
require File.join(DIR, '
|
27
|
-
require File.join(DIR, 'tc_sgn_neg_abs')
|
28
|
-
require File.join(DIR, 'tc_fib_fac_nextprime')
|
29
|
-
require File.join(DIR, 'tc_swap')
|
30
|
-
require File.join(DIR, 'tc_floor_ceil_truncate')
|
31
|
-
require File.join(DIR, 'tc_logical_roots')
|
32
|
-
require File.join(DIR, 'tc_random')
|
33
|
-
require File.join(DIR, 'tc_hashes')
|
34
|
-
require File.join(DIR, 'tc_z_functional_mappings')
|
42
|
+
require File.join(DIR, 'tc_q_floor_ceil_truncate')
|
43
|
+
require File.join(DIR, 'tc_q_num_den')
|
35
44
|
|
45
|
+
# gmp suite tests
|
36
46
|
require File.join(DIR, 'gmp_tcong')
|
37
47
|
require File.join(DIR, 'gmp_tgcd')
|
38
48
|
require File.join(DIR, 'gmp_tlcm')
|
@@ -44,15 +54,18 @@ if GMP.const_defined? :MPFR_VERSION
|
|
44
54
|
require File.join(DIR, 'tc_mpfr_constants')
|
45
55
|
require File.join(DIR, 'tc_mpfr_inf_nan_zero')
|
46
56
|
require File.join(DIR, 'tc_mpfr_integer')
|
57
|
+
require File.join(DIR, 'tc_mpfr_pow')
|
47
58
|
require File.join(DIR, 'tc_mpfr_random')
|
48
59
|
require File.join(DIR, 'tc_mpfr_functions')
|
49
60
|
require File.join(DIR, 'tc_mpfr_rounding')
|
50
61
|
require File.join(DIR, 'tc_mpfr_new_rounding')
|
51
62
|
require File.join(DIR, 'mpfr_tcbrt')
|
63
|
+
require File.join(DIR, 'mpfr_tconst_euler')
|
52
64
|
require File.join(DIR, 'mpfr_tfac')
|
53
65
|
if GMP::MPFR_VERSION >= "3.1.0"
|
54
66
|
require File.join(DIR, 'mpfr_tfrexp')
|
55
67
|
end
|
68
|
+
require File.join(DIR, 'mpfr_thypot')
|
56
69
|
require File.join(DIR, 'mpfr_tisnan')
|
57
70
|
require File.join(DIR, 'mpfr_trec_sqrt')
|
58
71
|
require File.join(DIR, 'mpfr_tsqrt')
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.7.19
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Tomasz Wegrzanowski
|
@@ -10,9 +9,9 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2014-03-12 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
15
|
-
description: gmp - providing Ruby bindings to the GMP
|
14
|
+
description: gmp - providing Ruby bindings to the GMP and MPFR libraries.
|
16
15
|
email:
|
17
16
|
- Tomasz.Wegrzanowski@gmail.com
|
18
17
|
- sam.rawlins@gmail.com
|
@@ -45,6 +44,7 @@ files:
|
|
45
44
|
- test/mpfr_tconst_euler.rb
|
46
45
|
- test/mpfr_tfac.rb
|
47
46
|
- test/mpfr_tfrexp.rb
|
47
|
+
- test/mpfr_thypot.rb
|
48
48
|
- test/mpfr_tisnan.rb
|
49
49
|
- test/mpfr_trec_sqrt.rb
|
50
50
|
- test/mpfr_tsqrt.rb
|
@@ -55,20 +55,20 @@ files:
|
|
55
55
|
- test/tc_f_arithmetics_coersion.rb
|
56
56
|
- test/tc_f_precision.rb
|
57
57
|
- test/tc_f_to_s.rb
|
58
|
-
- test/tc_fib_fac_nextprime.rb
|
59
|
-
- test/tc_floor_ceil_truncate.rb
|
60
58
|
- test/tc_hashes.rb
|
61
|
-
- test/tc_logical_roots.rb
|
62
59
|
- test/tc_mpfr_cmp.rb
|
63
60
|
- test/tc_mpfr_constants.rb
|
64
61
|
- test/tc_mpfr_functions.rb
|
65
62
|
- test/tc_mpfr_inf_nan_zero.rb
|
66
63
|
- test/tc_mpfr_integer.rb
|
67
64
|
- test/tc_mpfr_new_rounding.rb
|
65
|
+
- test/tc_mpfr_pow.rb
|
68
66
|
- test/tc_mpfr_random.rb
|
69
67
|
- test/tc_mpfr_rounding.rb
|
70
68
|
- test/tc_q.rb
|
71
69
|
- test/tc_q_basic.rb
|
70
|
+
- test/tc_q_floor_ceil_truncate.rb
|
71
|
+
- test/tc_q_num_den.rb
|
72
72
|
- test/tc_random.rb
|
73
73
|
- test/tc_sgn_neg_abs.rb
|
74
74
|
- test/tc_swap.rb
|
@@ -77,16 +77,18 @@ files:
|
|
77
77
|
- test/tc_z_basic.rb
|
78
78
|
- test/tc_z_exponentiation.rb
|
79
79
|
- test/tc_z_export_import.rb
|
80
|
+
- test/tc_z_fib_fac_nextprime.rb
|
80
81
|
- test/tc_z_functional_mappings.rb
|
81
82
|
- test/tc_z_gcd_lcm_invert.rb
|
82
83
|
- test/tc_z_hamdist.rb
|
83
84
|
- test/tc_z_io.rb
|
84
85
|
- test/tc_z_jac_leg_rem.rb
|
85
86
|
- test/tc_z_logic.rb
|
87
|
+
- test/tc_z_logical_roots.rb
|
86
88
|
- test/tc_z_shifts_last_bits.rb
|
87
89
|
- test/tc_z_submul.rb
|
88
90
|
- test/tc_z_to_dis.rb
|
89
|
-
- test/
|
91
|
+
- test/tc_zero_division_exceptions.rb
|
90
92
|
- test/test-20.rb
|
91
93
|
- test/test-21.rb
|
92
94
|
- test/test-22.rb
|
@@ -102,7 +104,6 @@ files:
|
|
102
104
|
- benchmark/results-5.1.3_0.6.31.ods
|
103
105
|
- CHANGELOG
|
104
106
|
- COPYING.md
|
105
|
-
- INSTALL
|
106
107
|
- README.html
|
107
108
|
- README.markdown
|
108
109
|
- manual.pdf
|
@@ -114,28 +115,27 @@ files:
|
|
114
115
|
homepage: http://github.com/srawlins/gmp
|
115
116
|
licenses:
|
116
117
|
- Apache License Version 2.0
|
118
|
+
metadata: {}
|
117
119
|
post_install_message:
|
118
120
|
rdoc_options: []
|
119
121
|
require_paths:
|
120
122
|
- lib
|
121
123
|
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
124
|
requirements:
|
124
|
-
- -
|
125
|
+
- - '>='
|
125
126
|
- !ruby/object:Gem::Version
|
126
127
|
version: 1.8.6
|
127
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
-
none: false
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - '>='
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
requirements:
|
134
134
|
- GMP compiled and working properly.
|
135
135
|
rubyforge_project:
|
136
|
-
rubygems_version:
|
136
|
+
rubygems_version: 2.0.7
|
137
137
|
signing_key:
|
138
|
-
specification_version:
|
139
|
-
summary: Provides Ruby bindings to the GMP
|
138
|
+
specification_version: 4
|
139
|
+
summary: Provides Ruby bindings to the GMP and MPFR libraries.
|
140
140
|
test_files: []
|
141
141
|
has_rdoc: yard
|
data/INSTALL
DELETED