Skip to content

factorial

relationalai.semantics.std.math
factorial(value: NumberValue) -> Expression

Compute the factorial of a non-negative integer.

  • value

    (NumberValue) - The non-negative integer input.
  • Expression - An Expression computing the factorial. Returns Integer. If the input value is not statically known to be non-negative, but turns out to be negative at runtime, returns NaN.
  • ValueError - If value can be computed statically and is negative.

Compute factorial:

>>> select(math.factorial(5))
>>> select(math.factorial(Calculation.n))