Autor Beitrag
Biarchiv
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: Do 22.12.05 20:31 
Hallo,

ich will/muss lange Zahlen berechnen können.

Das Problem beim Integer ist ab 8 Stellen schluss.
int64 geht nicht zum rechnen in Delphi5.

Mit welcher variable oder so kann ich ZB:

100000000 * 1000000000 =

oder

10000000000 + 90000000000000000 =

berechnen.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 22.12.05 20:41 
Mit hauseigenen Mitteln kann man mit Delphi da nichts machen. Schau mal bei Torry, ob du da ne Unit für große Zahlen findest. Evtl. auch hier im Forum, hab da aber auf die Schnelle nichts passendes gefunden.

_________________
We are, we were and will not be.
JayK
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1013



BeitragVerfasst: Do 22.12.05 21:09 
versuch es mal mit weglassen der Nullen und merke dir den Exponenten.
Also aus 923000000000000000 mach 923 und 10^15. Zum Bsp ein Record
ausblenden Delphi-Quelltext
1:
2:
3:
4:
record großeZahl
  Exponent: Integer;
  RestDerZahl: Integer; // mir fällt jetzt nich ein, wie man das Mathematisch nennen sollte :P
end;


dann ist 923000000000000000 so zu haben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
var x: großeZahl;
{...}
x.Exponent := 15;
x.RestDerZahl := 923;

Weiß jetzt nich, wie man damit Rechnen könnte, aber man könnte sich ja was einfallen lassen ;)

Aber das ist nur eine Idee, ich weiß nicht, ob sich das so umsetzen lässt :niweiss:
Biarchiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: Do 22.12.05 21:40 
Hey,

an sowas hab ich auch schon gedacht nur ist das ein Beispiel.
Statt nullen können allmögliche Zahlen stehen.

Ich wolte schon jede einzelne Stelle rausnehmen und manuell es Rechnen lassen.
Aber was auf den Papier 2 Klasse ist ist hier etwas schwieriger...
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 22.12.05 21:53 
Such mal bei Torry nach IntegerASM. Das sollte ziemlich genau das sein, was du suchst.

_________________
We are, we were and will not be.
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Do 22.12.05 21:59 
Bevor du auf eine Bibliothek umsteigst:
* Geht es vielleicht um eine ganz spezielle Rechnung (wie lautet diese)?
* Reicht eventuell eine Fliesskommazahl?
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Fr 23.12.05 00:08 
Weiterhin gab's von mir hier mal ne Unit BigNum, die du sicherlich über die Forensuche finden solltest.
Weiterhin hat negaH (Hagen Reddmann, DPler) mal ne Unit BigInt geschrieben, die im Gegensatz zu meiner ASM-Optimiert ist.

Interessant wäre in dieser Hinsicht aber immer noch die eigentliche Anwendung, weil es für spezielle Berechnungen immer auch optimierte Bibliotheken gibt.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.