Reputation: 279
i get the value from textbox.Text
i have the variable float _value;
that store the value from textbox
_value = float.Parse(textBox.text);
when i want to show up the _value, it will be in epsilon number. eg.
textbox.Text = 100000000;
_value
will store with 1.0E+12
i do want to _value store the real number 10000000.
thanks.
Upvotes: 0
Views: 449
Reputation: 183868
The value is stored in a binary floating point format, probably IEEE754. The difference you observed is one of textual representation, when the value is converted to a string. You can control the way the values are displayed with format specifiers, to achieve your desired output,
float f = 1000000000000;
Console.WriteLine (string.Format("{0:.#}\n", f));
formats the number as "1000000000000".
More on string.Format.
Upvotes: 2