C# String to Float -


when convert string float answer plus bunch of junk decimals. how fix this? floats error i'm seeing?

string myfloat = "1.94"; float f = float.parse(myfloat); 

it needs float database reasons ...

by junk mean 1.94 turns into: 1.94000005722046

you can change double more accurate representation if need cannot fix this how floats represented in computers. if use decimal data type exact representation.

string myfloat = "1.94"; decimal f = decimal.parse(myfloat); 

and conversion double when store database. still noise in database. way sure rid of use numeric in database.


Comments

Popular posts from this blog

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -