Back to index

Math functions and constants:

Trigonometric functions:

Function ACos(expression) As Floating

Calculates the principal value of the inverse cosine of a number.

Where expression is a value between - 1 and +1 inclusive.
Returns result in radians, a value between 0 and pi.

Function ASin(expression) As Floating

Calculates the principal value of the inverse sine of a number.

Where expression is a value between -1 and +1.
Returns result in radians, a value between -pi/2 and +pi/2.

Function ATan(expression) As Floating

Calculates the principal value of the inverse tangent of a number.

Where expression is a value between -infinity and +infinity.
Returns result in radians, a value between -pi/2 and +pi/2.

Function Cos(expression) As Floating

Calculates the cosine of a number.

Where expression is a value in radians.
Returns cosine of a number.

Function DtoR(expression) As Floating

Converts degrees to radians.

Where expression is a value in degrees.
Returns expression converted to radians.

Function Sin(expression) As Floating

Calculates the sine of a number.

Where expression is a value in radians.
Returns sine of a number.

Function RtoD(expression) As Floating

Converts radians to degrees.

Where expression is a value in radians.
Returns expression converted to degrees.

Function Tan(expression) As Floating

Calculates the tangent of a number.

Where expression is a value in radians.
Returns tangent of a number.

Pi

Constant. Returns value of PI

Powers, roots and logs:

Function Exp(expression) As Floating

Calculates the value of e to the power of x.

Where expression is a the power to which e is to be raised.
Returns result the value of e to the power of x.

Function Ln(expression) As Floating

Calculates the natural logarithm of a number.

Where expression is any number
Returns natural logarithm of a number.

Function Log(expression) As Floating

Calculates the logarithm to base 10 of a number.

Where expression is any number
Returns logarithm to base 10 of a number.

Function Log2(expression) As Floating

Calculates the logarithm to base 2 of a number.

Where expression is any number
Returns logarithm to base 2 of a number.

Function Sqr(expression) As Floating

Calculates the square root of a number.

Where expression is any number
Returns square root of a number.

Integer conversion and rounding:

Function Abs(expression) As Floating

Returns the absolute value of a number.

Where expression is any number.
Returns the absolute value of a number.

Function Frac(expression) As Floating

Calculates the fractional part of a number. The fractional part is that after a decimal point. Truncation is toward zero, so that Frac(2.4)=0.4, Frac(2)=0, Frac(-1)=0, Frac(-1.4)=0.4.

Where expression is the number whose fractional part is required.
Returns the fractional part of a number.

Function Int(expression) As Integer

Calculates the integer part of a number. The integer part is that before a decimal point. Truncation is toward zero, so that int(2.4)=2, int(2)=2, int(-1)=-1, int(-1.4)=-1, int(-1.999)=-1.

Where expression is the number whose integer part is required.
Returns the integer part of a number.

Function Round(expression) As Integer

Rounds to a specified number of decimal places. The function rounds a number to a given number, n, of decimal places. Rounding may be thought of as multiplying the number by 10 to the power of n, rounding to the nearest integer, and then dividing the result by 10 to the power of n and returning that as the answer. In the process of rounding, numbers ending with .5 are rounded away from zero, so that 1.5 becomes 2, 2.5 becomes 3, - 1.5 becomes - 2, etc.

Where expression is the number to be rounded
aDecimalPlaces is the number of decimal places to round to: must be zero or positive
Returns rounded number.

Random number generation:

Sub Randomize [ (number) ]

number - Optional. Valid numeric expression.
Randomize uses specified number to initialize the Rnd function's random-number generator, giving it a new seed value. If you omit number, the value returned by the system timer is used as the new seed value.

Function Rnd [ (number) ] As Floating

If number is specified:
- It generates and returns a random integer value from 0 to number.
If number is omitted:
- It generates and returns a random floating value from 0 to 1.

Remark:
Repating call of Rnd function generates a stream of uniformly distributed pseudo-random numbers.

Example:

    Randomize ' Initialize random number generator
    For i = 1 to 10
       Print Rnd(100) ' prints random value beetween 0 and 99 (inclusive)
    Next
  

Information functions:

Function IsFinite(expression) As Integer

Determines whether a value is finite.

Where expression is any number to be checked.
Returns True, if expression is finite; false, otherwise.

Function IsInfinite(expression) As Integer

Determines whether a value is infinite.

Where expression is any number to be checked.
Returns True, if expression is infinite; false, otherwise.

Function IsNaN(expression) As Integer

Determines whether a value is not a number.

Where expression is any number to be checked.
Returns True, if expression is not a number; false, otherwise.

Function IsZero(expression) As Integer

Detremines whether a value is zero.

Where expression is any number to be checked.
Returns True, if expression is zero; false, otherwise.

Function Sign(expression) As Integer

Returns a sign of expression

Where expression is any number to be checked.
Returns -1, if expression less then zero, +1 if expression greater then zero.



Copyright (c) 2000-2006 by Smartphoneware. All rights reserved.