This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Built-in Functions / Programming / Tests  /

  • lhs == rhs returns True if lhs and rhs are identical.
  • lhs == rhs is used to represent a symbolic equation, to be manipulated using functions like Solve.
  • lhs == rhs returns True if lhs and rhs are identical expressions.
  • lhs == rhs returns False if lhs and rhs are determined to be unequal by comparisons between numbers or other raw data, such as strings.
  • Approximate numbers are considered equal if they differ in at most their last two decimal digits.
  • 2 == 2. gives True.
  • == == gives True if all the are equal.
  • Equal[ e ] gives True.
  • For exact numeric quantities, Equal internally uses numerical approximations to establish inequality. This process can be affected by the setting of the global variable $MaxExtraPrecision.
  • In StandardForm and InputForm, lhs == rhs can be input as lhs \[Equal] rhs or lhsrhs.
  • See the Mathematica book: Section 1.5.5Section 1.5.6.
  • See also: SameQ, Unequal, Order.

    Further Examples

    For comparison, SameQ (===) checks whether the expressions are identical in form.



    Equal will return unevaluated if it cannot determine that the right-hand side and left-hand side are identical. SameQ is more assertive; use it if you need a function that will return False.