types - how to set value float in C#? -


i want set 20770897 c# float type changed 20770896 ! why?

for example:

float test = 20770897; 

value automatic changed 20770896 ? please. getting id web service . these return float value not true value web service method!

the issue 1 of rounding error - because of precise way values stored under hood, noninteger types incapable of string values, , instead above or below actual value. can result in apparent errors when rounding versus truncating, , should determine use - presumably, code producing 20770896.99999... , truncating 20770896 when print it.

note errors become more frequent higher value gets. if need more accuracy, consider turning double or decimal types.


Comments

Popular posts from this blog

command line - Use qwinsta in PowerShell ISE -

java - Incorrect order of records in M-M relationship in hibernate -

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -