# equal() Function & Examples

Use the equal() relational function in Calcul.io. Review its syntax, edit working examples, understand the result, and explore related math functions.

## equal

#### x == y

#### equal(x, y)

Try it yourself:

```calculio
2+2 == 3
2+2 == 4
a = 3.2
b = 6-2.8
a == b
50cm == 0.5m
```

[unequal](https://calcul.io/function/unequal/index.md)

[smaller](https://calcul.io/function/smaller/index.md)

[larger](https://calcul.io/function/larger/index.md)

[compare](https://calcul.io/function/compare/index.md)

---

## equal(): Testing Mathematical Equality

**equal()** returns whether values are equal. It is useful in conditional expressions, validation, and boundary checks: equal(4, 4) is true. It can compare appropriate scalar and structured values according to their mathematical representation.

## Exact comparisons and decimals

Exact equality is appropriate for integers, flags, and known symbolic values. Floating-point calculations can produce tiny residues, so compare a difference with a tolerance instead: use [abs()](https://calcul.io/function/abs/index.md), [subtract()](https://calcul.io/function/subtract/index.md), and [smaller()](https://calcul.io/function/smaller/index.md). This is more reliable than expecting two separately computed decimals to match bit-for-bit.

Use [deepEqual()](https://calcul.io/function/deepEqual/index.md) when nested contents must match, [equalText()](https://calcul.io/function/equalText/index.md) for text-aware comparisons, and [unequal()](https://calcul.io/function/unequal/index.md) for the opposite condition. Be explicit about units and types before comparing values.

[All functions](https://calcul.io/functions/index.md)
