@Jeremy Grand: format('%18.18f', [myfloat] ) gave me the same result as 
FloatToStrF( val,
ffFixed, 18, 18); 
:(

@Doug Hale: Yes, I do understand the significance of the trailing zeros may 
mean, but I'm sure in my case I don't need them :)

@Raymond C Chow: Thx for the improvement, as the time being I'll use your 
improvement until I found what I really need. Oh, and I also modified it a bit 
since in my case there are probabilities the resulted string will be converted 
back into float, so FloatToStrNP(1) won't look very nice (the output is "1,").

function FloatToStrNP(val : extended):string;
var
  a : integer ;
  txt : string ;
begin
  a := Trunc(val) ;
  if a = val then Result := IntToStr(a)
  else
  begin
    txt:= FloatToStrF(val, ffFixed, 18, 18);
    for a:= Length(txt) downto 1 do if (txt[a]<>'0') then Break;
    Result:= Copy(txt, 1, a);
  end ;
end;

---------------------

CoolKid K-Qha

http://kha.web.id

---------------------
 
         
        
        








        


        
        


      

Reply via email to