after one delphi session every one of my single floats has been saving into a wordpad as this weird 2.73500000000000E+0003
2.00000000000000E+0002 notation, same goes with printing is there any way to reverse this ?

not sure wither this applies to Delphi or not , but in pascal we usually use this command to print the float in normal notation
where y represents the float
x represents the number of digits for integer part of the float
z represents the number of digits for fractional part of the float
the output will look like this : 65.22
I don't know how to write the float to a text file with the normal notation

Edited 6 Years Ago by belthazor: syntax errors


In Delphi, you can almost transform any data type to string through some built-in functions. For float variables, there is FloatToStr, FloatToStrF. In your case, I think the second one fits better.

function FloatToStrF(Value: Extended; Format : TFloatFormat; Precision, Digits : Integer) : String; - for more info, check Delphi's help


procedure SomeProc;
var sTemp : String;
     aValueToPrint : Float;
     aValueToPrint := 23.32543123;
     sTemp := StrToFloatF(aValueToPrint, , ffGeneral, 15, 2); //the output is 23.33


This article has been dead for over six months. Start a new discussion instead.