Skip to content

Instantly share code, notes, and snippets.

@Immerseit
Created August 22, 2012 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Immerseit/3426121 to your computer and use it in GitHub Desktop.
Save Immerseit/3426121 to your computer and use it in GitHub Desktop.
Unexpected (maybe?) result hided behind bad use of "float"
void Main()
{
string item = "134217963";
ValueFlags vf = new ValueFlags();
float _value;
if (float.TryParse(item, out _value))
{
vf.Value = _value.ToString();
}
Console.WriteLine("{0}", item);
Console.WriteLine("{0}", vf.Value);
Console.WriteLine("{0}", double.Parse(vf.Value));
}
public class ValueFlags
{
public string Value { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment