Why does Convert.ToString format doubles in this way?
c#
Solution
If you want a specific format, then you need to tell it what you want via the parameter. The available standard formats are here, or you can use custom formats. Pass your chosen format to either `ToString(format)` or `Convert.ToString(value, format)`.
Note; 1E-8 is exactly 0.00000001 - that is simply using exponential notation, i.e. this is 1×10-8
The default format is "general" which is described as:
Result: The most compact of either fixed-point or scientific notation
So yes, sometimes it will use scientific (aka exponential) notation - specifically, it will do so whenever that is shorter than the fixed-point notation. Maybe try using `.ToString("F")`
Problem
Consider the following code: ``` var rateUsed = 0.00000001; var rateUsedConvertToString = Convert.ToString(rateUsed); var rateUsedToString = rateUsed.ToString(); ``` Instead of my strings being "0.00000001", they are both "1E-08". I don't have control over the initial type of rateUsed, it is a double, and I want the exact string representation of the double. Why does this happen, and how would I get 0.00000001 as a string, if this started off as a double value?