# 05-Math Functions

0
1708

This tutorial is all about Math Functions.
The System.Math class provides methods such as trigonometric, logarithmic, and other common mathematical functions that are used in the Visual Basic program.

Feel free to visit this site msdn.microsoft.com to see the lists of methods of the System.Math class.

In programming, mathematical functions are very useful because often times we need to deal with mathematical concepts in programming such as mathematical logic, 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 .

Example:

The numeric functions are Sqrt, Int, Abs, Exp, Round and Log.

• Sqrt computes the square root of a number.
example:
Sqrt(36)=6
Sqrt(49)=7

• 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.
example:
Int(3.3)=3
Int(5.5)=5
Int(-5.7)= -6

•  Abs returns the absolute value of a number.
example:
Abs(-9) = 9
Abs(9)= 9

• Exp of number x is the value of ex. NOTE: e is a mathematical constant whose value is approximately 2.71828.
example:
Exp(1)=2.71828
Exp(2) = 7.38905609893065

• Round rounds up a number to a certain number of decimal places.
example:
Round (8.2567, 2) =8.26

• Log returns the natural Logarithm of a number.
example,
Log10(99.3)=1.99694924849538