Issue with formatting floats with trailing zeros [duplicate]

This question already has an answer here: Is floating point math broken? 31 answers I want to save some numbers in a text file. I need to save the numbers in .18f format. The numbers are given as int‘s and must be converted to floats, as shown below, before being stored. unit and factor are […]