equal

x == y

equal(x, y)

Try it yourself:


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(), subtract(), and smaller(). This is more reliable than expecting two separately computed decimals to match bit-for-bit.

Use deepEqual() when nested contents must match, equalText() for text-aware comparisons, and unequal() for the opposite condition. Be explicit about units and types before comparing values.

Try Equal in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions