Skip to content

number

relationalai.semantics.std.numbers
number(value: NumberValue, precision: int = 38, scale: int = 14) -> Variable

Create an expression that represents a number with specified value, precision and scale.

  • value

    (NumberValue) - The numeric value.
  • precision

    (int, default: 38) - The precision (total number of digits).
  • scale

    (int, default: 14) - The scale (number of decimal places).
  • Variable - A Variable representing the number with the specified properties. Returns Number.

Create a number with custom precision and scale:

>>> numbers.number(123.456, precision=10, scale=3)
>>> numbers.number(Product.price, precision=12, scale=2)
RelationalAI Documentation
└──  Build With RelationalAI
    └──  Understand how PyRel works > Use advanced reasoning > Rules-based reasoning
        └──  Work with numbers
            └──  Cast numeric values