Is the precision fixed? If so, you can save it as an int which is intfinitely precise:
[code]int intfl = f*pow(10.0,DIGITS);[code]
In this case, you'd set DIGITS to 3. You'd end up with the value 776 instead of 0.776, which can easily be transformed back to your original value.
If the precision/number of digits isn't fixed, it becomes more difficult. Of course, you could ask yourself if the 2*10^-8 makes a difference...
Looks like you just want to write and store a float to file (binary representation) and then read it back again? No need to call precision(). Just ran this little test and worked fine:
The "original value" that you wrote previously was0.77600002.
Floats have a fixed set of valid values. The decimal number 0.776 is not a valid float. It lies between two valid floats: 0.77600002288818359375 (13019120 * 2-24) and 0.775999963283538818359375 (13019119 * 2-24). When you attempt to store 0.776 in a variable of type float, the compiler actually writes the nearest valid float value, which is 0.77600002288818359375 in this case.