0 Members and 3 Guests are viewing this topic.
function FloatToInt(flt: extended): integer;begin Result := StrtoInt(FloattoStr(flt));end;
function FloatToInt(flt: extended): integer;begin Result := StrtoInt(FloattoStr(Round(flt)));end;
Code: [Select]function FloatToInt(flt: extended): integer;begin Result := StrtoInt(FloattoStr(flt));end;I forget if Round exists, but in case that gives you complications:Code: [Select]function FloatToInt(flt: extended): integer;begin Result := StrtoInt(FloattoStr(Round(flt)));end;although a floor function would be more appropriate.
function FloatToInt(flt: extended): integer;begin Result := StrtoInt(FloattoStr(flt));end;function FloatToInt(flt: extended): integer;begin Result := StrtoInt(FloattoStr(Round(flt)));end;
or trunc()?[...]Why so? It's propably the most inefficient way available to convert a float to int.
Integer is -65535 -> 65535
QuoteInteger is -65535 -> 65535Integer is -2147483648 -> 2147483647
it doesn't mess up the postion, coords in DrawText are position on the screen, not on the map, which means it will never work with drawtext.http://enesce.com/help/index.html?Functions/WorldText.htmlYou have to wait until 2.7.0 is out.
@DorkeyDear;How? :O
function FloattoInt(Flt: extended): integer;var vnt: variant;begin vnt := Flt; Result := vnt;end;
Curt.. do you seriously believe such an abomination would be more efficient than a built-in ROUND() function?
Quote from: dnmr on May 09, 2010, 03:07:00 pmCurt.. do you seriously believe such an abomination would be more efficient than a built-in ROUND() function?Uhm, well, no. but I know some types (like TVarType) require being set as a variant to be converted to another type, and just thought it was at least worth mentioning as an alternative.