| 1 |
# fgmp |
| 2 |
|
| 3 |
FGMP is a public domain implementation of a subset of the GNU gmp library with the same API. |
| 4 |
|
| 5 |
WELCOME TO FGMP. |
| 6 |
|
| 7 |
FGMP is a public domain implementation of a subset of the GNU gmp library |
| 8 |
with the same API. |
| 9 |
|
| 10 |
For instance, you can link the following trivial program with either |
| 11 |
this code, or libgmp.a and get the same results. |
| 12 |
|
| 13 |
```c |
| 14 |
#include <stdio.h> |
| 15 |
#include "gmp.h" |
| 16 |
main() |
| 17 |
{ |
| 18 |
MP_INT a; MP_INT b; MP_INT c; |
| 19 |
|
| 20 |
mpz_init_set_ui(&a,1); mpz_init_set_ui(&b,2); mpz_init(&c); |
| 21 |
mpz_add(&c,&a,&b); |
| 22 |
printf("\n%s\n", mpz_get_str(NULL,10,&c)); |
| 23 |
} |
| 24 |
``` |
| 25 |
|
| 26 |
FGMP is really in the public domain. You can do whatever you want with |
| 27 |
it. |
| 28 |
|
| 29 |
I wrote FGMP so that we would all have access to a (truly free) |
| 30 |
implementation of this subset of the API of GNU libgmp. I encourage |
| 31 |
everyone to distribute this as widely as possible. |
| 32 |
|
| 33 |
If you need more documentation, I suggest you look at the file |
| 34 |
gmp.texi which is included with the GNU gmp library. |
| 35 |
|
| 36 |
You can send me bug reports, implementations of missing functions, flames |
| 37 |
and rants by Email. |
| 38 |
|
| 39 |
Any submissions of new code to be integrated into fgmp must also be |
| 40 |
placed in the public domain (For the particularly dense, you can |
| 41 |
release a new fgmp yourself under different licensing terms. This |
| 42 |
is a condition for including a submission in a release of FGMP that |
| 43 |
I personally prepare). |
| 44 |
|
| 45 |
Mark Henderson <[email protected]> |
| 46 |
|
| 47 |
# This is the fifth BETA release. 1.0b5 |
| 48 |
|
| 49 |
I hearby place this file and all of FGMP in the public domain. |
| 50 |
|
| 51 |
Thanks to Paul Rouse <[email protected]> for changes to get fgmp |
| 52 |
to work on a 286 MS-DOS compiler, the functions mpz_sqrt and |
| 53 |
mpz_sqrtrem, plus other general bug fixes. |
| 54 |
|
| 55 |
Thanks also to Erick Gallesio <[email protected]> for a fix |
| 56 |
to mpz_init_set_str |
| 57 |
|
| 58 |
Define B64 if your "long" type is 64 bits. Otherwise we assume 32 |
| 59 |
bit longs. (The 64 bit version hasn't been tested enough) |
| 60 |
|
| 61 |
``` |
| 62 |
Platforms: |
| 63 |
Linux 0.99 (gcc) |
| 64 |
IBM RS6000/AIX 3.2 (IBM xlc compiler and gcc 2.3) |
| 65 |
Sun OS 4.1, Sun 3/4 |
| 66 |
DEC Alpha OSF/1 (only lightly tested, 64 bit longs do make a difference, |
| 67 |
thanks to DEC for providing access via axposf.pa.dec.com). Define B64 |
| 68 |
for this platform |
| 69 |
MS-DOS 286 C compiler (see credits above) |
| 70 |
``` |
| 71 |
|
| 72 |
# Some differences between gmp and fgmp |
| 73 |
|
| 74 |
1. fgmp is considerably slower than gmp |
| 75 |
2. fgmp does not implement the following: |
| 76 |
all mpq_* |
| 77 |
internal mpn_* functions |
| 78 |
mpz_perfect_square_p |
| 79 |
mpz_inp_raw, mpz_out_raw |
| 80 |
mp_set_memory_functions, mpz_out_str, mpz_inp_str |
| 81 |
3. fgmp implements the following in addition to the routines in GNU gmp. |
| 82 |
`int mpz_jacobi(MP_INT *a, MP_INT *b)` |
| 83 |
- finds the jacobi symbol (a/b) |
| 84 |
4. mpz_sizeinbase often overestimates the exact value |
| 85 |
|
| 86 |
5. To convert your gmp based program to fgmp (subject to the |
| 87 |
above) |
| 88 |
|
| 89 |
- recompile your source. Make sure to include the gmp.h file included |
| 90 |
with fgmp rather than that included with gmp. (The point is to recompile |
| 91 |
all files which include gmp.h) |
| 92 |
- link with gmp.o instead of libgmp.a |
| 93 |
|
| 94 |
Here's a complete sorted list of function implemented in fgmp: |
| 95 |
|
| 96 |
``` |
| 97 |
_mpz_realloc |
| 98 |
mpz_abs |
| 99 |
mpz_add |
| 100 |
mpz_add_ui |
| 101 |
mpz_and |
| 102 |
mpz_clear |
| 103 |
mpz_cmp |
| 104 |
mpz_cmp_si |
| 105 |
mpz_cmp_ui |
| 106 |
mpz_div |
| 107 |
mpz_div_2exp |
| 108 |
mpz_div_ui |
| 109 |
mpz_divmod |
| 110 |
mpz_divmod_ui |
| 111 |
mpz_fac_ui |
| 112 |
mpz_gcd |
| 113 |
mpz_gcdext |
| 114 |
mpz_get_si |
| 115 |
mpz_get_str |
| 116 |
mpz_get_ui |
| 117 |
mpz_init |
| 118 |
mpz_init_set |
| 119 |
mpz_init_set_si |
| 120 |
mpz_init_set_str |
| 121 |
mpz_init_set_ui |
| 122 |
mpz_jacobi |
| 123 |
mpz_mdiv |
| 124 |
mpz_mdiv_ui |
| 125 |
mpz_mdivmod |
| 126 |
mpz_mdivmod_ui |
| 127 |
mpz_mmod |
| 128 |
mpz_mmod_ui |
| 129 |
mpz_mod |
| 130 |
mpz_mod_2exp |
| 131 |
mpz_mod_ui |
| 132 |
mpz_mul |
| 133 |
mpz_mul_2exp |
| 134 |
mpz_mul_ui |
| 135 |
mpz_neg |
| 136 |
mpz_or |
| 137 |
mpz_pow_ui |
| 138 |
mpz_powm |
| 139 |
mpz_powm_ui |
| 140 |
mpz_probab_prime_p |
| 141 |
mpz_random |
| 142 |
mpz_random2 |
| 143 |
mpz_set |
| 144 |
mpz_set_si |
| 145 |
mpz_set_str |
| 146 |
mpz_set_ui |
| 147 |
mpz_size |
| 148 |
mpz_sizeinbase |
| 149 |
mpz_sqrt |
| 150 |
mpz_sqrtrem |
| 151 |
mpz_sub |
| 152 |
mpz_sub_ui |
| 153 |
mpz_xor |
| 154 |
``` |