Effect of Double in .net

Did u feel its a best way to use double in your application.

Test the following scenario:
double a=0.3;
double b=0.1+0.1+0.1;(or)0.2+0.1;
if(a==b)
  MessageBox.Show(r u great?);
else
  MessageBox.Show(u r great!);

if u put float u wont get the  same output.


There is not only problem in using this format. but there are lot of issues and doubt  while using double datatype. So consider twice before using double in your application
Solution: We cant say it as an error. in Java also the same thing will happen. its some double precision format.
Better using decimal is a good solution.

0 comments:

Listen to nirmaln - sakara - playlist audio songs at MusicMazaa.com