Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Term comparisons in Erlang take two expressions on either side of the comparison operator. The result of the expression is one of the Boolean atoms true or false. The equal (==) and not equal (/=) operators compare the values on either side of the operator without paying attention to the data types. Typing 1 == one returns false, whereas one == one returns true.
Comparisons such as 1 == 1.0 will return true and 1 /= 1.0 will return false, as integers are converted to floats before being compared with them in such a comparison. You get around this by using the operators exactly equal to and not exactly equal to, as these operators compare not only the values on either side of the equation, but also their data types. So, for example, 1 =:= 1.0 and 1 =/= 1 will both return false, and 1 =/= 1.0 returns true.