Download Latest Version win64-release.zip (313.6 kB)
Email in envelope

Get an email when there's a new version of GMP Fortran library

Home
Name Modified Size InfoDownloads / Week
win64-release.zip 2021-05-28 313.6 kB
gmp-fortran-library-code.tar.bz2 2021-03-19 21.7 kB
README.md 2021-03-13 2.3 kB
Totals: 3 Items   337.6 kB 4

Fortran GMP library

Fortran binding for GMP library.
Original GMP library is available here.

Description

It allows to use GMP library in Your Fortran programs.

In addition, it allows to use ordinary aritmetic and comparision operations syntax, like:

z = (x + 2) * y ** 3
x == y, x /= y, x > y, x < y, x >= y, x <= y
z = x .mod. y, .odd. x, .even. x, y = x .shift. 4 (for integer numbers)

Also, it is possible to initialize GMP numbers by strings, like:

z = "123456789012345678901234567890", q = "123 / 4567890"

System requirements

Linux, Windows (with MinGW & MSYS).
GNU Fortran and C compilers.
Fortran standard: 2003 or higher.
Dependency: libgmp (including development *.h files).

Manual

Original GMP library manual is available here.

Currently supported functions list is available here

Build

Just run:

make

As the result, ./lib directory will be created with the following contents: * libfgmp.a - static library required for linking; * modules gmp_z.mod, gmp_q.mod, gmp_f.mod, gmp_r.mod - for integer, rational number, floating-points, random number functions respectively; * some other auxiliary modules not required to USE explicitly.

Don't forget to link your programs with original library libgmp.
Though library tested with GNU compilers only, you can try to build and use it with alternatives (it will require some manual Makefile corrections).

Testing

Archimedes's cattle problem solving program archimedes.f90 is included for testing purposes.

No memory leaks are detected; valgrind output is shown below:

...
==26064== 
==26064== HEAP SUMMARY:
==26064==     in use at exit: 0 bytes in 0 blocks
==26064==   total heap usage: 3,928,779 allocs, 3,928,779 frees, 44,339,631,222 bytes allocated
==26064== 
==26064== All heap blocks were freed -- no leaks are possible
==26064== 
==26064== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==26064== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

License

The same as original GMP library one.

Contacts

E-mail

Source: README.md, updated 2021-03-13