You may also want to use some mathematical functions:
<numeric type> abs(
<numeric type> arg)
;
The abs(<numeric type>)
function takes one
argument of any numeric data type (integer
, long
,
number
, or decimal
) and returns its absolute
value in the same data type.
integer bitAnd(
integer arg1, integer arg2)
;
The bitAnd(integer, integer)
function accepts two arguments of integer data type. It takes
them
and returns the number
corresponding to the bitwise and
. (For example,
bitAnd(11,7)
returns 3
.) As
decimal 11
can be expressed as bitwise
1011
, decimal 7
can be
expressed as 111
, thus the result is
11
what corresponds to decimal
3
.
long bitAnd(
long arg1, long arg2)
;
The bitAnd(long, long)
function accepts two arguments of long data type. It takes
them
and returns the number
corresponding to the bitwise and
. (For example,
bitAnd(11,7)
returns 3
.) As
decimal 11
can be expressed as bitwise
1011
, decimal 7
can be
expressed as 111
, thus the result is
11
what corresponds to decimal
3
.
boolean bitIsSet(
integer arg, integer Index)
;
The bitIsSet(integer, integer)
function accepts two arguments of integer data type. It takes
them,
determines the value of the bit
of the first argument located on the Index
and
returns true
or false
, if
the bit is 1
or 0
,
respectively. (For example, bitIsSet(11,3)
returns true
.) As decimal 11
can be expressed as bitwise 1011
, the bit whose
index is 3 (the fourth from the right) is 1
,
thus the result is true
. And
bitIsSet(11,2)
would return
false
.
boolean bitIsSet(
long arg, integer Index)
;
The bitIsSet(long, integer)
function accepts one argument of long data type and one integer. It takes
these arguments,
determines the value of the bit
of the first argument located on the Index
and
returns true
or false
, if
the bit is 1
or 0
,
respectively. (For example, bitIsSet(11,3)
returns true
.) As decimal 11
can be expressed as bitwise 1011
, the bit whose
index is 3 (the fourth from the right) is 1
,
thus the result is true
. And
bitIsSet(11,2)
would return
false
.
integer bitLShift(
integer arg, integer Shift)
;
The bitLShift(integer, integer)
function accepts two arguments of integer data type. It takes
them and returns the number
corresponding to the original number with some bits added
(Shift
number of bits on the left side are
added and set to 0
.) (For example, bitLShift(11,2)
returns 44
.) As decimal 11
can be expressed as bitwise 1011
, thus the two
bits on the right side (10
) are added and the
result is 101100
which corresponds to decimal
44
.
long bitLShift(
long arg, long Shift)
;
The bitLShift(long, long)
function accepts two arguments of long data type. It takes
them and returns the number
corresponding to the original number with some bits added
(Shift
number of bits on the left side are
added and set to 0
.) (For example, bitLShift(11,2)
returns 44
.) As decimal 11
can be expressed as bitwise 1011
, thus the two
bits on the right side (10
) are added and the
result is 101100
which corresponds to decimal
44
.
integer bitNegate(
integer arg)
;
The bitNegate(integer)
function
accepts one argument of integer data type. It
returns the number corresponding to its bitwise
inverted number
. (For example,
bitNegate(11)
returns -12
.)
The function inverts all bits in an argument.
long bitNegate(
long arg)
;
The bitNegate(long)
function
accepts one argument of long data type. It
returns the number corresponding to its bitwise
inverted number
. (For example,
bitNegate(11)
returns -12
.)
The function inverts all bits in an argument.
integer bitOr(
integer arg1, integer arg2)
;
The bitOr(integer, integer)
function accepts two arguments of integer data type. It takes
them and returns the number
corresponding to the bitwise or
. (For example,
bitOr(11,7)
returns 15
.) As
decimal 11
can be expressed as bitwise
1011
, decimal 7
can be
expressed as 111
, thus the result is
1111
what corresponds to decimal
15
.
long bitOr(
long arg1, long arg2)
;
The bitOr(long, long)
function accepts two arguments of long data type. It takes
them and returns the number
corresponding to the bitwise or
. (For example,
bitOr(11,7)
returns 15
.) As
decimal 11
can be expressed as bitwise
1011
, decimal 7
can be
expressed as 111
, thus the result is
1111
what corresponds to decimal
15
.
integer bitRShift(
integer arg, integer Shift)
;
The bitRShift(integer, integer)
function accepts two arguments of integer data type. It takes
them
and returns the number
corresponding to the original number with some bits removed
(Shift
number of bits on the right side are
removed.) (For example,
bitRShift(11,2)
returns
2
.) As decimal 11
can be
expressed as bitwise 1011
, thus the two bits on
the right side are removed and the result is
10
what corresponds to decimal
2
.
long bitRShift(
long arg, long Shift)
;
The bitRShift(long, long)
function accepts two arguments of long data type. It takes
them
and returns the number
corresponding to the original number with some bits removed
(Shift
number of bits on the right side are
removed.) (For example,
bitRShift(11,2)
returns
2
.) As decimal 11
can be
expressed as bitwise 1011
, thus the two bits on
the right side are removed and the result is
10
what corresponds to decimal
2
.
integer bitSet(
integer arg1, integer Index, boolean SetBitTo1)
;
The bitSet(integer, integer,
boolean)
function accepts three arguments. The first two
are of integer data type and the third is boolean. It takes
them,
sets the value of the
bit of the first argument located on the Index
specified as the second argument to 1
or
0
, if the third argument is
true
or false
, respectively,
and returns the result as an integer. (For example,
bitSet(11,3,false)
returns
3
.) As decimal 11
can be
expressed as bitwise 1011
, the bit whose index
is 3 (the fourth from the right) is set to 0
,
thus the result is 11
what corresponds to
decimal
. And
3
bitSet(11,2,true)
would return
1111
what corresponds to decimal
15
.
long bitSet(
long arg1, integer Index, boolean SetBitTo1)
;
The bitSet(long, integer,
boolean)
function accepts three arguments. The first is long, the second is integer,
and the third is boolean. It takes
them,
sets the value of the
bit of the first argument located on the Index
specified as the second argument to 1
or
0
, if the third argument is
true
or false
, respectively,
and returns the result as an integer. (For example,
bitSet(11,3,false)
returns
3
.) As decimal 11
can be
expressed as bitwise 1011
, the bit whose index
is 3 (the fourth from the right) is set to 0
,
thus the result is 11
what corresponds to
decimal
. And
3
bitSet(11,2,true)
would return
1111
what corresponds to decimal
15
.
integer bitXor(
integer arg, integer arg)
;
The bitXor(integer, integer)
function accepts two arguments of integer data type. It takes
them
and returns the number
corresponding to the bitwise exclusive
or
. (For example,
bitXor(11,7)
returns 12
.) As
decimal 11
can be expressed as bitwise
1011
, decimal 7
can be
expressed as 111
, thus the result is
1100
what corresponds to decimal
15
.
long bitXor(
long arg, long arg)
;
The bitXor(long, long)
function accepts two arguments of long data type. It takes
them
and returns the number
corresponding to the bitwise exclusive
or
. (For example,
bitXor(11,7)
returns 12
.) As
decimal 11
can be expressed as bitwise
1011
, decimal 7
can be
expressed as 111
, thus the result is
1100
what corresponds to decimal
15
.
number ceil(
decimal arg)
;
The ceil(decimal)
function takes one
argument of decimal data type and returns the smallest (closest to negative infinity)
double value that is greater than or equal to the argument and is equal to a mathematical integer.
number ceil(
number arg)
;
The ceil(number)
function takes one
argument of double data type and returns the smallest (closest to negative infinity)
double value that is greater than or equal to the argument and is equal to a mathematical integer.
number e(
)
;
The e()
function accepts no argument and
returns the Euler number.
number exp(
<numeric type> arg)
;
The exp(<numeric type>)
function takes one
argument of any numeric data type (integer
, long
,
number
, or decimal
) and returns the result of the
exponential function of this argument.
number floor(
decimal arg)
;
The floor(decimal)
function takes one
argument of decimal data type and returns the largest (closest to positive infinity)
double value that is less than or equal to the argument and is equal to a mathematical integer.
number floor(
number arg)
;
The floor(number)
function takes one
argument of double data type and returns the largest (closest to positive infinity)
double value that is less than or equal to the argument and is equal to a mathematical integer.
void setRandomSeed(
long arg)
;
The setRandomSeed(long)
takes one long argument
and generates the seed for all functions that generate values at random.
This function should be used in the preExecute()
function or method.
In such a case, all values generated at random do not change on different runs of the graph, they even remain the same after the graph is resetted.
number log(
<numeric type> arg)
;
The log(<numeric type>)
takes one argument
of any numeric data type (integer
, long
,
number
, or decimal
) and returns the result of the natural
logarithm of this argument.
number log10(
<numeric type> arg)
;
The log10(<numeric type>)
function takes one
argument of any numeric data type (integer
, long
,
number
, or decimal
) and returns the result of the
logarithm of this argument to the base 10.
number pi(
)
;
The pi()
function accepts no argument and
returns the pi number.
number pow(
<numeric type> base, <numeric type> exp)
;
The pow(<numeric type>, <numeric type>)
function takes two arguments of any numeric data types (that do
not need to be the same, integer
, long
,
number
, or decimal
) and returns the exponential function of
the first argument as the exponent with the second as the
base.
number random(
)
;
The random()
function accepts no argument
and returns a random positive double greater than or equal to
0.0
and less than
1.0
.
boolean randomBoolean(
)
;
The randomBoolean()
function accepts no
argument and generates at random boolean values
true
or false
. If these
values are sent to any numeric data type field, they are converted
to their numeric representation automatically
(1
or 0
,
respectively).
number
randomGaussian(
)
;
The randomGaussian()
function accepts no
argument and generates at random both positive and negative values
of number data type in a Gaussian distribution.
integer randomInteger(
)
;
The randomInteger()
function accepts no
argument and generates at random both positive and negative
integer values.
integer randomInteger(
integer Minimum, integer Maximum)
;
The randomInteger(integer, integer)
function accepts
two argument of integer data types and returns a random integer
value greater than or equal to Minimum
and less
than or equal to Maximum
.
long randomLong(
)
;
The randomLong()
function accepts no
argument and generates at random both positive and negative long
values.
long randomLong(
long Minimum, long Maximum)
;
The randomLong(long, long)
function
accepts two argument of long data types and returns a random long
value greater than or equal to Minimum
and less
than or equal to Maximum
.
long round(
decimal arg)
;
The round(decimal)
function takes one
argument of decimal data type and returns the long that is
closest to this argument. Decimal is converted to number prior to the operation.
long round(
number arg)
;
The round(number)
function takes one
argument of number data type and returns the long that is
closest to this argument.
number sqrt(
<numeric type> arg)
;
The sqrt(mumerictype)
function takes one
argument of any numeric data type (integer
, long
,
number
, or decimal
) and returns the square root of
this argument.