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

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -