Mathematical Functions (Math Class) in Visual Basic. Net

Mathematical Functions (Math Class) in Visual Basic. Net

Visual Basic. Net (VB.NET) support the use of many different functions. One of this group of functions is the Math Class. Mathematical Functions or Math Class is a group of built-in functions that takes on some prominent math operations.

Some Math Class functions supported by VB.NET:

  1. Abs(n)
    (n) can take any decimal or double value. This function returns the absolute value of (n).
  2. Cos(n)
    (n) can be any decimal or double value (angle). This function returns the cosine of the value (n).
  3. Floor(n)
    (n) can be any decimal or double value. This function returns the largest integer less than or equal to the value (n).
  4. Log(n)
    (n) can be any decimal or double value. This function returns the natural (base e) logarithm of the value (n).
  5. Max(n, m)
    Both (n) and (m) can be any decimal or double value. This function returns the larger number between the values (n) and (m).
  6. Min(n, m)
    Both (n) and (m) can be any decimal or double value. This function returns the smaller number between the values (n) and (m).
  7. Pow(n, m)
    Both (n) and (m) can be any decimal or double value. This function returns the value of (n) raised to the power of (m).
  8. Sin(n)
    (n) can be any decimal or double value. This function returns the sine of the value (n).
  9. Sqrt(n)
    (n) can be any decimal or double value. This function returns the square root of the value (n).
  10. Tan(n)
    (n) can be any decimal or double value. This function returns the tangent of the value (n).

Related: Select Case Structure in Visual Basic . NET

Math Class functions code example:

Output:

Application Window:

Output1 Math Class

Natural logarithm of 100:

Output2 Math Class

Output3 Math Class

 

 

 

 

 

 

 

 

 

 

 

 

Square root of 78:

Output4 Math Class

Output5 Math Class

 

 

 

 

 

 

 

 

 

 

 

 

Related: Operators in Visual Basic . NET

Some further Math Class functions:

  1. Acos(n)
    (n) can take a decimal or double value. This function returns the angle whose cosine is the (n) value. The value of -1 <= n >= 1
  2. Asin(n)
    (n) can take a decimal or double value. This function returns the angle whose sine is the (n) value. The value of -1 <= n >= 1
  3. Atan(n)
    (n) can take a decimal or double value. This function returns the angle whose tangent is the (n) value.
  4. Ceiling(n)
    (n) can take any decimal or double value. This function returns the smallest integral value that is greater than or equal to the value of (n).
  5. Log10(n)
    (n) can be any decimal or double value. This function returns the base 10 logarithm of the value (n).
  6. Sign(n)
    (n) can be any decimal or double value. This function returns the sign of the value (n).
  7. Exp(n)
    (n) can be any decimal or double value. This function returns the value of (e) raised to the power of (n)

Write your own codes for these functions and let us know if you have any questions. Moreover; post your comments and stay tuned for further tutorials @ www.codejow.com

Previous Web Hosting & types & some popular Web Hosting Solutions
Next What is Interface in Java? Usage and Implementation

About author

Bahonar Javid
Bahonar Javid 43 posts

<p>* Computer Application Student<br /> * Co-Founder of www.codejow.com<br /> * Love to code and Learn new languages<br /> * Enjoy playing football</p>

View all posts by this author →

You might also like