Skip to content
JasperLorelai edited this page Sep 13, 2025 · 1 revision

Source: EvalEx

Constants:

Name Constant
PI pi or π
E e
Golden Ratio φ or phi
2 * PI tau

Operators:

Name Example Precedence
Addition 2 + 2 20
Subtraction 2 - 2 20
Multiplication 2 * 2 30
Division 2 / 2 30
Power 2 ^ 2 80
Unary Minus & Plus (Sign Operators) +2 - (-2) 60
Modulo (remainder of division) 2 % 2 30

Boolean Operators:

Name Operator
Equals = or ==
Not Equals != or <>
Greater >
Greater Or Equals >=
Less <
Less Or Equals <=
And &&
Or ||
Not !

Functions:

General:

Name Function Description
Natural logarithm (base e) log(x)
Logarithm (base 2) log2(x)
Logarithm (base 10) log10(x)
Logarithm of x + 1 log1p(x)
Absolute value abs(x)
Cubic root cbrt(x)
Nearest lower integer floor(x)
Square root sqrt(x)
Nearest upper integer ceil(x) or ceiling(x)
Power (x ^ y) pow(x, y)
e^x exp(x)
e^x - 1 expm1(x)
Signum signum(x) Returns -1, 0, or 1 as the value of x is negative, zero, or positive.
Arbitrary base logarithm logb(value, base) log(value) / log(base)
Factorial fact(x) Calculates the factorial of a base value.
Radian conversion toradian(deg) or rad(deg)
Degree conversion todegree(rad) or deg(rad)

Trigonometric:

Name Function Description
Sine sin(x)
Cosine cos(x)
Tangent tan(x)
Cotangent cot(x) 1 / tan(x)
Arc cosine acos(x)
Arc sine asin(x)
Arc tangent atan(x)
Hyperbolic sine sinh(x)
Hyperbolic tangent tanh(x)
Hyperbolic cosine cosh(x)
Cosecant csc(x) 1 / sin(x)
Secant sec(x) 1 / cos(x)
Hyperbolic cosecant csch(x) 1 / sinh(x)
Hyperbolic secant sech(x) 1 / cosh(x)
Hyperbolic cotangent coth(x) cosh(x) / sinh(x)
Inverse hyperbolic cosine acosh(x)
Arc cotangent (radians) acot(x)
Inverse hyperbolic cotangent acoth(x)
Inverse hyperbolic sine asinh(x)
Inverse hyperbolic tangent atanh(x)
Atan2 (radians) atan2(x, y)

Extra:

Function Description
not(x) Boolean negation.
rand(x, y) Generate a random number from x to y.
random() Produces a random value between 0 and 1.
prob(p, x, y) A random (p%) chance to return x, else return y.
min(value, ...) Return the minimum of values.
max(value, ...) Return the maximum of values.
average(value, ...) Returns the average of all arguments.
sum(value, ...) Returns the sum of all arguments.
round(value, scale) Rounds the given value to the specified scale.
select(v, x, y, z) If v < 0, return x, if v = 0 return y, if v > 0 return z.
if(condition, trueResult, falseResult) If condition is true, the trueResult is returned, else the falseResult value.
switch(expression, value1, result1, ..., [default]) Returns the result corresponding to the first matching value in the specified expression or an optional default value if no match is found.
coalesce(value, ...) Returns the first non-null parameter or NULL if all parameters are null.

String:

Strings have to be in quotations ("string").

Function Description
str_contains(string, substring) Returns true if the string contains the substring (case-insensitive).
str_ends_with(string, substring) Returns true if the string ends with the substring (case-sensitive).
str_format(format[, argument, ...]) Returns a formatted string using the specified format string and arguments.
str_left(value, n) Returns the first n characters from the left of the given string.
str_length(string) Returns the length of the string.
str_lower(value) Converts the given value to lower case.
str_matches(string, pattern) Returns true if the string matches the RegEx pattern.
str_right(value, n) Returns the last n characters from the right of the given string.
str_split(value, separator) Splits the string into an array of substrings based on the provided separator.
str_starts_with(string, substring) Returns true if the string starts with the substring (case-sensitive).
str_substring(string, start[, end]) Returns a substring of the given string, starting at the start index and ending at the end index (the end of the string if not specified).
str_trim(string) Returns the given string with all leading and trailing spaces removed.
str_upper(value) Converts the given value to upper case.

Date Time:

Function Description
dt_date_new(year, month, day[, hour, minute, second, millis, nanos][, zoneId]) Returns a new DATE_TIME value with the given arguments. An optional time zone (string) can be specified, e.g. "Europe/Berlin", or "GMT+02:00". If no zone is specified, the system zone is used.
dt_date_new(millis) Returns a new DATE_TIME from the epoch of 1970-01-01T00:00:00Z, in milliseconds.
dt_date_parse(value[, zoneId][, format, ...]) Converts the given string value to a DATE_TIME value by using the optional time zone and formats. All formats are used until the first matching format. Without a format, the following are used: ISO_DATE_TIME, ISO_DATE, ISO_LOCAL_DATE_TIME, ISO_LOCAL_DATE, and RFC_1123_DATE_TIME. The time zone can be NULL, and system time will be used.
dt_date_format(value[, format][, zoneId]) Formats the given DATE_TIME to a string using the given optional format and time zone. Without a format, ISO_DATE_TIME is used. The zone ID defaults to the system zone.
dt_date_to_epoch(value) Converts the given DATE_TIME to epoch timestamp in millisecond.
dt_duration_new(days[, hours, minutes, seconds, nanos]) Returns a new DURATION value with the given arguments.
dt_duration_parse(value) Converts the given ISO-8601 duration string representation to a DURATION value. E.g. P2DT3H4M parses 2 days, 3 hours and 4 minutes.
dt_duration_from_millis(millis) Returns a new DURATION value with the given milliseconds.
dt_duration_to_millis(value) Converts the given DURATION to a milliseconds value.
dt_now() Produces a new DATE_TIME that represents the current moment in time.
dt_today([zoneId]) Produces a new DATE_TIME that represents the current date, at midnight (00:00). An optional time zone can be specified, e.g. "America/Sao_Paulo", or "GMT-03:00". If no zone is specified, the system zone is used.
Clone this wiki locally