View Single Post
  #957  
Old 31-10-2014, 20:45
Dante1995 Dante1995 is offline
Banned
 
Join Date: Feb 2014
Location: Black Hole
Posts: 297
Thanks: 116
Thanked 481 Times in 162 Posts
Dante1995 is on a distinguished road
just remove the round to get the decimal




Code:

Function NumToStr(Float: Extended): String;
Begin
  Result:= Format('%.3n', [Float]); StringChange(Result, ',', '.');
  while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do
  SetLength(Result, Length(Result));
End;

Function MbOrTb(Byte: Extended): String;
begin
if Byte < 1024 then Result:= NumToStr(Byte) + ' MB' else
  if Byte/1024 < 1024 then Result:= NumToStr((Byte/1024*100)/100) + ' GB' else
     Result:= NumToStr(((Byte/(1024*1024))*100)/100) + ' TB'
end;
18600 mb = 18.164 gb

Last edited by Dante1995; 31-10-2014 at 20:58.
Reply With Quote