Autor Beitrag
Delphi7Noob
Hält's aus hier
Beiträge: 11


D7 Ent.
BeitragVerfasst: Fr 08.07.05 19:00 
Hallo,

gibt es eine vorgegebene Funktion in Delphi die z.B. eine -3 in eine +3 umwandelt? Sozusagen das
- durch ein + ersetzt.

Viele Grüsse
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Fr 08.07.05 19:03 
Wie wär's, wenn du einfach mit -1 multiplizierst :roll:

AXMD
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: Fr 08.07.05 19:05 
In der Unit math müsste ne Funktion 'abs' oder so drin sein, die den Betrag einer Zahl ermittelt. Ansonsten kannst du dir die auch schnell selbst schreiben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
function abs(ein:real):real;
begin
  if ein<0 then
    result:=-ein
  else result:=ein;
end;

_________________
We are, we were and will not be.
Delphi7Noob Threadstarter
Hält's aus hier
Beiträge: 11


D7 Ent.
BeitragVerfasst: Fr 08.07.05 19:12 
Erstmal vielen Dank für eure schnelle Hilfe.

Die Multiplikation mit -1 ist leider nicht möglich weil die Variable auch ein positiven Wert annehmen kann.

Werds einfach selbst schreiben....Echt dumm das ich da nicht selbst drauf gekommen bin. Naja manchmal hat man halt ein Brett vorm Kopf :wink:

Viele Grüsse
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 08.07.05 19:12 
Abs ist Compiler-Magic und in Zeile 10 von System.pas deklariert :mrgreen:

_________________
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.
Heiko
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: Fr 08.07.05 19:27 
Oder so hier (brauchst die unit math):

ausblenden Delphi-Quelltext
1:
x:=x*Sign(x)