VBScript Math
References
Abs Function
Atn Function
Cos Function
Exp Function
Int, Fix Function
Log Function
Rnd Function
Sgn Function
Sin Function
Sqr Function
Tan Function
Returns the absolute value of a number.
Abs(number)
Returns the arctangent of a number.
Atn(number)
Returns the cosine of an angle.
Cos(number)
Returns e (the base of natural logarithms) raised
to a power.
Exp(number)
Returns the integer portion of a number.
Int(number)
Fix(number)
Returns the natural logarithm of a number.
Log(number)
The number argument can be any valid numeric expression greater than 0.
Returns a random number.
Rnd[(number)]
The number argument can be any valid numeric
expression.
Returns an integer indicating the sign of a number.
Sgn(number)
The number argument can be any valid numeric
expression.
Returns the sine of an angle.
Sin(number)
The number argument can be any valid numeric
expression that expresses an angle in radians.
Returns the square root of a number.
Sqr(number)
The number argument can be any valid numeric
expression greater than or equal to 0.
Returns the tangent of an angle.
Tan(number)
The number argument can be any valid numeric
expression that expresses an angle in radians.
The following nonintrinsic math functions can be derived
from the intrinsic math functions:
|
Function |
Derived equivalents |
|
Secant |
Sec(X) = 1 / Cos(X) |
|
Cosecant |
Cosec(X) = 1 / Sin(X) |
|
Cotangent |
Cotan(X) = 1 / Tan(X) |
|
Inverse Sine |
Arcsin(X) = Atn(X / Sqr(-X
* X + 1)) |
|
Inverse Cosine |
Arccos(X) = Atn(-X / Sqr(-X
* X + 1)) + 2 * Atn(1) |
|
Inverse Secant |
Arcsec(X) = Atn(X / Sqr(X *
X - 1)) + Sgn((X) -1) * (2 * Atn(1)) |
|
Inverse Cosecant |
Arccosec(X) = Atn(X / Sqr(X
* X - 1)) + (Sgn(X) - 1) * (2 * Atn(1)) |
|
Inverse Cotangent |
Arccotan(X) = Atn(X) + 2 *
Atn(1) |
|
Hyperbolic Sine |
HSin(X) = (Exp(X) -
Exp(-X)) / 2 |
|
Hyperbolic Cosine |
HCos(X) = (Exp(X) +
Exp(-X)) / 2 |
|
Hyperbolic Tangent |
HTan(X) = (Exp(X) -
Exp(-X)) / (Exp(X) + Exp(-X)) |
|
Hyperbolic Secant |
HSec(X) = 2 / (Exp(X) +
Exp(-X)) |
|
Hyperbolic Cosecant |
HCosec(X) = 2 / (Exp(X) -
Exp(-X)) |
|
Hyperbolic Cotangent |
HCotan(X) = (Exp(X) +
Exp(-X)) / (Exp(X) - Exp(-X)) |
|
Inverse Hyperbolic Sine |
HArcsin(X) = Log(X + Sqr(X
* X + 1)) |
|
Inverse Hyperbolic Cosine |
HArccos(X) = Log(X + Sqr(X
* X - 1)) |
|
Inverse Hyperbolic Tangent |
HArctan(X) = Log((1 + X) /
(1 - X)) / 2 |
|
Inverse Hyperbolic Secant |
HArcsec(X) = Log((Sqr(-X *
X + 1) + 1) / X) |
|
Inverse Hyperbolic Cosecant |
HArccosec(X) = Log((Sgn(X)
* Sqr(X * X + 1) +1) / X) |
|
Inverse Hyperbolic
Cotangent |
HArccotan(X) = Log((X + 1)
/ (X - 1)) / 2 |
|
Logarithm to base N |
LogN(X) = Log(X) / Log(N) |
|
Arithmetic |
Comparison |
Logical |
|
Exponentiation (^) |
Equality (=) |
Not |
|
Negation (-) |
Inequality (<>) |
And |
|
Multiplication and division
(*, /) |
Less than (<) |
Or |
|
Integer division (\) |
Greater than (>) |
Xor |
|
Modulus arithmetic (Mod) |
Less than or equal to (<=) |
Eqv |
|
Addition and subtraction (+,
-) |
Greater than or equal to (>=) |
Imp |
|
String concatenation (&) |
Is |
& |
Each Variant subtype has a specific range of allowed
values:
|
Subtype |
Range |
|
Byte |
0 to 255. |
|
Boolean |
True or False. |
|
Integer |
-32,768 to 32,767. |
|
Long |
-2,147,483,648 to
2,147,483,647. |
|
Single |
-3.402823E38 to
-1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive
values. |
|
Double |
-1.79769313486232E308 to
-4.94065645841247E-324 for negative values; 4.94065645841247E-324 to
1.79769313486232E308 for positive values. |
|
Currency |
-922,337,203,685,477.5808
to 922,337,203,685,477.5807. |
|
Date |
January 1, 100 to December
31, 9999, inclusive. |
|
Object |
Any Object
reference. |
|
String |
Variable-length strings may
range in length from 0 to approximately 2 billion characters. |
Any expression that can be evaluated as a number. Elements
of the expression can include any combination of keywords, variables,
constants, and operators that result in a number.