Free Source Code and Tutorials

Custom Search

05-Math Functions

The System.Math class provide methods such as trigonometric, logarithmic, and other common mathematical functions that is used in Visual Basic program.


Feel free to visit this site 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 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 .



  1. For x As Integer = 1 To 10
  2. MsgBox(Rnd)
  3. 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.
    Int(-5.7)= -6


  •  Abs returns the absolute value of a number.
    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.
    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.
Facebook Comments
(Visited 11 times, 1 visits today)
Share this

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked * © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!

%d bloggers like this: