Advanced Math Operations

Every language has its own set of keywords for common math operations such as rounding and trigonometry. In .NET languages, many of these keywords remain. However, you can also use a centralized Math class that's part of the .NET framework. This has the pleasant side effect of ensuring that the code you use to perform mathematical operations can easily be translated into equivalent statements in any .NET language with minimal fuss.
To use the math operations, you invoke the methods of the System.Math class. These method are static, which means they are always available and ready to use.

The following code snippet shows some sample calculations that you can perform with the math class:

double vMyValye;
vMyValue=Math.Sqrt(81);
vMyValue=Math.Round(42.889,2);
vMyValue=Math.Abs(-10);
VMyValue=Math.Log(24.212);
VMyValue=Math.PI;

No comments:

Post a Comment