Autor Beitrag
Steini1980
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59

WIN 2000, SuSE 9.3 Pro
Delphi 6 Enterprise, Lazarus 0.9.16b, PHP (Dreamweaver MX)
BeitragVerfasst: Di 20.03.07 18:47 
Hallo, ich bin auf der Suche nach einer Funktion um einen Negativen Wert in einen Positiven umzuwandeln und umgekehrt.

Beispiel:

-5 wird +5
+2 wird -2
usw.

Sowas wird doch sicher öfter mal benötigt und ist schon im Delphi, kann jedoch nichts finden. Danke für eure Hilfe!

Gruß
Steini
Xabitire
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 114

Win Xp, Win Vista
D6 PE, D7 PE
BeitragVerfasst: Di 20.03.07 18:49 
Warum multiplizierst du deinen Wert nicht einfach mit (-1)?!

MFG

Blackbird8690
Allesquarks
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 510

Win XP Prof
Delphi 7 E
BeitragVerfasst: Di 20.03.07 19:49 
Not und dann eins addieren!
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Di 20.03.07 20:00 
oder noch was komplizierteres:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
var i:integer;
begin
  i:= 42;
  i:= -i;


:mrgreen:

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Steini1980 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59

WIN 2000, SuSE 9.3 Pro
Delphi 6 Enterprise, Lazarus 0.9.16b, PHP (Dreamweaver MX)
BeitragVerfasst: Mi 21.03.07 13:35 
Danke für die vielen Hinweise, manchmal ist die Lösung echt einfacher als man Denkt:-)