Mathematical Functions

Mathematical functions allow you to perform a variety of operations on number values in your scripts.  Here are some of the most commonly used math functions:

Abs

intResult = Abs(intNumber)

The Abs function takes a number and returns its absolute value.

 

Exp

intResult = Exp(intNumber)

The Exp function takes a numeric value and returns e (the base of natural logarithms) raised to a power.

 

Hex

intResult = Hex(intNumber)

The Hex function returns a string value containing the value of an argument converted to hexadecimal format.  If the argument is a fractional value, it is rounded to the nearest whole number before the function returns the string.

 

Int

intResult = Int(intNumber)

The Int function returns the whole number portion of a numeric argument.  If the argument is a negative value, it returns the first integer value that is less than or equal to the argument.

 

Fix

intResult = Fix(intNumber)

The Fix function returns the whole number portion of a numeric argument.  If the argument is a negative value, it returns the first integer value that is greater than or equal to the argument.

 

Rnd

intResult = Rnd[(switch)]

The Rnd function returns a random number.  Switch indicates how the random number will be determined.  If switch is a positive number, the next random number in the sequence should be returned.  Before calling this function, you should initialize it by using the Randomize statement.

 

Sgn

intResult = Sgn(intNumber)

The Sgn function returns a numeric vale representing the sign of a number argument.  It returns 1 if the numeric value is > 0, 0 if = 0, and -1 if < 0.

 

Sqr

intResult = Sqr(intNumber)

The Sqr function returns the square root of a numeric argument.

 

Sin

intResult = Sin(intNumber)

The Sin function returns the sine of an angle.

 

Tan

intResult = Tan(intNumber)

The Tan function returns the tangent of an angle.

< Back to ASP Scripts