AviSynth Syntax - Numeric functions

Numeric functions provide common mathematical operations on numeric variables.

Returns the maximum value of a set of numbers.
Examples:
Max (1, 2) = 2
Max (5, 3.0, 2) = 5.0
Returns the minimum value of a set of numbers.
Examples:
Max (1, 2) = 1
Max (5, 3.0, 2) = 2.0
Multiplies two ints (m, n) and divides the product by a third (d) in a single operation, with 64 bit intermediate result. The actual equation used is (m * n + d / 2) / d .
Examples:
MulDiv (1, 1, 2) = 1
MulDiv (2, 3, 2) = 3
Converts from float to int (round down on any fractional amount).
Examples:
Floor(1.2) = 1
Floor(1.6) = 1
Floor(-1.2) = -2
Floor(-1.6) = -2
Converts from float to int (round up on any fractional amount).
Examples:
Ceil(1.2) = 2.0
Ceil(1.6) = 2.0
Ceil(-1.2) = -1
Ceil(-1.6) = -1
Converts from float to int (round off to nearest integer).
Examples:
Round(1.2) = 1
Round(1.6) = 2
Round(-1.2) = -1
Round(-1.6) = -2
Returns the sine of the argument (assumes it is radians).
Examples:
Sin(Pi()/4) = 0.707
Sin(Pi()/2) = 1.0
Returns the cosine of the argument (assumes it is radians).
Examples:
Cos(Pi()/4) = 0.707
Cos(Pi()/2) = 0.0
Returns the value of the "pi" constant (the ratio of a circle's perimeter to its diameter).
Examples:
d = Pi()    # d == 3.141593
Returns the natural (base-e) exponent of the argument.
Examples:
Exp(1) = 2.718282
Exp(0) = 1.0
Returns the natural (base-e) logarithm of the argument.
Examples:
Log(1) = 0.0
Log(10) = 2.30259
Log(Exp(1)) = 1.0
Returns "base" raised to the power indicated by the second argument.
Examples:
Pow(2, 3) = 8
Pow(3, 2) = 9
Pow(3.45, 1.75) = 8.7334
Returns the square root of the argument.
Examples:
Sqrt(1) = 1.0
Sqrt(2) = 1.4142
Returns the absolute value of its argument (returns float for float, integer for integer).
Examples:
Abs(-3.8) = 3.8
Abs(-4) = 4
Returns the sign of the value passed as argument (1, 0 or -1).
Examples:
Sign(-3.5) = -1
Sign(3.5) = 1
Sign(0) = 0
Converts from float to int (round towards zero).
Examples:
Int(1.2) = 1
Int(1.6) = 1
Int(-1.2) = -1
Int(-1.6) = -1
Returns the fractional portion of the value provided.
Examples:
Frac(3.7) = 0.7
Frac(-1.8) = -0.8
Converts int to float.
Examples:
Float(4) = 4.0
Float(4) / 3 = 1.333 (while 4 / 3 = 1 , due to integer division)
Returns a random integer value. All parameters are optional.
Typically, this function would be used with the Select function for random clips.
Examples:
Select(Rand(5), clip1, clip2, clip3, clip4, clip5)
Interpolates the Y value at point X using the control points x1/y1, ... There have to be at least 2 x/y-pairs. The interpolation can be cubic (the result is a spline) or linear (the result is a polygon).
Examples:
Spline(5, 0, 0, 10, 10, 20, 0, false) = 5
Spline(5, 0, 0, 10, 10, 20, 0, true) = 7

Back to Internal functions.

$Date: 2008/04/20 19:07:34 $