You can use the \(\text{lnFactorial}\) function to calculate the natural log of the factorial directly.

You can use the \lnfactorial backslash command to insert this function.

The following variants of this function are available:

  • \(\text{real } \text{lnFactorial} \left ( \text{<value>} \right )\)

Where \(\text{<value>}\) represents an integer value.

Values greater than one are calculated by the relation:

\[\text{lnFactorial} \left ( x \right ) = \sum_{i=2}^x \ln \left ( i \right )\]

To improve performance, this function caches values, once calculated. The function will also cache all intermediate values and will use the highest cached value when calculating new values.


Aion will detect the construct \(\ln \left ( x ! \right )\) and will use this function rather than calculating the log of the factorial as two distinct operations.

The example below demonstrates how you can use this function:

\[a = \text{lnFactorial } 3\]
\[\text{a = 1.7917594692280549573}\]