Autor Beitrag
Zemke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 83

WIN XP
Delphi 4 Professionell
BeitragVerfasst: Mo 23.02.04 17:06 
Hallo,

habe das Problem, daß ich in einer Formel eine Hochrechnung einbauen muß.

Beispiel: 2 hoch 2 = 4

Wie muß ich daß "Hoch"-Zeichen in der Programmierung deklarieren?

... soll später in eine Zinsformel eingebaut werden.

Gruß

Rainer
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mo 23.02.04 17:07 
Hallo

gugg dir die Funktion power in der Hilfe an.

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Zemke Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 83

WIN XP
Delphi 4 Professionell
BeitragVerfasst: Mo 23.02.04 17:13 
Titel: power
Danke für die Antwort.

Ich kann mit der Funktion aber nichts anfangen, da keine Beispiele gezeigt werden.
Ich habe davon keine Ahnung.

Gruß
Rainer
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Mo 23.02.04 17:21 
Hallo

was ist denn daran so schwer? die übergebenen Variablen heißen doch schon Base und exponent?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
  //2 hoch 3
  label1.Caption:=formatfloat('0.000',power(2,3));
  //4 hoch 1,25
  label2.Caption:=formatfloat('0.000',power(4,1.25));


das formatfloat ist nur für die Umwandlung der Zahl (extended-typ) in einen String

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Mo 23.02.04 17:22 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
uses ...,math;

...

var f:extended;

...

f:=power(2,5);


f erhält dann den Wert 2 hoch 5 = 32
obbschtkuche
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mo 23.02.04 18:11 
Solange der Exponent aber eine ganzzahlige Konstante ist, rate ich von Power ab, da es langsamer ist.