Jess Math Functions

List of math functions that can be executed by Jess.


8.1. (* <numeric-expression> <numeric-expression>+)

Package:
Intrinsics
Arguments:
Two or more numeric expressions
Returns:
Number
Description:
Returns the products of its arguments. The return value is an INTEGER unless any of the arguments are FLOAT, in which case it is a FLOAT.

8.2. (** <numeric-expression> <numeric-expression>)

Package:
MathFunctions
Arguments:
Two numeric expressions
Returns:
Number
Description:
Raises its first argument to the power of its second argument (using Java's Math.pow() function). Note: the return value is NaN (not a number) if both arguments are negative.

8.3. (+ <numeric-expression> <numeric-expression>+)

Package:
Intrinsics
Arguments:
Two or more numeric expressions
Returns:
Number
Description:
Returns the sum of its arguments. The return value is an INTEGER unless any of the arguments are FLOAT, in which case it is a FLOAT.

8.4. (- <numeric-expression> <numeric-expression>+)

Package:
Intrinsics
Arguments:
Two or more numeric expressions
Returns:
Number
Description:
Returns the first argument minus all subsequent arguments. The return value is an INTEGER unless any of the arguments are FLOAT, in which case it is a FLOAT.

8.5. (/ <numeric-expression> <numeric-expression>+)

Package:
Intrinsics
Arguments:
Two or more numeric expressions
Returns:
Number
Description:
Returns the first argument divided by all subsequent arguments. The return value is a FLOAT.

8.6. (< <numeric-expression> <numeric-expression>+)

Package:
Intrinsics
Arguments:
Two or more numeric expressions
Returns:
Boolean
Description:
Returns TRUE if each argument is less in value than the argument following it; otherwise, returns FALSE.

8.7. (<= <numeric-expression> <numeric-expression>+)

Package:
Intrinsics
Arguments:
Two or more numeric expressions
Returns:
Boolean
Description:
Returns TRUE if the value of each argument is less than or equal to the value of the argument following it; otherwise, returns FALSE.

8.8. (<> <numeric-expression> <numeric-expression>+)

Package:
Intrinsics
Arguments:
Two or more numeric expressions
Returns:
Boolean
Description:
Returns TRUE if the value of the first argument is not equal in value to all subsequent arguments; otherwise returns FALSE.

8.9. (= <numeric-expression> <numeric-expression>+)

Package:
Intrinsics
Arguments:
Two or more numeric expressions
Returns:
Boolean
Description:
Returns TRUE if the value of the first argument is equal in value to all subsequent arguments; otherwise, returns FALSE. The integer 2 and the float 2.0 are =, but not eq.

8.10. (> <numeric-expression> <numeric-expression>+)

Package:
Intrinsics
Arguments:
Two or more numeric expressions
Returns:
Boolean
Description:
Returns TRUE if the value of each argument is less than that of the argument following it; otherwise, returns FALSE.

8.11. (>= <numeric-expression> <numeric-expression>+)

Package:
Intrinsics
Arguments:
Two or more numeric expressions
Returns:
Boolean
Description:
Returns TRUE if the value of each argument is greater than or equal to that of the argument following it; otherwise, returns FALSE.

8.12. (abs <numeric-expression>)

Package:
MathFunctions
Arguments:
One numeric expression
Returns:
Number
Description:
Returns the absolute value of its only argument.

8.40. (div <numeric-expression> <numeric-expression>+)

Package:
MathFunctions
Arguments:
Two or more numeric expressions
Returns:
Numbers
Description:
Returns the first argument divided by all subsequent arguments using integer division. Quotient of the values of the two numeric expressions rounded to the nearest integer.

8.42. (e)

Package:
MathFunctions
Arguments:
None
Returns:
Number
Description:
Returns the transcendental number e.

8.44. (eq <expression> <expression>+)

Package:
Intrinsics
Arguments:
Two or more arbitrary arguments
Returns:
Boolean
Description:
Returns TRUE if the first argument is equal in type and value to all subsequent arguments. For strings, this means identical contents. Uses the Java Object.equals() function, so can be redefined for external types. Note that the integer 2 and the floating-point number 2.0 are not eq, but they are eq* and =.

8.45. (eq* <expression> <expression>+)

Package:
Intrinsics
Arguments:
Two or more arbitrary arguments
Returns:
Boolean
Description:
Returns TRUE if the first argument is equivalent to all the others. Uses numeric equality for numeric types, unlike eq. Note that the integer 2 and the floating-point number 2.0 are not eq, but they are eq* and =.

8.49. (exp <numeric-expression>)

Package:
MathFunctions
Arguments:
One numeric expression
Returns:
Number
Description:
Raises the value e to the power of its only argument.

8.57. (float <numeric-expression>)

Package:
MathFunctions
Arguments:
One numeric expression
Returns:
Floating-point number
Description:
Converts its only argument to a float.

8.72. (integer <numeric-expression>)

Package:
MathFunctions
Arguments:
One numeric expression
Returns:
Integer
Description:
Converts its only argument to an integer. Truncates any fractional component of the value of the given numeric expression and returns the integral part.

8.83. (log <numeric-expression>)

Package:
MathFunctions
Arguments:
One numeric expression
Returns:
Number
Description:
Returns the logarithm base e of its only argument.

8.84. (log10 <numeric-expression>)

Package:
MathFunctions
Arguments:
One numeric expression
Returns:
Number
Description:
Returns the logarithm base-10 of its only argument.

8.85. (long <expression>)

Package:
MiscFunctions
Arguments:
One expression, either numeric or String
Returns:
RU.LONG
Description:
Interprets the expression as a Java long (if possible) and returns a long value. Use strings or atoms for precise values that can't be expressed as an int. Longs in Jess are "second class citizens" in the sense that you can't directly do math on them. You can assign them to variables, pass them to function calls, and convert them to Strings or floating-point numbers.

8.89. (max <numeric-expression>+)

Package:
MathFunctions
Arguments:
One or more numerical expressions
Returns:
Number
Description:
Returns the value of its largest numeric argument

8.91. (min <numeric-expression>+)

Package:
MathFunctions
Arguments:
One or more numeric expressions
Returns:
Number
Description:
Returns the value of its smallest numeric argument.

8.92. (mod <numeric-expression> <numeric-expression>)

Package:
Intrinsics
Arguments:
Two integer expressions
Returns:
Integer
Description:
Returns the remainder of the result of dividing the first argument by its second (assuming that the result of the division must be an integer).

8.95. (neq <expression> <expression>+)

Package:
Intrinsics
Arguments:
Two or more values
Returns:
Boolean
Description:
Returns TRUE if the first argument is not equal in type and value to all subsequent arguments (see eq).

8.103. (pi)

Package:
MathFunctions
Arguments:
None
Returns:
Number
Description:
Returns the number pi.

8.110. (random)

Package:
MathFunctions
Arguments:
None
Returns:
Number
Description:
Returns a pseudo-random integer between 0 and 65536.

8.119. (round <numeric-expression>)

Package:
MathFunctions
Arguments:
One numeric expression
Returns:
Integer
Description:
Rounds its argument toward the closest integer or negative infinity if exactly between two integers.

8.138. (sqrt <numeric-expression>)

Package:
MathFunctions
Arguments:
A numeric expression
Returns:
Number
Description:
Returns the square root of its only argument.