Next: , Up: ref-ari   [Contents][Index]


4.7.1 Overview

In Prolog, arithmetic is performed by certain built-in predicates, which take arithmetic expressions as their arguments and evaluate them. Arithmetic expressions can evaluate to integers or floating-point numbers (floats).

For all practical purposes the range of integers can be considered limited only by the amount of available memory.

The range of floats is the one provided by the C double type, typically [4.9e-324, 1.8e+308] (plus or minus). In case of overflow or division by zero, an evaluation error exception will be raised. Floats are represented by 64 bits and they conform to the IEEE 754 standard.

The arithmetic operations of evaluation and comparison are implemented in the predicates described in ref-ari-eae and ref-ari-acm. All of them take arguments of the type Expr, which is described in detail in ref-ari-aex.


Send feedback on this subject.