UNPKG

1.94 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function unequal
4
5Test whether two values are unequal.
6
7The function tests whether the relative difference between x and y is
8larger than the configured epsilon. The function cannot be used to compare
9values smaller than approximately 2.22e-16.
10
11For matrices, the function is evaluated element wise.
12In case of complex numbers, x.re must unequal y.re, or x.im must unequal y.im.
13Strings are compared by their numerical value.
14
15Values `null` and `undefined` are compared strictly, thus `null` is unequal
16with everything except `null`, and `undefined` is unequal with everything
17except `undefined`.
18
19
20## Syntax
21
22```js
23math.unequal(x, y)
24```
25
26### Parameters
27
28Parameter | Type | Description
29--------- | ---- | -----------
30`x` | number &#124; BigNumber &#124; Fraction &#124; boolean &#124; Complex &#124; Unit &#124; string &#124; Array &#124; Matrix &#124; undefined | First value to compare
31`y` | number &#124; BigNumber &#124; Fraction &#124; boolean &#124; Complex &#124; Unit &#124; string &#124; Array &#124; Matrix &#124; undefined | Second value to compare
32
33### Returns
34
35Type | Description
36---- | -----------
37boolean &#124; Array &#124; Matrix | Returns true when the compared values are unequal, else returns false
38
39
40## Examples
41
42```js
43math.unequal(2 + 2, 3) // returns true
44math.unequal(2 + 2, 4) // returns false
45
46const a = math.unit('50 cm')
47const b = math.unit('5 m')
48math.unequal(a, b) // returns false
49
50const c = [2, 5, 1]
51const d = [2, 7, 1]
52
53math.unequal(c, d) // returns [false, true, false]
54math.deepEqual(c, d) // returns false
55
56math.unequal(0, null) // returns true
57```
58
59
60## See also
61
62[equal](equal.md),
63[deepEqual](deepEqual.md),
64[smaller](smaller.md),
65[smallerEq](smallerEq.md),
66[larger](larger.md),
67[largerEq](largerEq.md),
68[compare](compare.md)