Feb 10, 2008 #1 Han777 Programmer Joined Dec 12, 2007 Messages 19 What's the most direct way to convert a double to an integer?
Feb 10, 2008 Thread starter #2 Han777 Programmer Joined Dec 12, 2007 Messages 19 More specifically to produce the floor or ceiling of a double and save the result to an integer. Upvote 0 Downvote
Feb 10, 2008 #3 Glenn9999 Programmer Joined Jun 19, 2004 Messages 2,312 Location US won't trunc work? Code: var a: double; b: integer; begin a := 3.14159; b := trunc(a); label1.caption := IntToStr(b); end; If not, you'll need to be a whole lot more specific as to what you are looking for. Upvote 0 Downvote
won't trunc work? Code: var a: double; b: integer; begin a := 3.14159; b := trunc(a); label1.caption := IntToStr(b); end; If not, you'll need to be a whole lot more specific as to what you are looking for.
Feb 10, 2008 #4 whosrdaddy Vendor Joined Mar 11, 2003 Messages 4,231 Location BE check the Math unit for functions floor and ceil. depends on what delphi version you have though... ----------------------------------------------------- What You See Is What You Get Never underestimate tha powah of tha google! Upvote 0 Downvote
check the Math unit for functions floor and ceil. depends on what delphi version you have though... ----------------------------------------------------- What You See Is What You Get Never underestimate tha powah of tha google!