Menu

Tree [8a08dd] master /
 History

HTTPS access


File Date Author Commit
 src 2021-03-19 Serg1us Serg1us [8a08dd] Makefiles fixed
 Makefile 2021-03-19 Serg1us Serg1us [8a08dd] Makefiles fixed
 README.md 2021-03-13 Natali Natali [469d7b] Some fixes
 funcs.txt 2020-10-02 Serg1us Serg1us [302bb8] Initial commit

Read Me

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

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.