In this lesson, we’ll take a look at three numeric functions: SQR, INT, and Round. In a later lesson, we’ll take a look at more numeric functions.
The Sqr function
The Sqr function returns the square root of a number. This function takes a Double type argument and returns a Double implying that you can work with large numbers using the Sqr function.
Example
Print Sqr(9)
Output: 3
The Int function
The Int function returns the greatest integer less than or equal to the number. It discards the decimal part of a number. This function greatly helps in truncating the decimal part of a number. But be aware that in case of a negative decimal number, it returns a rounded up value, resulting in an increment of integer part as it’s shown in example 3 below.
Example
Print Int(2.9)
Output: 2
Example
Print Int(5)
Output: 5
Example 3
Print Int(-5.8)
Output: -6
The Round function
The Round function rounds a numeric value.
Syntax
Round(Number, [no. of digits after decimal]
If the second parameter is omitted, the number is rounded to a whole number.
Example
Print Round(5.8)
Output: 6
Example
Print Round(5.8, 1)
Output: 5
Example
Print Round(5.4568, 2)
Output: 5.46
Later in the series, we’ll take a look at more numeric functions.