gmp 0.5.3 → 0.5.23

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,7 +1,26 @@
1
+ 0.5.23:
2
+ * Added MPFR method GMP::F.can_round? (mpfr_can_round), not tested.
3
+ * MPFR const_ functions now accept an optional rounding mode and precision.
4
+ * Added GMP method GMP::RandState.rrandomb (mpz_rrandomb)
5
+ * Added GMP constant GMP_NUMB_MAX
6
+ * Added GMP method GMP::Z.gcdext.
7
+ * GMP::Z.gcd and GMP::Z.gcdext are now heavily tested via GMP's tests.
8
+ * Added MPFR methods GMP::F.sin[h]_cos[h] (mpfr_sin[h]_cos[h]), not tested.
9
+ * Added MPFR methods GMP::F.atan2, .agm, and .hypot, not tested.
10
+ * Seriously improved RDoc/YARD documentation.
11
+ I didn't know rubygems.org auto-yardocs my stuff!
12
+ * Added GMP method GMP::Z#submul! (mpz_submul) with tests.
13
+ * Added GMP method GMP::Z#divisible? (mpz_divisible[_ui]_p) with tests.
14
+ * Preliminary testing with REE on Linux... probably supported next release.
15
+ * Unit test results: 109 tests, 16144 assertions, 0 failures, 0 errors
16
+ * Unit test results: 109 tests, 16131 assertions, 0 failures, 0 errors (MPFR 2.4.2)
17
+ * Unit test results: 90 tests, 4866 assertions, 0 failures, 0 errors (w/o MPFR)
18
+
1
19
  0.5.3:
2
20
  * Now supporting GMP 5.0.1 (I now test with GMP 4.3.2 and 5.0.1).
3
21
  * Now supporting MPFR 3.0.0 (I now test with MPFR 2.4.2 and 3.0.0).
4
22
  * Now supporting Ruby 1.9.2. A few changes had to be made.
23
+ * Now supporting 64-bit (mostly Linux right now).
5
24
  * Added MPFR method GMP::F.zero? (mpfr_zero_p) with tests.
6
25
  * Added MPFR method GMP::F.regular? (mpfr_regular_p) with tests (MPFR 3.0.0
7
26
  only).
@@ -0,0 +1,393 @@
1
+ <!--A table to show wtf I have completed, etc. For every function that I try to port, there are several tasks to check off. This is that.-->
2
+
3
+ <html>
4
+ <head>
5
+ <script type="text/javascript" src="http://extjs-public.googlecode.com/svn/tags/extjs-3.2.1/release/adapter/ext/ext-base.js"></script>
6
+ <script type="text/javascript" src="http://extjs-public.googlecode.com/svn/tags/extjs-3.2.1/release/ext-all.js"></script>
7
+ <link rel="stylesheet" href="http://extjs-public.googlecode.com/svn/tags/extjs-3.2.1/release/resources/css/ext-all.css"></script>
8
+ <style>
9
+ body {
10
+ padding: 32px;
11
+ }
12
+
13
+ .x-grid3-row-unimplemented {
14
+ background-color: #FAB;
15
+ }
16
+
17
+ #mpz-grid {
18
+ margin-bottom: 32px;
19
+ }
20
+
21
+ #mpq-grid {
22
+ margin-bottom: 32px;
23
+ }
24
+
25
+ #mpf-grid {
26
+ margin-bottom: 32px;
27
+ }
28
+ </style>
29
+ <script>
30
+ /*!
31
+ * Ext JS Library 3.2.1
32
+ * Copyright(c) 2006-2010 Ext JS, Inc.
33
+ * licensing@extjs.com
34
+ * http://www.extjs.com/license
35
+ */
36
+ Ext.onReady(function(){
37
+
38
+ // NOTE: This is an example showing simple state management. During development,
39
+ // it is generally best to disable state management as dynamically-generated ids
40
+ // can change across page loads, leading to unpredictable results. The developer
41
+ // should ensure that stable state ids are set for stateful components in real apps.
42
+ Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
43
+
44
+ var mpzData = [
45
+ /* method, function, manual, yard, testB, testO */
46
+ ['GMP::Z.new', "mpz_init", "yes","yes","yes", "no"],
47
+ ['GMP::Z#swap', "mpz_swap", "","yes","yes", "no"],
48
+ ['GMP::Z#to_i', "mpz_get_si", "yes","yes","yes", "no"],
49
+ ['GMP::Z#to_d', "mpz_get_d", "yes","yes","yes", "no"],
50
+ ['', "mpz_get_d_2exp", "no", "no", "no", "no"],
51
+ ['GMP::Z#to_s', "mpz_get_str", "yes","yes","yes", "no"],
52
+ ['GMP::Z#+<br />GMP::Z#add!', "mpz_add<br />mpz_add_ui<br />mpz_sub_ui", "yes","yes","yes", "no"],
53
+ ['GMP::Z#-<br />GMP::Z#sub!', "mpz_sub<br />mpz_sub_ui<br />mpz_add_ui", "yes","yes","yes", "no"],
54
+ ['GMP::Z#*', "mpz_mul<br />mpz_mul_si", "yes","yes","yes", "no"],
55
+ ['GMP::Z#addmul!', "mpz_addmul<br />mpz_addmul_ui", "yes","yes","yes", "no"],
56
+ ['GMP::Z#submul!', "mpz_submul<br />mpz_submul_ui", "no","yes","yes", "no"],
57
+ ['GMP::Z#<<', "mpz_mul_2exp", "yes","yes", "", "no"],
58
+ ['GMP::Z#-@<br />' +
59
+ 'GMP::Z#neg<br />GMP::Z#neg!', "mpz_neg", "yes","yes", "", "no"],
60
+ ['GMP::Z#abs<br />GMP::Z#abs!', "mpz_abs", "yes","yes", "", "no"],
61
+ ['GMP::Z#/', "mpz_divexact<br />...", "no","yes","yes", "no"],
62
+ ['GMP::Z#tdiv', "mpz_tdiv_q", "yes","yes","yes", "no"],
63
+ ['GMP::Z#tmod', "mpz_tdiv_r", "yes","yes","yes", "no"],
64
+ ['GMP::Z#tdivmod', "mpz_tdiv_qr", "no", "no", "no", "no"],
65
+ ['GMP::Z#tshr', "mpz_tdiv_q_2exp", "","yes", "no", "no"],
66
+ ['GMP::Z#tshrm', "mpz_tdiv_r_2exp", "", "no", "no", "no"],
67
+ ['GMP::Z#fdiv', "mpz_fdiv_q", "yes","yes","yes", "no"],
68
+ ['GMP::Z#fmod', "mpz_fdiv_r", "yes","yes","yes", "no"],
69
+ ['GMP::Z#fdivmod', "mpz_fdiv_rq", "no", "no", "no", "no"],
70
+ ['GMP::Z#fshr', "mpz_fdiv_q_2exp", "", "no", "no", "no"],
71
+ ['GMP::Z#fshrm', "mpz_fdiv_r_2exp", "", "no", "no", "no"],
72
+ ['GMP::Z#cdiv', "mpz_cdiv_q", "yes","yes","yes", "no"],
73
+ ['GMP::Z#cmod', "mpz_cdiv_r", "yes","yes","yes", "no"],
74
+ ['GMP::Z#cdivmod', "mpz_cdiv_qr", "no", "no", "no", "no"],
75
+ ['', "mpz_cdiv_q_2exp", "no", "no", "no", "no"],
76
+ ['', "mpz_cdiv_r_2exp", "no", "no", "no", "no"],
77
+ ['GMP::Z#%', "mpz_mod<br />mpz_mod_ui", "yes","yes", "", "no"],
78
+ ['GMP::Z#divisible?', "mpz_divisible_p<br />mpz_divisible_ui_p", "no","yes","yes", "no"],
79
+ ['', "mpz_divisible_2exp_p", "no", "no", "no", "no"],
80
+ ['', "mpz_congruent_p<br />mpz_congruent_ui_p", "no", "no", "no", "no"],
81
+ ['', "mpz_congruent_2exp_p", "no", "no", "no", "no"],
82
+ ['GMP::Z#**<br />GMP::Z.pow', "mpz_pow_ui", "yes","yes", "", "no"],
83
+ ['GMP::Z#powmod', "mpz_powm<br />mpz_powm_ui", "yes","yes", "", "no"],
84
+ ['GMP::Z#root', "mpz_root", "yes","yes", "", "no"],
85
+ ['', "mpz_rootrem", "no", "no", "no", "no"],
86
+ ['GMP::Z#sqrt<br />GMP::Z#sqrt!', "mpz_sqrt", "yes","yes", "", "no"],
87
+ ['GMP::Z#sqrtrem', "mpz_sqrtrem", "yes","yes", "", "no"],
88
+ ['GMP::Z#power?', "mpz_perfect_power_p", "yes","yes", "", "no"],
89
+ ['GMP::Z#square?', "mpz_perfect_square_p", "yes","yes", "", "no"],
90
+ ['GMP::Z#probab_prime?', "mpz_probab_prime_p", "yes","yes", "", "no"],
91
+ ['GMP::Z#next_prime<br />' +
92
+ 'GMP::Z#next_prime!', "mpz_nextprime", "yes","yes", "", "no"],
93
+ ['GMP::Z#gcd', "mpz_gcd<br />mpz_gcd_ui", "yes","yes", "", "no"],
94
+ ['GMP::Z#gcdext', "mpz_gcdext", "no","yes", "", "no"],
95
+ ['', "mpz_lcm<br />mpz_lcm_ui", "no", "no", "no", "no"],
96
+ ['GMP::Z#invert', "mpz_invert", "yes","yes", "", "no"],
97
+ ['GMP::Z#jacobi<br />GMP::Z.jacobi',"mpz_jacobi", "yes","yes", "", "no"],
98
+ ['GMP::Z#legendre', "mpz_legendre", "yes","yes", "", "no"],
99
+ ['', "mpz_kronecker<br />mpz_kronecker_si<br />" +
100
+ "mpz_kronecker_ui<br />mpz_si_kronecker" +
101
+ "<br />mpz_ui_kronecker", "yes","yes", "", "no"],
102
+ ['GMP::Z#remove', "mpz_remove", "yes","yes", "", "no"],
103
+ ['GMP::Z.fac', "mpz_fac_ui", "yes","yes", "", "no"],
104
+ ['', "mpz_bin_ui<br />mpz_bin_uiui", "no", "no", "no", "no"],
105
+ ['GMP::Z.fib', "mpz_fib_ui", "yes","yes", "", "no"],
106
+ ['', "mpz_fib2_ui", "no", "no", "no", "no"],
107
+ ['', "mpz_lucnum_ui", "no", "no", "no", "no"],
108
+ ['', "mpz_lucnum2_ui", "no", "no", "no", "no"],
109
+ ['GMP::Z#==<br />GMP::Z#<=><br />' +
110
+ 'GMP::Z#&lt;<br />GMP::Z#&lt;=<br />' +
111
+ 'GMP::Z#&gt;<br />GMP::Z#&gt;=', "mpz_cmp<br />mpz_cmp_si<br />mpz_cmp_ui", "yes","yes", "", "no"],
112
+ ['GMP::Z#cmpabs', "mpz_cmpabs", "yes","yes", "", "no"],
113
+ ['GMP::Z#sgn', "mpz_sgn", "yes","yes", "", "no"],
114
+ ['GMP::Z#eql?', "mpz_get_str", "no","yes", "","n/a"],
115
+ ['GMP::Z#hash', "mpz_get_str", "no","yes", "","n/a"],
116
+ ['GMP::Z#&', "mpz_and", "yes","yes", "", "no"],
117
+ ['GMP::Z#|', "mpz_ior", "yes","yes", "", "no"],
118
+ ['GMP::Z#^', "mpz_xor", "yes","yes", "", "no"],
119
+ ['GMP::Z#com<br />GMP::Z#com!', "mpz_com", "yes","yes", "", "no"],
120
+ ['GMP::Z#popcount', "mpz_popcount", "yes","yes", "", "no"],
121
+ ['', "mpz_hamdist", "no", "no", "no", "no"],
122
+ ['GMP::Z#scan0', "mpz_scan0", "yes","yes", "", "no"],
123
+ ['GMP::Z#scan1', "mpz_scan1", "yes","yes", "", "no"],
124
+ ['GMP::Z#[]=', "mpz_setbit<br />mpz_clrbit", "yes","yes", "", "no"],
125
+ ['', "mpz_combit", "no", "no", "no", "no"],
126
+ ['GMP::Z#[]', "mpz_tstbit", "yes","yes", "", "no"],
127
+ ['', "mpz_fits_ulong_p", "no", "no", "no", "no"],
128
+ ['', "mpz_fits_slong_p", "no", "no", "no", "no"],
129
+ ['', "mpz_fits_uint_p", "no", "no", "no", "no"],
130
+ ['', "mpz_fits_sint_p", "no", "no", "no", "no"],
131
+ ['', "mpz_fits_ushort_p", "no", "no", "no", "no"],
132
+ ['', "mpz_fits_sshort_p", "no", "no", "no", "no"],
133
+ ['GMP::Z#even?', "mpz_even_p", "yes","yes", "", "no"],
134
+ ['GMP::Z#odd?', "mpz_odd_p", "yes","yes", "", "no"],
135
+ ['GMP::Z#sizeinbase<br />' +
136
+ 'GMP::Z#size_in_base', "mpz_sizeinbase", "yes","yes", "", "no"],
137
+ ['GMP::Z#size_in_bin', "mpz_sizeinbase", "yes","yes", "", "no"],
138
+ ['GMP::Z#size', "mpz_size", "yes","yes", "", "no"]
139
+ ];
140
+
141
+ var mpqData = [
142
+ /* method, function, manual, yard, testB, testO */
143
+ ['GMP::Q.new', "mpq_init", "","yes","yes", "no"],
144
+ ['GMP::Q#swap', "mpq_swap", "","yes", "", "no"],
145
+ ['GMP::Q#to_d', "mpq_get_d", "yes","yes", "", "no"],
146
+ ['GMP::Q#to_s', "mpq_get_str", "yes","yes","yes", "no"],
147
+ ['GMP::Q#+', "mpq_add", "no","yes", "", "no"],
148
+ ['GMP::Q#-', "mpq_sub", "no","yes", "", "no"],
149
+ ['GMP::Q#*', "mpq_mul", "no","yes", "", "no"],
150
+ ['', "mpq_mul_2exp", "no", "no", "no", "no"],
151
+ ['GMP::Q#/', "mpq_div", "no","yes", "", "no"],
152
+ ['', "mpq_div_2exp", "no", "no", "no", "no"],
153
+ ['GMP::Q#-@<br />' +
154
+ 'GMP::Q#neg<br />GMP::Q#neg!', "mpq_neg", "no","yes","yes", "no"],
155
+ ['GMP::Q#abs<br />GMP::Q#abs!', "mpq_abs", "no","yes","yes", "no"],
156
+ ['GMP::Q#inv<br />GMP::Q#inv!', "mpq_inv", "no","yes","yes", "no"],
157
+ ['GMP::Q#==<br />GMP::Q#<=><br />' +
158
+ 'GMP::Q#&lt;<br />GMP::Q#&lt;=<br />' +
159
+ 'GMP::Q#&gt;<br />GMP::Q#&gt;=', "mpq_cmp<br />mpq_cmp_si<br />mpq_cmp_ui", "no", "no", "", "no"],
160
+ ['GMP::Q#cmpabs', "mpq_cmpabs", "no", "no", "", "no"],
161
+ ['GMP::Q#sgn', "mpq_sgn", "no","yes", "", "no"],
162
+ ['GMP::Q#num', "mpq_get_num", "no", "no", "no", "no"],
163
+ ['GMP::Q#den', "mpq_get_den", "no", "no", "no", "no"],
164
+ ['', "mpq_set_num", "no", "no", "no", "no"],
165
+ ['', "mpq_set_den", "no", "no", "no", "no"]
166
+ ];
167
+
168
+ var mpfData = [
169
+ /* method, function, manual, yard, testB, testO */
170
+ ['GMP::F.new', "mpq_init", "no", "","yes", "no"],
171
+ ['', "mpf_swap", "no", "no", "no", "no"],
172
+ ['GMP::F#to_d', "mpf_get_d", "no","yes", "", "no"],
173
+ ['GMP::F#to_s', "mpf_get_str", "no","yes", "", "no"],
174
+ ['GMP::F#+', "mpf_add", "no","yes", "", "no"],
175
+ ['GMP::F#-', "mpf_sub", "no","yes", "", "no"],
176
+ ['GMP::F#*', "mpf_mul", "no","yes", "", "no"],
177
+ ['GMP::F#/', "mpf_div", "no","yes", "", "no"],
178
+ ['GMP::F#-@<br />' +
179
+ 'GMP::F#neg<br />GMP::F#neg!', "mpf_neg", "no","yes", "", "no"],
180
+ ['GMP::F#abs<br />GMP::F#abs!', "mpf_abs", "no","yes", "", "no"],
181
+ ['GMP::F#==<br />GMP::F#<=><br />' +
182
+ 'GMP::F#&lt;<br />GMP::F#&lt;=<br />' +
183
+ 'GMP::F#&gt;<br />GMP::F#&gt;=', "mpf_cmp<br />mpf_cmp_si<br />mpf_cmp_ui", "no", "no", "", "no"],
184
+ ['', "mpf_reldiff", "no", "no", "no", "no"],
185
+ ['GMP::F#sgn', "mpf_sgn", "no","yes", "", "no"],
186
+ ['GMP::F#ceil', "mpf_ceil", "no","yes", "", "no"],
187
+ ['GMP::F#floor', "mpf_floor", "no","yes", "", "no"],
188
+ ['GMP::F#trunc', "mpf_trunc", "no","yes", "", "no"],
189
+ ['', "mpf_fits_ulong_p", "no", "no", "no", "no"],
190
+ ['', "mpf_fits_slong_p", "no", "no", "no", "no"],
191
+ ['', "mpf_fits_uint_p", "no", "no", "no", "no"],
192
+ ['', "mpf_fits_sint_p", "no", "no", "no", "no"],
193
+ ['', "mpf_fits_ushort_p", "no", "no", "no", "no"],
194
+ ['', "mpf_fits_sshort_p", "no", "no", "no", "no"]
195
+ ];
196
+
197
+ /**
198
+ * Custom function used for column renderer
199
+ * @param {Object} val
200
+ */
201
+ function change(val){
202
+ if(val > 0){
203
+ return '<span style="color:green;">' + val + '</span>';
204
+ }else if(val < 0){
205
+ return '<span style="color:red;">' + val + '</span>';
206
+ }
207
+ return val;
208
+ }
209
+
210
+ /**
211
+ * Custom function used for column renderer
212
+ * @param {Object} val
213
+ */
214
+ function pctChange(val){
215
+ if(val > 0){
216
+ return '<span style="color:green;">' + val + '%</span>';
217
+ }else if(val < 0){
218
+ return '<span style="color:red;">' + val + '%</span>';
219
+ }
220
+ return val;
221
+ }
222
+
223
+ /**
224
+ * Custom function used for column renderer
225
+ * @param {Object} val
226
+ */
227
+ function shouldExist(val){
228
+ if(val == ''){
229
+ return '<span style="background-color:#FFCCCC;">&nbsp;<i>missing</i>&nbsp;</span>';
230
+ }
231
+ return val;
232
+ }
233
+
234
+ /**
235
+ * Custom function used for column renderer
236
+ * @param {Object} val
237
+ */
238
+ function shouldYes(val){
239
+ if(val == ''){
240
+ return '<span style="background-color:#FFCCCC;">&nbsp;<i>missing</i>&nbsp;</span>';
241
+ }else if(typeof val != "string"){
242
+ return val;
243
+ } else if(val.match(/no/i)){
244
+ return '<span style="color:red;">' + val + '</span>';
245
+ } else if(val.match(/yes/i)){
246
+ return '<span style="color:green;">' + val + '</span>';
247
+ } else if(val.match(/n\/a/i)){
248
+ return '<span style="color:#AAAAAA;">' + val + '</span>';
249
+ }
250
+ return val;
251
+ }
252
+
253
+ // create the MPZ data store
254
+ var mpzStore = new Ext.data.ArrayStore({
255
+ fields: [
256
+ {name: 'method'},
257
+ {name: 'function'},
258
+ {name: 'manual'},
259
+ {name: 'yard'},
260
+ {name: 'testBasic'},
261
+ {name: 'testOriginal'}
262
+ ]
263
+ });
264
+
265
+ // create the MPQ data store
266
+ var mpqStore = new Ext.data.ArrayStore({
267
+ fields: [
268
+ {name: 'method'},
269
+ {name: 'function'},
270
+ {name: 'manual'},
271
+ {name: 'yard'},
272
+ {name: 'testBasic'},
273
+ {name: 'testOriginal'}
274
+ ]
275
+ });
276
+
277
+ // create the MPQ data store
278
+ var mpfStore = new Ext.data.ArrayStore({
279
+ fields: [
280
+ {name: 'method'},
281
+ {name: 'function'},
282
+ {name: 'manual'},
283
+ {name: 'yard'},
284
+ {name: 'testBasic'},
285
+ {name: 'testOriginal'}
286
+ ]
287
+ });
288
+
289
+ // manually load local data
290
+ mpzStore.loadData(mpzData);
291
+ mpqStore.loadData(mpqData);
292
+ mpfStore.loadData(mpfData);
293
+
294
+ // create the MPZ Grid
295
+ var mpzGrid = new Ext.grid.GridPanel({
296
+ store: mpzStore,
297
+ columns: [
298
+ {id:'method',header: 'Ruby method', width: 140, sortable: true, dataIndex: 'method'},
299
+ {header: 'C function', width: 130, sortable: true, renderer: shouldExist, dataIndex: 'function'},
300
+ {header: "Doc'd in manual.pdf?", width: 140, sortable: true, renderer: shouldYes, dataIndex: 'manual'},
301
+ {header: "Doc'd in YARD?", width: 100, sortable: true, renderer: shouldYes, dataIndex: 'yard'},
302
+ {header: 'Basic Tests?', width: 100, sortable: true, renderer: shouldYes, dataIndex: 'testBasic'},
303
+ {header: 'Original Tests?', width: 100, sortable: true, renderer: shouldYes, dataIndex: 'testOriginal'}
304
+ ],
305
+ stripeRows: true,
306
+ autoExpandColumn: 'method',
307
+ height: 260,
308
+ width: 820,
309
+ title: 'GMP::Z',
310
+ // config options for stateful behavior
311
+ stateful: true,
312
+ stateId: 'grid',
313
+ viewConfig: {
314
+ getRowClass: function(record, rowIndex, rp, ds){
315
+ if(record.data.method == ""){
316
+ return 'x-grid3-row-unimplemented';
317
+ }
318
+ return 'x-grid3-row';
319
+ }
320
+ }
321
+ });
322
+
323
+ // create the MPZ Grid
324
+ var mpqGrid = new Ext.grid.GridPanel({
325
+ store: mpqStore,
326
+ columns: [
327
+ {id:'method',header: 'Ruby method', width: 140, sortable: true, dataIndex: 'method'},
328
+ {header: 'C function', width: 130, sortable: true, renderer: shouldExist, dataIndex: 'function'},
329
+ {header: "Doc'd in manual.pdf?", width: 140, sortable: true, renderer: shouldYes, dataIndex: 'manual'},
330
+ {header: "Doc'd in YARD?", width: 100, sortable: true, renderer: shouldYes, dataIndex: 'yard'},
331
+ {header: 'Basic Tests?', width: 100, sortable: true, renderer: shouldYes, dataIndex: 'testBasic'},
332
+ {header: 'Original Tests?', width: 100, sortable: true, renderer: shouldYes, dataIndex: 'testOriginal'}
333
+ ],
334
+ stripeRows: true,
335
+ autoExpandColumn: 'method',
336
+ height: 260,
337
+ width: 820,
338
+ title: 'GMP::Q',
339
+ // config options for stateful behavior
340
+ stateful: true,
341
+ stateId: 'grid',
342
+ viewConfig: {
343
+ getRowClass: function(record, rowIndex, rp, ds){
344
+ if(record.data.method == ""){
345
+ return 'x-grid3-row-unimplemented';
346
+ }
347
+ return 'x-grid3-row';
348
+ }
349
+ }
350
+ });
351
+
352
+ // create the MPZ Grid
353
+ var mpfGrid = new Ext.grid.GridPanel({
354
+ store: mpfStore,
355
+ columns: [
356
+ {id:'method',header: 'Ruby method', width: 140, sortable: true, dataIndex: 'method'},
357
+ {header: 'C function', width: 130, sortable: true, renderer: shouldExist, dataIndex: 'function'},
358
+ {header: "Doc'd in manual.pdf?", width: 140, sortable: true, renderer: shouldYes, dataIndex: 'manual'},
359
+ {header: "Doc'd in YARD?", width: 100, sortable: true, renderer: shouldYes, dataIndex: 'yard'},
360
+ {header: 'Basic Tests?', width: 100, sortable: true, renderer: shouldYes, dataIndex: 'testBasic'},
361
+ {header: 'Original Tests?', width: 100, sortable: true, renderer: shouldYes, dataIndex: 'testOriginal'}
362
+ ],
363
+ stripeRows: true,
364
+ autoExpandColumn: 'method',
365
+ height: 260,
366
+ width: 820,
367
+ title: 'GMP::F',
368
+ // config options for stateful behavior
369
+ stateful: true,
370
+ stateId: 'grid',
371
+ viewConfig: {
372
+ getRowClass: function(record, rowIndex, rp, ds){
373
+ if(record.data.method == ""){
374
+ return 'x-grid3-row-unimplemented';
375
+ }
376
+ return 'x-grid3-row';
377
+ }
378
+ }
379
+ });
380
+
381
+ // render the grid to the specified div in the page
382
+ mpzGrid.render('mpz-grid');
383
+ mpqGrid.render('mpq-grid');
384
+ mpfGrid.render('mpf-grid');
385
+ });
386
+ </script>
387
+ </head>
388
+ <body>
389
+ <div id="mpz-grid"></div>
390
+ <div id='mpq-grid'></div>
391
+ <div id='mpf-grid'></div>
392
+ </body>
393
+ </html>
@@ -47,25 +47,44 @@ paragraph at http://gmplib.org/#WHAT :
47
47
  contributors to sign paperwork where they allow us to distribute their work."
48
48
 
49
49
  Only GMP 4 or newer is supported. The following environments have been tested
50
- by me: gmp gem 0.4.0 on:
51
- +-------------------------------------+-------------------+-----------+
52
- | Platform | Ruby | GMP |
53
- +-------------------------------------+-------------------+-----------+
54
- | Cygwin 1.7 on x86 | (MRI) Ruby 1.8.7 | GMP 4.3.1 |
55
- | | | GMP 4.3.2 |
56
- | | | GMP 5.0.0 |
57
- |-------------------------------------+-------------------+-----------|
58
- | Windows XP on x86 | (MRI) Ruby 1.9.1 | GMP 5.0.1 |
59
- |-------------------------------------+-------------------+-----------|
60
- | Linux (LinuxMint 7) on x86 (32-bit) | (MRI) Ruby 1.8.7 | GMP 4.3.1 |
61
- |-------------------------------------+-------------------+-----------|
62
- | Mac OS X 10.5.7 on x86 (32-bit) | (MRI) Ruby 1.8.6 | GMP 4.3.1 |
63
- | | (MRI) Ruby 1.9.1 | |
64
- +-------------------------------------+-------------------+-----------+
65
-
66
- <b>Note:</b> To get this running on Mac OS X (32-bit), I compiled GMP 4.3.1
67
- with:
68
- ./configure ABI=32 --disable-dependency-tracking
50
+ by me: gmp gem 0.5.23 on:
51
+ +-----------------------------------------+------------------+-------------------+
52
+ | Platform | Ruby | GMP (MPFR) |
53
+ +-----------------------------------------+------------------+-------------------+
54
+ | Linux (Ubuntu NR 10.04) on x86 (32-bit) | (MRI) Ruby 1.8.7 | GMP 4.3.1 (2.4.2) |
55
+ | | (MRI) Ruby 1.8.7 | GMP 4.3.2 (2.4.2) |
56
+ | | (MRI) Ruby 1.8.7 | GMP 5.0.1 (3.0.0) |
57
+ | | (MRI) Ruby 1.9.1 | GMP 4.3.1 (2.4.2) |
58
+ | | (MRI) Ruby 1.9.1 | GMP 4.3.2 (2.4.2) |
59
+ | | (MRI) Ruby 1.9.1 | GMP 5.0.1 (3.0.0) |
60
+ | | (MRI) Ruby 1.9.2 | GMP 4.3.1 (2.4.2) |
61
+ | | (MRI) Ruby 1.9.2 | GMP 4.3.2 (2.4.2) |
62
+ | | (MRI) Ruby 1.9.2 | GMP 5.0.1 (3.0.0) |
63
+ +-----------------------------------------+------------------+-------------------+
64
+ | Linux (Ubuntu 10.04) on x86_64 (64-bit) | (MRI) Ruby 1.8.7 | GMP 4.3.2 (2.4.2) |
65
+ | | (MRI) Ruby 1.8.7 | GMP 5.0.1 (3.0.0) |
66
+ | | (MRI) Ruby 1.9.1 | GMP 4.3.2 (2.4.2) |
67
+ | | (MRI) Ruby 1.9.1 | GMP 5.0.1 (3.0.0) |
68
+ | | (MRI) Ruby 1.9.2 | GMP 4.3.2 (2.4.2) |
69
+ | | (MRI) Ruby 1.9.2 | GMP 5.0.1 (3.0.0) |
70
+ +-----------------------------------------+------------------+-------------------+
71
+ | Mac OS X 10.6.4 on x86_64 (64-bit) | (MRI) Ruby 1.8.7 | GMP 4.3.2 (2.4.2) |
72
+ | | (MRI) Ruby 1.8.7 | GMP 5.0.1 (3.0.0) |
73
+ | | (MRI) Ruby 1.9.1 | GMP 4.3.2 (2.4.2) |
74
+ | | (MRI) Ruby 1.9.1 | GMP 5.0.1 (3.0.0) |
75
+ | | (MRI) Ruby 1.9.2 | GMP 4.3.2 (2.4.2) |
76
+ | | (MRI) Ruby 1.9.2 | GMP 5.0.1 (3.0.0) |
77
+ +-----------------------------------------+------------------+-------------------+
78
+ | Windows 7 on x86_64 (64-bit) | (MRI) Ruby 1.8.7 | GMP 4.3.2 (2.4.2) |
79
+ | | (MRI) Ruby 1.8.7 | GMP 5.0.1 (3.0.0) |
80
+ | | (MRI) Ruby 1.9.1 | GMP 4.3.2 (2.4.2) |
81
+ | | (MRI) Ruby 1.9.1 | GMP 5.0.1 (3.0.0) |
82
+ | | (MRI) Ruby 1.9.2 | GMP 4.3.2 (2.4.2) |
83
+ | | (MRI) Ruby 1.9.2 | GMP 5.0.1 (3.0.0) |
84
+ +-----------------------------------------+------------------+-------------------+
85
+ | Windows XP on x86 (32-bit) | (MRI) Ruby 1.9.1 | GMP 4.3.2 (2.4.2) |
86
+ | | (MRI) Ruby 1.9.1 | GMP 5.0.1 (3.0.0) |
87
+ +-----------------------------------------+------------------+-------------------+
69
88
 
70
89
  =Authors
71
90
 
@@ -81,8 +100,11 @@ as pi, are defined under class methods of GMP::F, listed below.
81
100
  GMP::GMP_CC #=> The compiler used to compile GMP
82
101
  GMP::GMP_CFLAGS #=> The CFLAGS used to compile GMP
83
102
  GMP::GMP_BITS_PER_LIMB #=> The number of bits per limb
103
+ GMP::GMP_NUMB_MAX #=> The maximum value that can be stored in the number part of a limb
84
104
  (if MPFR is available)
85
105
  GMP::MPFR_VERSION #=> A string like "2.4.2"
106
+ GMP::MPFR_PREC_MIN #=> The minimum precision available
107
+ GMP::MPFR_PREC_MAX #=> The maximum precision available
86
108
  GMP::GMP_RNDN #=> The constant representing "round to nearest"
87
109
  GMP::GMP_RNDZ #=> The constant representing "round toward zero"
88
110
  GMP::GMP_RNDU #=> The constant representing "round toward plus infinity"
@@ -138,6 +160,7 @@ You can also call them as:
138
160
  + addition
139
161
  - substraction
140
162
  * multiplication
163
+ / division
141
164
  to_s convert to string. For GMP::Z, this method takes
142
165
  one optional argument, a base. The base can be a
143
166
  Fixnum in the ranges [2, 62] or [-36, -2] or a
@@ -159,10 +182,17 @@ You can also call them as:
159
182
  may have different precisions, which would make
160
183
  them unswapable
161
184
  GMP::Z
185
+ to_i convert to Fixnum or Bignum
162
186
  add! in-place addition
163
187
  sub! in-place subtraction
188
+ addmul!(b,c) in-place += b*c
189
+ submul!(b,c) in-place -= b*c
164
190
  tdiv,fdiv,cdiv truncate, floor and ceil division
165
191
  tmod,fmod,cmod truncate, floor and ceil modulus
192
+ >> shift right, floor
193
+ divisible?(b) true if divisible by b
194
+ ** power
195
+ powmod power modulo
166
196
  [],[]= testing and setting bits (as booleans)
167
197
  scan0,scan1 starting at bitnr (1st arg), scan for a 0 or 1
168
198
  (respectively), then return the index of the
@@ -171,12 +201,9 @@ You can also call them as:
171
201
  com 2's complement
172
202
  com! in-place 2's complement
173
203
  &,|,^ logical operations: and, or, xor
174
- ** power
175
- powmod power modulo
176
204
  even? is even
177
205
  odd? is odd
178
206
  << shift left
179
- >> shift right, floor
180
207
  tshr shift right, truncate
181
208
  lastbits_pos(n) last n bits of object, modulo if negative
182
209
  lastbits_sgn(n) last n bits of object, preserve sign
@@ -190,7 +217,7 @@ You can also call them as:
190
217
  certainly prime
191
218
  nextprime next *probable* prime
192
219
  nextprime! change the object into its next *probable* prime
193
- gcd greatest common divisor
220
+ gcd, gcdext greatest common divisor
194
221
  invert(m) invert mod m
195
222
  jacobi jacobi symbol
196
223
  legendre legendre symbol
@@ -199,9 +226,6 @@ You can also call them as:
199
226
  sizeinbase(b) digits in base b
200
227
  size_in_bin digits in binary
201
228
  size number of limbs
202
- to_i convert to Fixnum or Bignum
203
- GMP::Q and GMP::F
204
- / division
205
229
  GMP::Q
206
230
  num numerator
207
231
  den denominator
@@ -260,18 +284,23 @@ You can also call them as:
260
284
  y0 second kind Bessel function of order 0 of object
261
285
  y1 second kind Bessel function of order 1 of object
262
286
  yn second kind Bessel function of order n of object
287
+ agm arithmetic-geometric mean
288
+ hypot
263
289
  cos \
264
290
  sin |
265
291
  tan |
292
+ sin_cos |
266
293
  sec |
267
294
  csc |
268
295
  cot |
269
296
  acos |
270
297
  asin |
271
298
  atan | trigonometric functions
299
+ atan2 |
272
300
  cosh | of the object
273
301
  sinh |
274
302
  tanh |
303
+ sinh_cosh |
275
304
  sec |
276
305
  csc |
277
306
  cot |
@@ -352,7 +381,9 @@ Right now, there are only three such plugged in ruby scripts:
352
381
  whose size (in bits) is given by 2 operands.
353
382
  * rsa - measures performance of using RSA to sign messages. The size of pq, the
354
383
  product of the two co-prime GMP::Z objects, p and q, is given by 1 operand.
355
-
384
+
385
+ <b>OOOLLLDDD... UPDATE PLZ</b>
386
+
356
387
  Results: on my little Intel Core Duo T2400 @ 1.83GHz:
357
388
  +---------------------------------------------------------+
358
389
  | GMP 4.3.1* compiled with GCC 3.4.4, I think (cygwin did |
@@ -388,6 +419,11 @@ efficiency in GMP; the inefficiencies of the gmp gem are relatively greater.
388
419
 
389
420
  =Todo
390
421
 
422
+ * GMP::Z#to_d_2exp, #congruent?, #rootrem, #lcm, #kronecker, #bin,
423
+ #fib2, #lucnum, #lucnum2, #hamdist, #combit, #fits_x?
424
+ * GMP::Q#to_s(base), GMP::F#to_s(base) (test it!)
425
+ * benchmark gcdext, pi
426
+
391
427
  These are inherited from Tomasz. I will go through these and see which are
392
428
  still relevant, and which I understand.
393
429
 
@@ -396,11 +432,9 @@ still relevant, and which I understand.
396
432
  * to_s vs. inspect
397
433
  * check if mpz_addmul_ui would optimize some statements
398
434
  * some system that allows using denref and numref as normal ruby objects (?)
399
- * should we allocate global temporary variables like Perl GMP does?
400
435
  * takeover code that replaces all Bignums with GMP::Z
401
- * better bignum parser
436
+ * better bignum parser (how? to_s seems good to me.)
402
437
  * zero-copy method for strings generation
403
- * put rb_raise into nice macros
404
438
  * benchmarks against Python GMP and Perl GMP
405
439
  * dup methods
406
440
  * integrate F into system
@@ -412,5 +446,3 @@ still relevant, and which I understand.
412
446
  * check if different sorting of operatations gives better cache usage
413
447
  * GMP::* op RubyFloat and RubyFloat op GMP::*
414
448
  * sort checks
415
- * GMP::Q.to_s(base), GMP::F.to_s(base) (test it!)
416
- * benchmark gcdext, pi