I have a code, and I do not understand it. I am developing an application which precision is very important. but it does not important for .NET, why? I don’t know.
double value = 3.5;
MessageBox.Show((value + 1 * Math.Pow(10, -20)).ToString());
but the message box shows: 3.5
Please help me, Thank you.
You can have precision, but it depends on what else you want to do. If you put the following in a Console application:
You will get
But Note that The
Powfunction, like almost everything in the Math class, only takes doubles:So you cannot take the Sine of a decimal (other then by converting it to double)
Also see this question.