Math Functions

The following Visual Basic commands have been tested with IDEA v9 and appear to be functioning properly. I have added some examples where possible on their use.

Abs()

Returns the absolute value of a specified number.

Atn()

Calculates the value containing the angle whose tangent is the specified number.  The result is a double type.  The example below calculates pi.

Comparison Operators

The comparison operators are used to perform comparisons between expressions. A comparison expression is actually a logical expression, evaluating to True or False depending on the data and operator used.

= Equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
<> Not equal to

Cos()

Calculates the cosine of a specified angle.  It returns a double value.

Exp()

Returns a number containing the base of a natural logarithm (e) raised to the specified power.  The return value is a double type.

Fix()

The Fix() and Int() functions both remove the fractional part of a number and returns the restulting integer.  The difference between the two is that if a number is negative Int() returns the first negative integer less than or equal to the number while Fix returns the first negative integer greater than or equal to the numer.

Int()

The Fix() and Int() functions both remove the fractional part of a number and returns the restulting integer.  The difference between the two is that if a number is negative Int() returns the first negative integer less than or equal to the number while Fix returns the first negative integer greater than or equal to the numer.

Log()

This function calculates the natural log (base e) of the specified number.  The value that is returned is of a type double.  To see an example of how to calculate the log of a base 10 see the snippets section.

Logical Operators

VBA has six logical operators:

Randomize()

This is used to create a seed value for the Rnd() function, this helps vary the output of the random seed.  You would place a number as the seed, one good option is to use the Second(Now()), this would make sure that your seed is different every time you run the script.

Pages