mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Software

Reply
 
Thread Tools
Old 2004-12-09, 00:09   #12
amcfarlane
 
amcfarlane's Avatar
 
Nov 2004
UK

2·19 Posts
Default

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 :)
amcfarlane is offline   Reply With Quote
Old 2004-12-09, 16:19   #13
Mystwalker
 
Mystwalker's Avatar
 
Jul 2004
Potsdam, Germany

3·277 Posts
Default

I've just uploaded those files to my webspace:

http://www.mystwalker.de/gmpdelphi

If you send me the documentation, I can put it up as well.
Mystwalker is offline   Reply With Quote
Old 2005-02-11, 17:06   #14
Pierre Levy
 

41·61 Posts
Default

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
  Reply With Quote
Reply

Thread Tools


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


Fri Aug 6 22:07:34 UTC 2021 up 14 days, 16:36, 1 user, load averages: 3.54, 3.14, 2.86

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

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.