Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi double to Integer (https://www.delphipraxis.net/11308-double-integer.html)

Sidores 4. Nov 2003 08:19


double to Integer
 
HI,
Wie kann man ein double in einen Integer umwandel?

Danke

Luckie 4. Nov 2003 08:24

Re: double to Integer
 
Einfach zuweisen. Wenn du kontrollieren wills, was mit den Nachkommastellen passiert, dann kuck dir mal Trunc, Round, Ceil und Floor an.

Phoenix 4. Nov 2003 08:24

Re: double to Integer
 
Da double eine fliesskommazahl ist, am einfachsten mit

Delphi-Quellcode:
int := round(dbl);

Sharky 4. Nov 2003 08:26

Re: double to Integer
 
Hai Sidores,

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
 test1  : Double;
 test2  : Integer;
begin
 test2 := Trunc(test1);
 test2 := Round(test1);
end;
[Edit]Das Luckie und der Feuervogel waren wohl schneller[/edit]

Sidores 4. Nov 2003 08:37

Re: double to Integer
 
Danke für die schnelle Antwort


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:52 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz