Reducing decimal places in Delphi

Posted by Hendriksen123 on Stack Overflow See other posts from Stack Overflow or by Hendriksen123
Published on 2010-03-23T15:52:53Z Indexed on 2010/03/23 16:33 UTC
Read the original article Hit count: 324

Filed under:
|
|
|
|

I am storing a list of numbers (as Double) in a text file, then reading them out again.

When I read them out of the text file however, the numbers are placed into the text box as 1.59993499 for example, instead of 1.6.

  AssignFile(Pipe, 'EconomicData.data');
  Reset(Pipe);
  For i := 1 to 15
    Do ReadLn(Pipe, SavedValue[i]);
  CloseFile(Pipe);
  Edit1.Text := FloatToStr(SavedValue[1]);

The text in Edit1.text, from the code above, would be 1.59999... instead of the 1.6 in the text file. How can i make it so the text box displays the original value (1.6)?

© Stack Overflow or respective owner

Related posts about delphi

Related posts about double