.net - C# issue with double number -


this question has answer here:

i have strange issue using double numbers in c# . net here test:

double my_value = 0.49; 

the problem variable value shown instead 0.48999999999999999 not need display 0.49 using math.round() function; need store value.

thank you.

welcome floating point precision. use decimal type if want more precision.

decimal my_value = 0.49m; 

if want learn more on why recommend read article - what every computer scientist should know floating-point arithmetic


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -