Hello,
what is your O.S ?
For example to use
gmp on windows 11 lazarus 64 bits .
1 - Download the file
gmp.pas from github free pascal repository :
https://github.com/fpc/FPCSource/tree/main/packages/gmp/src2 - Put the file in your project folder.
3 - Download gmp library for windows. For example from here :
https://github.com/gx/gmp/releases/tag/6.1.2-2 (only 6.1.2 version need msvc 2019 redistribuable library)
4 - from
gmp-6.1.2-2-msvc2019-x64-Release.zip file extract
libgmp-13.dll and rename it
gmp.dll. Put it in your project folder or in the windows system32 folder
Example to use gmp in Lazarus :
implementation
uses math, gmp;
{$R *.lfm}
procedure TForm1.GoClick(Sender: TObject);
const N = 2;
NBITS = 100;
var f: mpfloat;
bits, digits: integer;
begin
f_set_default_prec(NBITS);
bits := f_get_default_prec;
digits := floor(bits * LOG_10_2);
f := f_sqrt_ui(N);
Memo1.Append(format('Sqrt(%d) to %d digits (%d bits) = %s', [N, digits, bits, AnsiString(f)]));
f := f ** 2;
Memo1.Append(format('Squared back = %s', [AnsiString(f)]));
f -= N;
Memo1.Append(format('Minus %d = %s', [N, AnsiString(f)]));
end;
Friendly, J.P