gmp 0.4.7 → 0.5.3
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 +31 -0
- data/README.rdoc +16 -8
- data/benchmark/multiply +1 -1
- data/benchmark/multiply.gc +57 -0
- data/benchmark/pi +126 -0
- data/benchmark/srb.sh +21 -0
- data/ext/extconf.rb +3 -0
- data/ext/gmp.c +16 -7
- data/ext/gmpbench_timing.c +1 -1
- data/ext/gmpf.c +445 -104
- data/ext/gmpq.c +25 -17
- data/ext/gmpz.c +232 -120
- data/ext/mprnd.c +23 -5
- data/ext/ruby_gmp.h +75 -9
- data/lib/gmp.rb +9 -0
- data/manual.pdf +0 -0
- data/manual.tex +494 -60
- data/test/README +1 -0
- data/test/mpfr_tcbrt.rb +95 -0
- data/test/mpfr_tisnan.rb +70 -0
- data/test/mpfr_trec_sqrt.rb +62 -0
- data/test/mpfr_tsqrt.rb +142 -6
- data/test/tc_cmp.rb +4 -4
- data/test/tc_constants.rb +10 -0
- data/test/tc_division.rb +13 -2
- data/test/tc_f_arithmetics_coersion.rb +2 -2
- data/test/tc_f_precision.rb +4 -3
- data/test/tc_fib_fac_nextprime.rb +2 -2
- data/test/tc_floor_ceil_truncate.rb +2 -2
- data/test/tc_hashes.rb +0 -2
- data/test/tc_logical_roots.rb +1 -3
- data/test/tc_mpfr_constants.rb +11 -0
- data/test/tc_mpfr_functions.rb +22 -9
- data/test/tc_mpfr_random.rb +1 -3
- data/test/tc_mpfr_rounding.rb +10 -7
- data/test/tc_q.rb +1 -3
- data/test/tc_q_basic.rb +3 -5
- data/test/tc_random.rb +1 -3
- data/test/tc_sgn_neg_abs.rb +1 -3
- data/test/tc_swap.rb +1 -3
- data/test/tc_z.rb +3 -3
- data/test/tc_z_addmul.rb +92 -0
- data/test/tc_z_basic.rb +6 -8
- data/test/tc_z_exponentiation.rb +1 -3
- data/test/tc_z_gcd_lcm_invert.rb +1 -3
- data/test/tc_z_jac_leg_rem.rb +1 -3
- data/test/tc_z_logic.rb +2 -2
- data/test/tc_z_shifts_last_bits.rb +2 -2
- data/test/tc_z_to_d_to_i.rb +2 -2
- data/test/test_helper.rb +1 -1
- data/test/test_unit/assertions.rb +31 -0
- data/test/unit_tests.rb +33 -27
- metadata +31 -6
data/test/tc_z_exponentiation.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
1
|
class TC_Z_Exponentiation < Test::Unit::TestCase
|
4
2
|
def setup
|
5
3
|
@a = GMP::Z.new(100)
|
@@ -19,4 +17,4 @@ class TC_Z_Exponentiation < Test::Unit::TestCase
|
|
19
17
|
assert_equal(GMP::Z(0), @a.powmod(@b,256), "(a : GMP::Z).powmod((b : GMP::Z), (c : Fixnum)) should work correctly")
|
20
18
|
assert_equal(GMP::Z(0), @a.powmod(@b,@c), "(a : GMP::Z).powmod((b : GMP::Z), (c : GMP::Z)) should work correctly")
|
21
19
|
end
|
22
|
-
end
|
20
|
+
end
|
data/test/tc_z_gcd_lcm_invert.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
1
|
class TC_Z_GCD_LCM_Invert < Test::Unit::TestCase
|
4
2
|
def setup
|
5
3
|
@a = GMP::Z( 24) # 2^3 * 3
|
@@ -54,4 +52,4 @@ class TC_Z_GCD_LCM_Invert < Test::Unit::TestCase
|
|
54
52
|
assert_equal(GMP::Z( 4), GMP::Z(14).invert(@e), "GMP::Z should invert correctly")
|
55
53
|
assert_equal(GMP::Z( 3), GMP::Z(15).invert(@e), "GMP::Z should invert correctly")
|
56
54
|
end
|
57
|
-
end
|
55
|
+
end
|
data/test/tc_z_jac_leg_rem.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
1
|
class TC_Z_Jacobi_Legendre_Remove < Test::Unit::TestCase
|
4
2
|
def setup
|
5
3
|
@one = GMP::Z(1)
|
@@ -70,4 +68,4 @@ class TC_Z_Jacobi_Legendre_Remove < Test::Unit::TestCase
|
|
70
68
|
assert_equal(1, @forty_five.remove(@five)[1], "GMP::Z should remove(GMP::Z) correctly.")
|
71
69
|
assert_equal(2, @forty_five.remove(@three)[1], "GMP::Z should remove(GMP::Z) correctly.")
|
72
70
|
end
|
73
|
-
end
|
71
|
+
end
|
data/test/tc_z_logic.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'test_helper'
|
1
|
+
require './test_helper'
|
2
2
|
|
3
3
|
class TC_shifts_last_bits < Test::Unit::TestCase
|
4
4
|
def setup
|
@@ -19,4 +19,4 @@ class TC_shifts_last_bits < Test::Unit::TestCase
|
|
19
19
|
#assert_equal(-4, @b.lastbits_sgn(5), "GMP::Z should lastbits_sgn correctly.")
|
20
20
|
# a.tshr 5 ???
|
21
21
|
end
|
22
|
-
end
|
22
|
+
end
|
data/test/tc_z_to_d_to_i.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'test_helper'
|
1
|
+
require './test_helper'
|
2
2
|
|
3
3
|
class TC_to_i_to_d < Test::Unit::TestCase
|
4
4
|
def setup
|
@@ -21,4 +21,4 @@ class TC_to_i_to_d < Test::Unit::TestCase
|
|
21
21
|
#assert_equal(@b.to_d.class, Float, "GMP::Z.to_d should be a Float.")
|
22
22
|
assert_equal(@c.to_d.class, Float, "GMP::Q.to_d should be a Float.")
|
23
23
|
end
|
24
|
-
end
|
24
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
module Test::Unit::Assertions
|
2
|
+
def assert_less_than(expected, actual, message=nil)
|
3
|
+
assert_true(actual < expected, message)
|
4
|
+
end
|
5
|
+
alias :assert_lt :assert_less_than
|
6
|
+
|
7
|
+
def assert_lte(expected, actual, message=nil)
|
8
|
+
assert_true(actual <= expected, message)
|
9
|
+
end
|
10
|
+
|
11
|
+
def assert_greater_than(expected, actual, message=nil)
|
12
|
+
assert_true(actual > expected, message)
|
13
|
+
end
|
14
|
+
alias :assert_gt :assert_greater_than
|
15
|
+
|
16
|
+
def assert_gte(expected, actual, message=nil)
|
17
|
+
assert_true(actual >= expected, message)
|
18
|
+
end
|
19
|
+
|
20
|
+
def assert_between(expected_low, expected_high, actual, message=nil)
|
21
|
+
assert_true(actual <= expected_high && actual >= expected_low, message)
|
22
|
+
end
|
23
|
+
|
24
|
+
def assert_true(actual, message=nil)
|
25
|
+
assert(actual, message)
|
26
|
+
end
|
27
|
+
|
28
|
+
def assert_false(actual, message=nil)
|
29
|
+
assert(!actual, message)
|
30
|
+
end
|
31
|
+
end
|
data/test/unit_tests.rb
CHANGED
@@ -1,36 +1,42 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'test_helper'
|
3
|
+
require './test_helper'
|
4
4
|
|
5
|
-
require '
|
6
|
-
require '
|
7
|
-
require '
|
8
|
-
require '
|
9
|
-
require '
|
10
|
-
require '
|
11
|
-
require '
|
12
|
-
require '
|
13
|
-
require '
|
14
|
-
require '
|
15
|
-
require '
|
16
|
-
require '
|
17
|
-
require '
|
18
|
-
require '
|
19
|
-
require '
|
20
|
-
require '
|
21
|
-
require '
|
22
|
-
require '
|
23
|
-
require '
|
24
|
-
require '
|
25
|
-
require '
|
26
|
-
require '
|
5
|
+
require './tc_constants'
|
6
|
+
require './tc_z'
|
7
|
+
require './tc_z_basic'
|
8
|
+
require './tc_z_addmul'
|
9
|
+
require './tc_z_logic'
|
10
|
+
require './tc_q'
|
11
|
+
require './tc_cmp'
|
12
|
+
require './tc_q_basic'
|
13
|
+
require './tc_z_exponentiation'
|
14
|
+
require './tc_zerodivisionexceptions'
|
15
|
+
require './tc_sgn_neg_abs'
|
16
|
+
require './tc_fib_fac_nextprime'
|
17
|
+
require './tc_swap'
|
18
|
+
require './tc_floor_ceil_truncate'
|
19
|
+
require './tc_z_to_d_to_i'
|
20
|
+
require './tc_z_shifts_last_bits'
|
21
|
+
require './tc_logical_roots'
|
22
|
+
require './tc_f_precision'
|
23
|
+
require './tc_f_arithmetics_coersion'
|
24
|
+
require './tc_division'
|
25
|
+
require './tc_z_jac_leg_rem'
|
26
|
+
require './tc_z_gcd_lcm_invert'
|
27
|
+
require './tc_random'
|
28
|
+
require './tc_hashes'
|
27
29
|
|
28
30
|
begin
|
29
31
|
GMP::MPFR_VERSION
|
30
|
-
require '
|
31
|
-
require '
|
32
|
-
require '
|
33
|
-
require '
|
32
|
+
require './tc_mpfr_constants'
|
33
|
+
require './tc_mpfr_random'
|
34
|
+
require './tc_mpfr_functions'
|
35
|
+
require './tc_mpfr_rounding'
|
36
|
+
require './mpfr_tcbrt'
|
37
|
+
require './mpfr_tisnan'
|
38
|
+
require './mpfr_trec_sqrt'
|
39
|
+
require './mpfr_tsqrt'
|
34
40
|
rescue
|
35
41
|
|
36
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 13
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 5
|
9
|
+
- 3
|
10
|
+
version: 0.5.3
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Tomasz Wegrzanowski
|
@@ -10,7 +16,7 @@ autorequire:
|
|
10
16
|
bindir: bin
|
11
17
|
cert_chain: []
|
12
18
|
|
13
|
-
date: 2010-
|
19
|
+
date: 2010-09-20 00:00:00 -07:00
|
14
20
|
default_executable:
|
15
21
|
dependencies: []
|
16
22
|
|
@@ -39,8 +45,13 @@ files:
|
|
39
45
|
- ext/ruby_gmp.h
|
40
46
|
- ext/takeover.h
|
41
47
|
- ext/extconf.rb
|
48
|
+
- lib/gmp.rb
|
49
|
+
- test/mpfr_tcbrt.rb
|
50
|
+
- test/mpfr_tisnan.rb
|
51
|
+
- test/mpfr_trec_sqrt.rb
|
42
52
|
- test/mpfr_tsqrt.rb
|
43
53
|
- test/tc_cmp.rb
|
54
|
+
- test/tc_constants.rb
|
44
55
|
- test/tc_division.rb
|
45
56
|
- test/tc_fib_fac_nextprime.rb
|
46
57
|
- test/tc_floor_ceil_truncate.rb
|
@@ -48,6 +59,7 @@ files:
|
|
48
59
|
- test/tc_f_precision.rb
|
49
60
|
- test/tc_hashes.rb
|
50
61
|
- test/tc_logical_roots.rb
|
62
|
+
- test/tc_mpfr_constants.rb
|
51
63
|
- test/tc_mpfr_functions.rb
|
52
64
|
- test/tc_mpfr_random.rb
|
53
65
|
- test/tc_mpfr_rounding.rb
|
@@ -58,6 +70,7 @@ files:
|
|
58
70
|
- test/tc_swap.rb
|
59
71
|
- test/tc_z.rb
|
60
72
|
- test/tc_zerodivisionexceptions.rb
|
73
|
+
- test/tc_z_addmul.rb
|
61
74
|
- test/tc_z_basic.rb
|
62
75
|
- test/tc_z_exponentiation.rb
|
63
76
|
- test/tc_z_gcd_lcm_invert.rb
|
@@ -74,15 +87,19 @@ files:
|
|
74
87
|
- test/test_helper.rb
|
75
88
|
- test/unit_tests.rb
|
76
89
|
- test/README
|
90
|
+
- test/test_unit/assertions.rb
|
77
91
|
- benchmark/COPYING
|
78
92
|
- benchmark/divide
|
79
93
|
- benchmark/gcd
|
80
94
|
- benchmark/gexpr
|
81
95
|
- benchmark/gexpr.c
|
82
96
|
- benchmark/multiply
|
97
|
+
- benchmark/multiply.gc
|
98
|
+
- benchmark/pi
|
83
99
|
- benchmark/README
|
84
100
|
- benchmark/rsa
|
85
101
|
- benchmark/runbench
|
102
|
+
- benchmark/srb.sh
|
86
103
|
- benchmark/version
|
87
104
|
- CHANGELOG
|
88
105
|
- INSTALL
|
@@ -99,21 +116,29 @@ rdoc_options: []
|
|
99
116
|
require_paths:
|
100
117
|
- lib
|
101
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
102
120
|
requirements:
|
103
121
|
- - ">="
|
104
122
|
- !ruby/object:Gem::Version
|
105
|
-
|
106
|
-
|
123
|
+
hash: 59
|
124
|
+
segments:
|
125
|
+
- 1
|
126
|
+
- 8
|
127
|
+
- 6
|
128
|
+
version: 1.8.6
|
107
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
108
131
|
requirements:
|
109
132
|
- - ">="
|
110
133
|
- !ruby/object:Gem::Version
|
134
|
+
hash: 3
|
135
|
+
segments:
|
136
|
+
- 0
|
111
137
|
version: "0"
|
112
|
-
version:
|
113
138
|
requirements:
|
114
139
|
- GMP compiled and working properly.
|
115
140
|
rubyforge_project:
|
116
|
-
rubygems_version: 1.3.
|
141
|
+
rubygems_version: 1.3.7
|
117
142
|
signing_key:
|
118
143
|
specification_version: 3
|
119
144
|
summary: Provides Ruby bindings to the GMP library.
|