Ugrás a fő tartalomhoz
Verzió: 15

Mathematical operators

Mathematical operators can be used with numerical values and variables. They can also be used inside of command parameters.

The following mathematical operations are implemented in Descript:

OperatorNameSyntax exampleDescription
+Summation1+2Adds numbers
-Subtraction3-2Subtracts numbers
*Multiplication4*2Multiplies numbers
/Division1/2Divides numbers
%Modulo11%3Gives back remainder
^Exponent2^3Gives back exponent
sinSinesin(30)Gives back sine of degree input
cosCosinecos(30)Gives back cosine of degree input
tanTangenttan(30)Gives back tangent of degree input
logLogarithm (base 10)log(100)Gives back base 10 logarithm
roundRoundinground(1.23)Rounds a number
floorRounding downfloor(1.23)Rounds down
ceilRounding upceil(1.23)Rounds up
nintNearest integernint(1.23)Gives back nearest integer
sqrtSquare rootsqrt(2)Gives back square root
minMinimummin(1;2)Minimum of 2 numbers
maxMaximummax(1;2)Maximum of 2 numbers
absAbsolute valueabs(-123)Gives back absolute value

Examples

$sum=1+2            // = 3
$sub=3-2 // = 1
$mult=4*2 // = 8
$div=1/2 // = 0.5
$mod=11%3 // = 2
$exp=2^3 // = 8
$sin=sin(30) // = 0.5
$cos=cos(30) // = 0.866025
$tan=tan(30) // = 0.57735
$log=log(100) // = 2
$round=round(1.23) // = 1
$floor=floor(1.23) // = 1
$ceil=ceil(1.23) // = 2
$nint=nint(1.23) // = 1
$sqrt=sqrt(2) // = 1.414214
$min=min(1;2) // = 1
$max=max(1;2) // = 2
$abs=abs(-123) // = 123