FASILL documentation Source fasill_arithmetic

Arithmetic

This library provides basic predicates for arithmetic comparison and arithmetic evaluation.

The general arithmetic predicates all handle expressions. An expression is either a number or a function. The arguments of a function are expressions. FASILL defines the following numeric types:

  • integer: depending on the Prolog system on which FASILL is executed, integers can be bounded or not. The type of integer support can be detected using the FASILL flags bounded, min_integer and max_integer.

  • float: floating point numbers. On most of today's platforms these are 64-bit IEEE floating point numbers.

arithmetic_evaluation/3

arithmetic_evaluation( +Indicator, +Expression, ?Result )

This predicate succeeds when Result is the result of evaluating the expression Expression. This predicate throws an arithmetical exception if there is any problem.

arithmetic_comparison/3

arithmetic_comparison( +Op, +Expression1, +Expression2 )

This predicate succeeds when expressions Expression1 and Expression2, evaluated as much as possible, fulfill the ordering relation Op.

arithmetic_type/2

arithmetic_type( +Number, ?Type )

This predicate succeeds when Number has the type Type (`integer` or `float`).

arithmetic_op/4

arithmetic_op( +Operator, +Arguments, +Types, ?Result )

This predicate succeeds when Result is the result of evaluating the operator Operator with the arguments Arguments with types Types.