Now i know to use the method of float.Parse but have bumped into a problem.
I’m parsing the string “36.360”, however the parsed float becomes 36.3600006103516.
Am i safe to round it off to the 3 decimal places or is there a better tactic for parsing floats from strings.
Obviously i’m looking for the parsed float to be 36.360.
This is due to the fact that
floatordoubleare both stored in such a way that it is a mathematical process to read the value from memory. If you want to store the value as the actual value a better choice would bedecimal.Per the MSDN Page on System.Decimal: