﻿ = – Algosim documentation
Algosim documentation: =

# = (equals sign)

Tests if two objects are equal.

## Syntax

• `x = y`

• `x` and `y` are any objects

## Description

If `x` and `y` are any two objects, then `x = y` returns `true` iff `x` and `y` are exactly equal. The subtleties are as follows:

• Objects are compared as mathematical entities in the sense that datatype differences not relevant to the objects’ mathematical identities are ignored. For instance, the integer `5` is equal to the rational number `5/2 + 5/2`, the real number `5.0`, and the complex number `5 + i − i`.

• Numbers, vectors, and matrices are always treated as different objects. For instance, the number `5` is not equal to the matrix `❨❨5❩❩`, and the vector `❨1, 2, 3❩` is not equal to the single-column matrix `❨❨1❩, ❨2❩, ❨3❩❩`.

• Floating-point numbers are *not* compared with epsilons. For instance, `sin(π)` may not equal `0`. To compare objects with epsilon, use the `≈` operator instead.

• A boolean is not equal to any non-boolean object (such as a string or a number). For instance, `false` is not equal to any of `""`, `0`, or `"false"`.

• A string is not equal to any non-string object that it may be parsed to. For instance, `"5"` is not equal to `5`.

• Two kernel function objects are equal if they refer to the same actual kernel function implementation, even if they are accessed using two different synonyms. For instance, `length` is equal to `cardinality`. In addition, if you assign `c ≔ cardinality` then `c` will also equal any of `length` or `cardinality`.

• Two user-defined functions are equal if and only if they have identical abstract syntax trees. For instance, while `(n ↦ n^2) = (k ↦ k^2)` is `true`, `(n ↦ n^2) = (k ↦ sqr(2))` is `false`.

The `=` operator is implemented by the `equals` function.

## Examples

`1 + 1 = 2`
`true`