Owl_base_mathsSourceMaths: fundamental and advanced mathematical functions.
``add x y``
``sub x y``
``mul x y``
``div x y``
``fmod x y``
``atan2 x y``
``hypot x y``
``abs x``
``neg x``
``reci x``
``floor x``
``ceil x``
``round x``
``trunc x``
``fix x``
``sqr x``
``sqrt x``
``cbrt x``
``pow x``
``exp x``
``exp2 x``
``exp10 x``
``expm1 x``
``log x``
``log2 x``
``log10 x``
``log1p x``
``sigmod x``
``signum x``
``softsign x``
``softplus x``
``relu x``
``dawsn x``
``sin x``
``cos x``
``tan x``
``cot x``
``sec x``
``csc x``
``asin x``
``acos x``
``atan x``
``cot x``
``sec x``
``csc x``
``sinh x``
``cosh x``
``tanh x``
``asinh x``
``acosh x``
``atanh x``
``coth x``
``sech x``
``csch x``
``xlogy(x, y)``
``xlog1py(x, y)``
``logit(x)``
``expit(x)``
``log1mexp(x)``
``log1pexp(x)``
``erf(x)``
``erfc(x)``
``erfcx(x)``
``is_nan x`` returns ``true`` if ``x`` is ``nan``.
``is_inf x`` returns ``true`` if ``x`` is ``infinity`` or ``neg_infinity``.
``is_normal x`` returns ``true`` if ``x`` is a normal float number.
``is_nan x`` returns ``true`` if ``x`` is subnormal float number.
``is_odd x`` returns ``true`` if ``x`` is odd.
``is_even x`` returns ``true`` if ``x`` is even.
``is_pow2 x`` return ``true`` if ``x`` is integer power of 2, e.g. 32, 64, etc.
``same_sign x y`` returns ``true`` if ``x`` and ``y`` have the same sign, otherwise it returns ``false``. Positive and negative zeros are special cases and always returns ``true``.
``is_simplex x`` checks whether ``x`` is simplex. In other words, :math:`\sum_i^K x_i = 1` and :math:`x_i \ge 0, \forall x_i \in 1,K`.
``is_sqr x`` checks if ``x`` is the square of an integer.
``mulmod a b m`` computes (a*b) mod m.
``powmod a b m`` computes (a^b) mod m.
``is_prime x`` returns ``true`` if ``x`` is a prime number. The function is deterministic for all numbers representable by an int. The function uses the Rabin–Miller primality test.
``fermat_fact x`` performs Fermat factorisation over ``x``, i.e. into two roughly equal factors. ``x`` must be an odd number.