Skip to content

function

tuprolog.solve.stdlib.function

The functions of the standard library, evaluated in arithmetic expressions (e.g. by is/2).

Each constant is a tuprolog.solve.function.LogicFunction with a signature (its name and arity in Prolog, e.g. abs/1), and is loaded by default in Prolog solvers. They are mostly ISO Prolog's evaluable functors.

Examples:

>>> AbsoluteValue.signature
Signature(name=abs, arity=1, vararg=false)
>>> from tuprolog.solve.prolog import prolog_solver
>>> prolog_solver().solve_once("X is abs(-3) + 7 mod 2")["X"]
4

AbsoluteValue module-attribute

AbsoluteValue = _function.AbsoluteValue.INSTANCE

The function abs/1: the absolute value of a number.

Addition module-attribute

Addition = _function.Addition.INSTANCE

The function +/2: the sum of two numbers.

ArcTangent module-attribute

ArcTangent = _function.ArcTangent.INSTANCE

The function atan/1: the arc tangent of a number, in radians.

BitwiseAnd module-attribute

BitwiseAnd = _function.BitwiseAnd.INSTANCE

The function /\/2: the bitwise and of two integers.

BitwiseComplement module-attribute

BitwiseComplement = _function.BitwiseComplement.INSTANCE

The function \/1: the bitwise complement of an integer.

BitwiseLeftShift module-attribute

BitwiseLeftShift = _function.BitwiseLeftShift.INSTANCE

The function <</2: an integer shifted left by a number of bits.

BitwiseOr module-attribute

BitwiseOr = _function.BitwiseOr.INSTANCE

The function \//2: the bitwise or of two integers.

BitwiseRightShift module-attribute

BitwiseRightShift = _function.BitwiseRightShift.INSTANCE

The function >>/2: an integer shifted right by a number of bits.

Ceiling module-attribute

Ceiling = _function.Ceiling.INSTANCE

The function ceiling/1: the smallest integer not less than a number.

Cosine module-attribute

Cosine = _function.Cosine.INSTANCE

The function cos/1: the cosine of an angle, in radians.

Exponential module-attribute

Exponential = _function.Exponential.INSTANCE

The function exp/1: e raised to a number.

Exponentiation module-attribute

Exponentiation = _function.Exponentiation.INSTANCE

The function **/2: a number raised to another, as a float.

FloatFractionalPart module-attribute

FloatFractionalPart = _function.FloatFractionalPart.INSTANCE

The function float_fractional_part/1: the fractional part of a number.

FloatIntegerPart module-attribute

FloatIntegerPart = _function.FloatIntegerPart.INSTANCE

The function float_integer_part/1: the integer part of a number, as a float.

FloatingPointDivision module-attribute

FloatingPointDivision = (
    _function.FloatingPointDivision.INSTANCE
)

The function //2: the quotient of two numbers.

Floor module-attribute

Floor = _function.Floor.INSTANCE

The function floor/1: the largest integer not greater than a number.

IntegerDivision module-attribute

IntegerDivision = _function.IntegerDivision.INSTANCE

The function ///2: the integer quotient of two integers, truncated towards zero.

Modulo module-attribute

Modulo = _function.Modulo.INSTANCE

The function mod/2: the modulo of two integers, with the sign of the divisor.

Multiplication module-attribute

Multiplication = _function.Multiplication.INSTANCE

The function */2: the product of two numbers.

NaturalLogarithm module-attribute

NaturalLogarithm = _function.NaturalLogarithm.INSTANCE

The function log/1: the natural logarithm of a number.

Remainder module-attribute

Remainder = _function.Remainder.INSTANCE

The function rem/2: the remainder of two integers, with the sign of the dividend.

Round module-attribute

Round = _function.Round.INSTANCE

The function round/1: the integer nearest to a number.

Sign module-attribute

Sign = _function.Sign.INSTANCE

The function sign/1: the sign of a number: -1, 0 or 1.

SignReversal module-attribute

SignReversal = _function.SignReversal.INSTANCE

The function -/1: the opposite of a number.

Sine module-attribute

Sine = _function.Sine.INSTANCE

The function sin/1: the sine of an angle, in radians.

SquareRoot module-attribute

SquareRoot = _function.SquareRoot.INSTANCE

The function sqrt/1: the square root of a number.

Subtraction module-attribute

Subtraction = _function.Subtraction.INSTANCE

The function -/2: the difference of two numbers.

ToFloat module-attribute

ToFloat = _function.ToFloat.INSTANCE

The function float/1: a number converted to a float.

Truncate module-attribute

Truncate = _function.Truncate.INSTANCE

The function truncate/1: the integer part of a number.