gmp 0.5.41 → 0.5.47

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/CHANGELOG +21 -0
  2. data/FEATURES.html +37 -38
  3. data/README.html +511 -0
  4. data/README.markdown +494 -0
  5. data/benchmark/divide +0 -0
  6. data/benchmark/gcd +0 -0
  7. data/benchmark/multiply +0 -0
  8. data/benchmark/multiply.fnl +0 -0
  9. data/benchmark/multiply.gc +0 -0
  10. data/benchmark/pi +0 -0
  11. data/benchmark/rsa +0 -0
  12. data/benchmark/runbench +0 -0
  13. data/benchmark/srb.sh +0 -0
  14. data/ext/gmp.c +0 -42
  15. data/ext/gmpf.c +64 -33
  16. data/ext/gmpq.c +88 -1
  17. data/ext/gmpz.c +151 -19
  18. data/ext/ruby_gmp.h +16 -10
  19. data/manual.pdf +0 -0
  20. data/manual.tex +50 -14
  21. data/test/gmp_tgcd.rb +18 -18
  22. data/test/mpfr_tcbrt.rb +1 -1
  23. data/test/mpfr_tconst_euler.rb +10 -7
  24. data/test/mpfr_tisnan.rb +1 -1
  25. data/test/mpfr_trec_sqrt.rb +1 -1
  26. data/test/mpfr_tsqrt.rb +1 -1
  27. data/test/tc_cmp.rb +7 -2
  28. data/test/tc_constants.rb +1 -1
  29. data/test/tc_division.rb +1 -1
  30. data/test/tc_f_arithmetics_coersion.rb +1 -1
  31. data/test/tc_f_precision.rb +1 -1
  32. data/test/tc_fib_fac_nextprime.rb +1 -1
  33. data/test/tc_floor_ceil_truncate.rb +1 -1
  34. data/test/tc_hashes.rb +26 -1
  35. data/test/tc_logical_roots.rb +1 -1
  36. data/test/tc_mpfr_constants.rb +1 -1
  37. data/test/tc_mpfr_functions.rb +1 -1
  38. data/test/tc_mpfr_random.rb +1 -1
  39. data/test/tc_mpfr_rounding.rb +3 -3
  40. data/test/tc_q.rb +1 -1
  41. data/test/tc_q_basic.rb +1 -1
  42. data/test/tc_random.rb +1 -1
  43. data/test/tc_sgn_neg_abs.rb +1 -1
  44. data/test/tc_swap.rb +1 -1
  45. data/test/tc_z.rb +34 -1
  46. data/test/tc_z_addmul.rb +1 -1
  47. data/test/tc_z_basic.rb +1 -1
  48. data/test/tc_z_exponentiation.rb +1 -1
  49. data/test/tc_z_functional_mappings.rb +42 -6
  50. data/test/tc_z_gcd_lcm_invert.rb +1 -1
  51. data/test/tc_z_jac_leg_rem.rb +1 -1
  52. data/test/tc_z_logic.rb +1 -1
  53. data/test/tc_z_shifts_last_bits.rb +1 -1
  54. data/test/tc_z_submul.rb +1 -1
  55. data/test/tc_z_to_dis.rb +1 -1
  56. data/test/tc_zerodivisionexceptions.rb +1 -1
  57. data/test/test_helper.rb +2 -1
  58. data/test/unit_tests.rb +1 -1
  59. metadata +70 -89
  60. data/README.rdoc +0 -450
@@ -0,0 +1,494 @@
1
+ gmp
2
+ ===
3
+
4
+ gmp is library providing Ruby bindings to GMP library. Here is the introduction
5
+ paragraph at [their homepage](http://gmplib.org/#WHAT):
6
+
7
+ > GMP is a free library for arbitrary precision arithmetic, operating on
8
+ > signed integers, rational numbers, and floating point numbers. There is no
9
+ > practical limit to the precision except the ones implied by the available
10
+ > memory in the machine GMP runs on. GMP has a rich set of functions, and the
11
+ > functions have a regular interface.
12
+ >
13
+ > The main target applications for GMP are cryptography applications and
14
+ > research, Internet security applications, algebra systems, computational
15
+ > algebra research, etc.
16
+ >
17
+ > GMP is carefully designed to be as fast as possible, both for small operands
18
+ > and for huge operands. The speed is achieved by using fullwords as the basic
19
+ > arithmetic type, by using fast algorithms, with highly optimised assembly
20
+ > code for the most common inner loops for a lot of CPUs, and by a general
21
+ > emphasis on speed.
22
+ >
23
+ > GMP is faster than any other bignum library. The advantage for GMP increases
24
+ > with the operand sizes for many operations, since GMP uses asymptotically
25
+ > faster algorithms.
26
+ >
27
+ > The first GMP release was made in 1991. It is continually developed and
28
+ > maintained, with a new release about once a year.
29
+ >
30
+ > GMP is distributed under the GNU LGPL. This license makes the library free to
31
+ > use, share, and improve, and allows you to pass on the result. The license
32
+ > gives freedoms, but also sets firm restrictions on the use with non-free
33
+ > programs.
34
+ >
35
+ > GMP is part of the GNU project. For more information about the GNU project,
36
+ > please see the official GNU web site.
37
+ >
38
+ > GMP's main target platforms are Unix-type systems, such as GNU/Linux,
39
+ > Solaris, HP-UX, Mac OS X/Darwin, BSD, AIX, etc. It also is known to work on
40
+ > Windoze in 32-bit mode.
41
+ >
42
+ > GMP is brought to you by a team listed in the manual.
43
+ >
44
+ > GMP is carefully developed and maintained, both technically and legally. We
45
+ > of course inspect and test contributed code carefully, but equally
46
+ > importantly we make sure we have the legal right to distribute the
47
+ > contributions, meaning users can safely use GMP. To achieve this, we will ask
48
+ > contributors to sign paperwork where they allow us to distribute their work."
49
+
50
+ Only GMP 4 or newer is supported. The following environments have been tested
51
+ by me: gmp gem 0.5.41 on:
52
+
53
+ <table border="1">
54
+ <tr>
55
+ <th>Platform</th>
56
+ <th>Ruby</th>
57
+ <th>GMP (MPFR)</th>
58
+ </tr>
59
+ <tr>
60
+ <td rowspan="3">Linux (Ubuntu NR 10.04) on x86 (32-bit)</td>
61
+ <td>(MRI) Ruby 1.8.7</td>
62
+ <td>GMP 4.3.1 (2.4.2)<br />
63
+ GMP 4.3.2 (2.4.2)<br />
64
+ GMP 5.0.1 (3.0.0)</td>
65
+ </tr>
66
+ <tr>
67
+ <td>(MRI) Ruby 1.9.1</td>
68
+ <td>GMP 4.3.1 (2.4.2)<br />
69
+ GMP 4.3.2 (2.4.2)<br />
70
+ GMP 5.0.1 (3.0.0)</td>
71
+ </tr>
72
+ <tr>
73
+ <td>(MRI) Ruby 1.9.2</td>
74
+ <td>GMP 4.3.1 (2.4.2)<br />
75
+ GMP 4.3.2 (2.4.2)<br />
76
+ GMP 5.0.1 (3.0.0)</td>
77
+ </tr>
78
+ <tr>
79
+ <td rowspan="4">Linux (Ubuntu 10.04) on x86_64 (64-bit)</td>
80
+ <td>(MRI) Ruby 1.8.7</td>
81
+ <td>GMP 4.3.2 (2.4.2)<br />
82
+ GMP 5.0.1 (3.0.0)</td>
83
+ </tr>
84
+ <tr>
85
+ <td>(MRI) Ruby 1.9.1</td>
86
+ <td>GMP 4.3.2 (2.4.2)<br />
87
+ GMP 5.0.1 (3.0.0)</td>
88
+ </tr>
89
+ <tr>
90
+ <td>(MRI) Ruby 1.9.2</td>
91
+ <td>GMP 4.3.2 (2.4.2)<br />
92
+ GMP 5.0.1 (3.0.0)</td>
93
+ </tr>
94
+ <tr>
95
+ <td>(RBX) Rubinius 1.1.0</td>
96
+ <td>GMP 4.3.2 (2.4.2)<br />
97
+ GMP 5.0.1 (3.0.0)</td>
98
+ </tr>
99
+ <tr>
100
+ <td rowspan="4">Mac OS X 10.6.4 on x86_64 (64-bit)</td>
101
+ <td>(MRI) Ruby 1.8.7</td>
102
+ <td>GMP 4.3.2 (2.4.2)<br />
103
+ GMP 5.0.1 (3.0.0)</td>
104
+ </tr>
105
+ <tr>
106
+ <td>(MRI) Ruby 1.9.1</td>
107
+ <td>GMP 4.3.2 (2.4.2)<br />
108
+ GMP 5.0.1 (3.0.0)</td>
109
+ </tr>
110
+ <tr>
111
+ <td>(MRI) Ruby 1.9.2</td>
112
+ <td>GMP 4.3.2 (2.4.2)<br />
113
+ GMP 5.0.1 (3.0.0)</td>
114
+ </tr>
115
+ <tr>
116
+ <td>(RBX) Rubinius 1.1.0</td>
117
+ <td>GMP 4.3.2 (2.4.2)<br />
118
+ GMP 5.0.1 (3.0.0)</td>
119
+ </tr>
120
+ <tr>
121
+ <td rowspan="3">Windows 7 on x86_64 (64-bit)</td>
122
+ <td>(MRI) Ruby 1.8.7</td>
123
+ <td>GMP 4.3.2 (2.4.2)<br />
124
+ GMP 5.0.1 (3.0.0)</td>
125
+ </tr>
126
+ <tr>
127
+ <td>(MRI) Ruby 1.9.1</td>
128
+ <td>GMP 4.3.2 (2.4.2)<br />
129
+ GMP 5.0.1 (3.0.0)</td>
130
+ </tr>
131
+ <tr>
132
+ <td>(MRI) Ruby 1.9.2</td>
133
+ <td>GMP 4.3.2 (2.4.2)<br />
134
+ GMP 5.0.1 (3.0.0)</td>
135
+ </tr>
136
+ <tr>
137
+ <td>Windows XP on x86 (32-bit)</td>
138
+ <td>(MRI) Ruby 1.9.1</td>
139
+ <td>GMP 4.3.2 (2.4.2)<br />
140
+ GMP 5.0.1 (3.0.0)</td>
141
+ </tr>
142
+ </table>
143
+
144
+ Authors
145
+ -------
146
+
147
+ * Tomasz Wegrzanowski
148
+ * srawlins
149
+
150
+ Constants
151
+ ---------
152
+
153
+ The GMP module includes the following constants. Mathematical constants, such
154
+ as pi, are defined under class methods of GMP::F, listed below.
155
+
156
+ * `GMP::GMP_VERSION` - A string like "5.0.1"
157
+ * `GMP::GMP_CC` - The compiler used to compile GMP
158
+ * `GMP::GMP_CFLAGS` - The CFLAGS used to compile GMP
159
+ * `GMP::GMP\_BITS_PER_LIMB` The number of bits per limb
160
+ * `GMP::GMP_NUMB_MAX` - The maximum value that can be stored in the number part of a limb
161
+
162
+ if MPFR is available:
163
+ * `GMP::MPFR_VERSION` - A string like "2.4.2"
164
+ * `GMP::MPFR\_PREC_MIN` - The minimum precision available
165
+ * `GMP::MPFR_PREC_MAX` - The maximum precision available
166
+ * `GMP::GMP_RNDN` - The constant representing "round to nearest"
167
+ * `GMP::GMP_RNDZ` - The constant representing "round toward zero"
168
+ * `GMP::GMP_RNDU` - The constant representing "round toward plus infinity"
169
+ * `GMP::GMP_RNDD` - The constant representing "round toward minus infinity"
170
+
171
+ New in MPFR 3.0.0:
172
+ * `GMP::MPFR_RNDN`
173
+ * `GMP::MPFR_RNDZ`
174
+ * `GMP::MPFR_RNDU`
175
+ * `GMP::MPFR_RNDD`
176
+ * `GMP::MPFR_RNDA` - The constant representing "round away from zero"
177
+
178
+ Classes
179
+ -------
180
+
181
+ The GMP module is provided with following classes:
182
+ * `GMP::Z` - infinite precision integer numbers
183
+ * `GMP::Q` - infinite precision rational numbers
184
+ * `GMP::F` - arbitrary precision floating point numbers
185
+ * `GMP::RandState` - states of individual random number generators
186
+
187
+ Numbers are created by using `new()`. Constructors can take following arguments:
188
+
189
+ GMP::Z.new()
190
+ GMP::Z.new(GMP::Z)
191
+ GMP::Z.new(Fixnum)
192
+ GMP::Z.new(Bignum)
193
+ GMP::Z.new(String)
194
+ GMP::Q.new()
195
+ GMP::Q.new(GMP::Q)
196
+ GMP::Q.new(String)
197
+ GMP::Q.new(any GMP::Z initializer)
198
+ GMP::Q.new(any GMP::Z initializer, any GMP::Z initializer)
199
+ GMP::F.new()
200
+ GMP::F.new(GMP::Z, precision=0)
201
+ GMP::F.new(GMP::Q, precision=0)
202
+ GMP::F.new(GMP::F)
203
+ GMP::F.new(GMP::F, precision)
204
+ GMP::F.new(String, precision=0)
205
+ GMP::F.new(Fixnum, precision=0)
206
+ GMP::F.new(Bignum, precision=0)
207
+ GMP::F.new(Float, precision=0)
208
+ GMP::RandState.new(\[algorithm\] \[, algorithm_args\])
209
+
210
+ You can also call them as:
211
+
212
+ GMP.Z(args)
213
+ GMP.Q(args)
214
+ GMP.F(args)
215
+ GMP.RandState()
216
+
217
+ Methods
218
+ -------
219
+
220
+ GMP::Z, GMP::Q and GMP::F
221
+ + addition
222
+ - substraction
223
+ * multiplication
224
+ / division
225
+ to_s convert to string. For GMP::Z, this method takes
226
+ one optional argument, a base. The base can be a
227
+ Fixnum in the ranges \[2, 62\] or \[-36, -2\] or a
228
+ Symbol: :bin, :oct, :dec, or :hex.
229
+ -@ negation
230
+ neg! in-place negation
231
+ abs absolute value
232
+ asb! in-place absolute value
233
+ coerce promotion of arguments
234
+ == equality test
235
+ <=>,>=,>,<=,< comparisions
236
+ class methods of GMP::Z
237
+ fac(n) factorial of n
238
+ fib(n) nth fibonacci number
239
+ pow(n,m) n to mth power
240
+ GMP::Z and GMP::Q
241
+ swap efficiently swap contents of two objects, there
242
+ is no GMP::F.swap because various GMP::F objects
243
+ may have different precisions, which would make
244
+ them unswapable
245
+ GMP::Z
246
+ to_i convert to Fixnum or Bignum
247
+ add! in-place addition
248
+ sub! in-place subtraction
249
+ addmul!(b,c) in-place += b*c
250
+ submul!(b,c) in-place -= b*c
251
+ tdiv,fdiv,cdiv truncate, floor and ceil division
252
+ tmod,fmod,cmod truncate, floor and ceil modulus
253
+ >> shift right, floor
254
+ divisible?(b) true if divisible by b
255
+ ** power
256
+ powmod power modulo
257
+ \[\],\[\]= testing and setting bits (as booleans)
258
+ scan0,scan1 starting at bitnr (1st arg), scan for a 0 or 1
259
+ (respectively), then return the index of the
260
+ first instance.
261
+ cmpabs comparison of absolute value
262
+ com 2's complement
263
+ com! in-place 2's complement
264
+ &,|,^ logical operations: and, or, xor
265
+ even? is even
266
+ odd? is odd
267
+ << shift left
268
+ tshr shift right, truncate
269
+ lastbits_pos(n) last n bits of object, modulo if negative
270
+ lastbits_sgn(n) last n bits of object, preserve sign
271
+ power? is perfect power
272
+ square? is perfect square
273
+ sqrt square root
274
+ sqrt! change the object into its square root
275
+ sqrtrem square root, remainder
276
+ root(n) nth root
277
+ probab_prime? 0 if composite, 1 if probably prime, 2 if
278
+ certainly prime
279
+ nextprime next *probable* prime
280
+ nextprime! change the object into its next *probable* prime
281
+ gcd, gcdext greatest common divisor
282
+ invert(m) invert mod m
283
+ jacobi jacobi symbol
284
+ legendre legendre symbol
285
+ remove(n) remove all occurences of factor n
286
+ popcount the number of bits equal to 1
287
+ sizeinbase(b) digits in base b
288
+ size_in_bin digits in binary
289
+ size number of limbs
290
+ GMP::Q
291
+ num numerator
292
+ den denominator
293
+ inv inversion
294
+ inv! in-place inversion
295
+ floor,ceil,trunc nearest integer
296
+ class methods of GMP::F
297
+ default_prec get default precision
298
+ default_prec= set default precision
299
+ GMP::F
300
+ prec get precision
301
+ floor,ceil,trunc nearest integer, GMP::F is returned, not GMP::Z
302
+ floor!,ceil!,trunc! in-place nearest integer
303
+ GMP::RandState
304
+ seed(integer) seed the generator with a Fixnum or GMP::Z
305
+ urandomb(fixnum) get uniformly distributed random number between 0
306
+ and 2^fixnum-1, inclusive
307
+ urandomm(integer) get uniformly distributed random number between 0
308
+ and integer-1, inclusive
309
+ GMP (timing functions for GMPbench (0.2))
310
+ cputime milliseconds of cpu time since Ruby start
311
+ time times the execution of a block
312
+
313
+ *only if MPFR is available*
314
+ class methods of GMP::F
315
+ const_log2 returns the natural log of 2
316
+ const_pi returns pi
317
+ const_euler returns euler
318
+ const_catalan returns catalan
319
+ mpfr_buildopt_tls_p returns whether MPFR was built as thread safe
320
+ mpfr_buildopt_decimal_p returns whether MPFR was compiled with decimal
321
+ float support
322
+ GMP::F
323
+ sqrt square root of the object
324
+ rec_sqrt square root of the recprical of the object
325
+ cbrt cube root of the object
326
+ ** power
327
+ log natural logarithm of object
328
+ log2 binary logarithm of object
329
+ log10 decimal logarithm of object
330
+ exp e^object
331
+ exp2 2^object
332
+ exp10 10^object
333
+ log1p the same as (object + 1).log, with better
334
+ precision
335
+ expm1 the same as (object.exp) - 1, with better
336
+ precision
337
+ eint exponential integral of object
338
+ li2 real part of the dilogarithm of object
339
+ gamma Gamma fucntion of object
340
+ lngamma logarithm of the Gamma function of object
341
+ digamma Digamma function of object (MPFR_VERSION >= "3.0.0")
342
+ zeta Reimann Zeta function of object
343
+ erf error function of object
344
+ erfc complementary error function of object
345
+ j0 first kind Bessel function of order 0 of object
346
+ j1 first kind Bessel function of order 1 of object
347
+ jn first kind Bessel function of order n of object
348
+ y0 second kind Bessel function of order 0 of object
349
+ y1 second kind Bessel function of order 1 of object
350
+ yn second kind Bessel function of order n of object
351
+ agm arithmetic-geometric mean
352
+ hypot
353
+ cos \
354
+ sin |
355
+ tan |
356
+ sin_cos |
357
+ sec |
358
+ csc |
359
+ cot |
360
+ acos |
361
+ asin |
362
+ atan | trigonometric functions
363
+ atan2 |
364
+ cosh | of the object
365
+ sinh |
366
+ tanh |
367
+ sinh_cosh |
368
+ sec |
369
+ csc |
370
+ cot |
371
+ acosh |
372
+ asinh |
373
+ atanh /
374
+ nan? \
375
+ infinite? | type of floating point number
376
+ finite? |
377
+ number? |
378
+ regular? / (MPFR_VERSION >= "3.0.0")
379
+ GMP::RandState
380
+ mpfr_urandomb(fixnum) get uniformly distributed random floating-point
381
+ number within 0 <= rop < 1
382
+
383
+ Functional Mappings
384
+ -------------------
385
+
386
+ In order to align better with the GMP paradigms of using return arguments, I have started creating "functional mappings", singleton methods that map directly to functions in GMP. These methods take return arguments, so that passing an object to a functional mapping may change the object itself. For example:
387
+
388
+ a = GMP::Z(0)
389
+ b = GMP::Z(13)
390
+ c = GMP::Z(17)
391
+ GMP::Z.add(a, b, c)
392
+ a #=> 30
393
+
394
+ Here's a fun list of all of the functional mappings written so far:
395
+
396
+ GMP::Z
397
+ .abs .add .addmul .cdiv_q_2exp .cdiv_r_2exp .com
398
+ .congruent? .divexact .divisible? .fdiv_q_2exp .fdiv_r_2exp .lcm
399
+ .mul .mul_2exp
400
+ .neg .nextprime .sqrt .sub .submul .tdiv_q_2exp
401
+ .tdiv_r_2exp
402
+
403
+ Documentation
404
+ -------------
405
+
406
+ * [This README](https://github.com/srawlins/gmp)
407
+ * Loren Segal and the guys at RubyGems.org are badasses: [YARDoc](http://rubydoc.info/gems/gmp/frames).
408
+ * There should be a manual.pdf [here](https://github.com/srawlins/gmp/blob/master/manual.pdf). I spend waaay too much time working on this, but it looks very pretty.
409
+ * [CHANGELOG](https://github.com/srawlins/gmp/blob/master/CHANGELOG)
410
+
411
+ Testing
412
+ -------
413
+
414
+ Tests can be run with:
415
+
416
+ cd test
417
+ ruby unit_tests.rb
418
+
419
+ If you have the unit\_test gem installed, all tests should pass. Otherwise, one test may error. I imagine there is a bug in Ruby's built-in `Test::Unit` package that is fixed with the unit_test gem.
420
+
421
+ Known Issues
422
+ ------------
423
+
424
+ * Don't call `GMP::RandState(:lc_2exp_size)`. Give a 2nd arg.
425
+ * Don't use multiple assignment (`a = b = GMP::Z(0)`) with functional mappings.
426
+ * JRuby has some interesting bugs and flickering tests. GMP::Z(GMP::GMP_NUMB_MAX) for example, blows up.
427
+ * MPFR 3.1.0 breaks some of the random tests. This is because of a known change in MPFR. I just need my tests to become aware of the change.
428
+
429
+ Precision
430
+ ---------
431
+
432
+ Precision can be explicitely set as second argument for `GMP::F.new()`. If there is no explicit precision, highest precision of all `GMP::F` arguments is used. That doesn't ensure that result will be exact. For details, consult any paper about floating point arithmetics.
433
+
434
+ Default precision can be explicitely set by passing `0` as the second argument for to `GMP::F.new()`. In particular, you can set precision of copy of `GMP::F` object by:
435
+
436
+ new_obj = GMP::F.new(old_obj, 0)
437
+
438
+ Precision argument, and default_precision will be rounded up to whatever GMP thinks is appropriate.
439
+
440
+ Benchmarking
441
+ ------------
442
+
443
+ "GMP is carefully designed to be as fast as possible." Therefore, I believe it is very important for GMP, and its various language bindings to be benchmarked. In recent years, the GMP team developed GMPbench, an elegant, weighted benchmark. Currently, they maintain a list of recent benchmark [results](http://www.gmplib.org/gmpbench.html), broken down by CPU, CPU freq, ABI, and compiler flags; GMPbench compares different processor's performance against eachother, rather than GMP against other bignum libraries, or comparing different versions of GMP.
444
+
445
+ I intend to build a plug-in to GMPbench that will test the ruby gmp gem. The results of this benchmark should be directly comparable with the results of GMP (on same CPU, etc.). Rather than write a benchmark from the ground up, or try to emulate what GMPbench does, a plug-in will allow for this type of comparison. And in fact, GMPbench is (perhaps intentionally) written perfectly to allow for plugging in.
446
+
447
+ Various scores are derived from GMPbench by running the `runbench` script. This script compiles and runs various individual programs that measure the performance of base functions, such as multiply, and app functions such as rsa.
448
+
449
+ The gmp gem benchmark uses the GMPbench framework (that is, runbench, gexpr, and the timing methods), and plugs in ruby scripts as the individual programs. Right now, there are only four (of six) such plugged in ruby scripts:
450
+
451
+ * multiply - measures performance of multiplying (or squaring) `GMP::Z` objects whose size (in bits) is given by one or two operands.
452
+ * divide - measures performance of dividing two `GMP::Z` objects (using `tdiv`) whose size (in bits) is given by two operands.
453
+ * gcd - measure...
454
+ * rsa - measures performance of using RSA to sign messages. The size of `pq`, the product of the two co-prime `GMP::Z` objects, `p` and `q`, is given by one operand.
455
+
456
+ **insert table here**
457
+
458
+ My guess is that the increase in ruby gmp gem overhead is caused by increased efficiency in GMP; the inefficiencies of the gmp gem are relatively greater.
459
+
460
+ Todo
461
+ ----
462
+
463
+ * `GMP::Z#to_d_2exp`, `#congruent?`, `#rootrem`, `#lcm`, `#kronecker`, `#bin`, `#fib2`, `#lucnum`, `#lucnum2`, `#hamdist`, `#combit`, `#fits_x?`
464
+ * `GMP::Q#to_s(base)`, `GMP::F#to_s(base)` (test it!)
465
+ * benchmark gcdext, pi
466
+ * a butt-load of functional mappings. 47-ish sets.
467
+ * use Rake use Rake use Rake
468
+ * investigate possible memory leaks when using `GMP::Q(22/7)` for example
469
+ * beef up `r_gmpq_initialize`; I don't like to rely on `mpz_set_value`.
470
+ * finish compile-results.rb
471
+ * New in MPFR 3.1.0: mpfr_frexp, mpfr_grandom, mpfr_z_sub, divide-by-zero exception (?)
472
+
473
+ The below are inherited from Tomasz. I will go through these and see which are
474
+ still relevant, and which I understand.
475
+
476
+ * `mpz_fits_*` and 31 vs. 32 integer variables
477
+ * fix all sign issues (don't know what these are)
478
+ * `to_s` vs. `inspect`
479
+ * check if `mpz_addmul_ui` would optimize some statements
480
+ * some system that allows using denref and numref as normal ruby objects
481
+ * takeover code that replaces all `Bignums` with `GMP::Z`
482
+ * better bignum parser (how? `to_s` seems good to me.)
483
+ * zero-copy method for strings generation
484
+ * benchmarks against Python GMP and Perl GMP
485
+ * `dup` methods
486
+ * integrate `F` into system
487
+ * should `Z.\[\]` bits be 0/1 or true/false, 0 is true, which might surprise users
488
+ * `any2small_integer()`
489
+ * check asm output, especially local memory efficiency (uh... no)
490
+ * it might be better to use 'register' for some local variables (uh... no)
491
+ * powm with negative exponents
492
+ * check if different sorting of operatations gives better cache usage
493
+ * `GMP::\*` op `RubyFloat` and `RubyFloat` op `GMP::\*`
494
+ * sort checks