#### 11.3.107 `is/2`

[ISO]

#### Synopsis

`-Term`` is `

`+Expression`

Evaluates `Expression` as an arithmetic expression, and unifies
the resulting number with `Term`.

#### Arguments

`Expression`- expr, must be ground.
An expression made up of:

- functors representing arithmetic operations
- numbers
- variables bound to numbers or arithmetic expressions

`Term`- number

#### Exceptions

Evaluation errors.

#### Examples

| ?- `X is 2 * 3 + 4.`
X = 10
| ?- `Y = 32.1, X is Y * Y.`
X = 1030.41
Y = 32.1
| ?- `Arity is 3 * 8, X is 4 + Arity + (3 * Arity * Arity).`
Arity = 24
X = 1756

| ?- `X is 6/0.`
! Domain error in argument 2 of is/2
! expected an integer not equal to 0, but found 0
! goal: _98 is 6/0

| ?- `X is "a".`
X = 97
| ?- `X is 4 * 5, Y is X * 4.`
X = 20,
Y = 80

#### Comments

If a variable in an arithmetic expression is
bound to another arithmetic expression (as opposed to a number) at
runtime then the cost of evaluating that expression is much greater.
It is approximately equal to the cost of `call/1`

of an arithmetic
goal.

#### See Also

ref-ari.

Send feedback on this subject.