mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Software (https://www.mersenneforum.org/forumdisplay.php?f=10)
-   -   GMP For Delphi (https://www.mersenneforum.org/showthread.php?t=3360)

amcfarlane 2004-12-09 00:09

Ah - That's what it is - I was wondering why I couldn't up/down load the pdfs... :)

Hopefully it's of some use - just remember it's not going to be as fast as a native C version due to the overhead of preping each call, but it works for me :)

Mystwalker 2004-12-09 16:19

I've just uploaded those files to my webspace:

[url]http://www.mystwalker.de/gmpdelphi[/url]

If you send me the documentation, I can put it up as well.

Pierre Levy 2005-02-11 17:06

I am new in Delphi and I do not understand why the folowing console prog (using GMP) work :

program EssaiGmp1;

{$APPTYPE CONSOLE}

uses
ShareMem, SysUtils, GMP;
var
p : mpz_t;
s : AnsiString;
a, e : cardinal;
begin
Writeln('Valeur de a :');
readln(a);
Writeln('Valeur de e : ');
Readln(e);
mpz_init(p);
mpz_ui_pow_ui(p,a,e);
s:=mpz_get_str(nil,10,p);
writeln('resultat : ',s);
mpz_clear(p);
readln
end.

but the Windows corresponding prog do not work :

unit EssaiGmpWin1;

interface

uses
ShareMem, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Eda: TEdit;
Ede: TEdit;
ButCalc: TButton;
LabResult: TLabel;
ButFin: TButton;
procedure ButFinClick(Sender: TObject);
procedure ButCalcClick(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;

var
Form1: TForm1;
implementation
{$R *.dfm}
uses GMP;
procedure TForm1.ButFinClick(Sender: TObject);
begin
application.Terminate;
end;

procedure TForm1.ButCalcClick(Sender: TObject);

var
a,e : Cardinal;
s : AnsiString;
p : mpz_t;
begin

a:=StrToInt(Eda.Text);
e:=StrToInt(Ede.Text);
mpz_init(p);
mpz_ui_pow_ui(p,a,e);
s:=mpz_get_str(nil,10,p);
LabResult.Caption:=s;
mpz_clear(p);
end;

end.

I am French and my English is poor.

Thanks for any help.

Pi


All times are UTC. The time now is 22:32.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.