This tutorial is all about Math Functions.
The System.Math class provide methods such as trigonometric, logarithmic, and other common mathematical functions that is used in Visual Basic program.
In programming , mathematical functions are very useful because often times we need to deal with mathematical concepts in programming such as mathematical logics, coordinates, variables, calculations, time intervals and etc. In Visual Basic, the most common mathematical functions are Sqrt, Int, Abs, Exp, Round, Log , Sin, Cos, Tan , Rnd and Atn .
- For x As Integer = 1 To 10
- Next x
The numeric functions are Sqrt, Int, Abs, Exp, Round and Log.
- Sqrt computes the square root of a number.
- Int converts a number into an integer by truncating its decimal part and the resulting integer is the largest integer that is smaller than the number.
- Abs returns the absolute value of a number.
Abs(-9) = 9
- Exp of number x is the value of ex. NOTE: e is a mathematical constant whose value is approximately 2.71828.
Exp(2) = 7.38905609893065
- Round rounds up a number to a certain number of decimal places.
Round (8.2567, 2) =8.26
- Log returns the natural Logarithm of a number.
Readers might read also: