 |
|
BaselScript |
Beschreibung
Math functions
All names of these functions are prefixed with "math."
math.abs
#max = $math.abs(value)
Example:
#value1=-77
#max = $math.abs(#value1)
#max=77
math.sinus
#result = $math.sinus(#param[,n])
#param - a angle in radians
-0.5 < #param < 0.5
n- round parameter
if n- parameter is given, the result will be rounded up to the first n-positions after the decimal point
Example 1:
#param = 0.5
#result = $math.sinus(#param)
#result = -0,4794255386042023
Example 2:
#param = 0.5
#result = $math.sinus(#param,2)
#result = -0,48
math.cosinus
#result = $math.cosinus(#param[,n])
#param - a angle in radians
n- round parameter
if n- parameter is given, the result will be rounded up to the first n-positions after the decimal point
Example 2:
#param = 0.5
#result = $math.cosinus(#param)
#result = -0,877582561890373
math.tangent
#result = $math.tangent(#param[,n])
#param - a angle in radians
n- round parameter
Example:
#param = 0.5
#result = -0,54630248984379
math.cotangent
#result = $math.cotangent(#param[,n])
#param - a angle in radians
n- round parameter
Example:
#param = 0.5
#result = $math.cotangent(#param,2)
#result = 1,83
math.arcsin
#result = $math.arcsin(#param[,n])
#param - a angle in radians
n- round parameter
Example:
#param = 0.5
#result = 0,52359877
math.arccos
#result = $math.arccos(#param[,n])
#param - a angle in radians
n- round parameter
Example:
#param = 0.5
#result = $math.arccos(#param,2)
#result = 1,05
math.secant
#result = $math.secant(#param[,n])
#param - a angle in radians
n- round parameter
Example:
#param = 0.5
#result = $math.secant(#param,2)
#result = 1,14
math.cosecant
#result = $math.cosecant(#param[,n])
#param - a angle in radians
n- round parameter
Example:
#param = 0.5
#result = $math.cosecant(#param,2)
#result = 2,09
math.round
#result = $math.round(#value, n)
n- round parameter
the result will be rounded up to the first n-positions after the decimal point
Example 1:
#value = 1234567.55678
#result = $math.round(#value)
#result = 1234568
Example 2:
#value = 1234567.55678
#result = $math.round(#value,0)
#result = 1234568
Example 3:
#value = 1234567.55678
#result = $math.round(#value,2)
#result = 1234567,56
math.pow
#r = $math.pow(a,b)
The first a is the base of the power and the second b is the exponent
Example:
#r = $pow(2,3)
#r = 8
math.factorial
#result = $math.factorial(#param)
Example:
#param = 4
#result = $factorial(#param)
#result = 1*2*3*4 = 24
math.sqrt
#result = $math.sqrt(#param[,n])
n- round parameter
Example:
#param = 36
#result = 6
math.cbrt
#result = $math.cbrt(#param[,n])
n- round parameter
Example:
#param = 36
#result = 6
math.log10
#result = $math.log10(#param[,n])
n- round parameter
Example:
#param = 1000
#result = 3
math.log
#result = $math.log(#param[,n])
n- round parameter
Example:
#param = 2.71828
#result = 0,999999327347282
math.trunkate
#result = $math.trunkate(#value)
Example:
#value = 100.5
#result = 100
math.decimal
#result = $math.decimal(#value)
Example:
#value = 100.5
#result = 5
math.random
#result = $math.random(#start,#end)
#start <= #result < #end
Example:
#result = $math.random(0,5)
#res = 2 or #res = 0 or #res =1 or #res =4 or #res =3
random with exception allows to select values excluding those specified in the list
#res = $math.random(#start,#end, #array, number)
#start <= #result < #end
#array - array with exception values
number - number of elements in array
Example:
array #exeption[4]
#r1 = $math.random(0,5)
// save #r1 in array
#exception[0] = #r1
#r2 = $math.random(0,5,#exception,1)
// save #r2 in array
#exception[1]= #r2
#r3 = $math.random(0,5,#exception,2)
// save #r3 in array
#exception[2]= #r3
#r4 = $math.random(0,5,#exception,3)
All #r1, #r2, #r3, #r4 - values will be unique (1- 4) and will not be repeated.
math.hex_to_decimal
#decimal = $math.hex_to_decimal(#value)
Example:
#decimal = $math.hex_to_decimal(2D)
#decimal=45
math.decimal_to_hex
#hex = $math.decimal_to_hex(#value)
Example:
#hex = $math.decimal_to_hex(45)
#hex=2D
math.decimal_to_bin
#bin = $math.decimal_to_bin(#value)
Example:
#bin = $math.decimal_to_bin(5)
#hex=101
math.bin_to_decimal
#decimal = $math.bin_to_decimal(#value)
Example:
#decimal = $bin_to_decimal_to_bin(1001)
#decimal=9
math.max
#max = $math.max(#value1,#value2)
Example:
#value1=100
#value2=200
#max = $math.max(#value1,#value2)
#max=200
math.min
#max = $math.min(#value1,#value2)
Example:
#value1=77
#value2=200
#max = $math.min(#value1,#value2)
#max=77