compare
Compare two values.
Type Signatures
boolean, boolean, BigNumber, BigNumber, bigint, bigint, Fraction, Fraction, Complex, Complex, number, number
Parameters
| Name | Type | Description |
| x | number | BigNumber | bigint | Fraction | Unit | string | Array | Matrix | First value to compare |
| y | number | BigNumber | bigint | Fraction | Unit | string | Array | Matrix | Second value to compare |
Returns
number | BigNumber | bigint | Fraction | Array | Matrix — Returns the result of the comparison:
Examples
compare(2
3)
compare(3
2)
compare(2
compareText
Compare two strings lexically. Comparison is case sensitive.
Syntax
compareText(x | y)
Parameters
| Name | Type | Description |
| x | string | Array | DenseMatrix | First string to compare |
| y | string | Array | DenseMatrix | Second string to compare |
Returns
number | Array | DenseMatrix — Returns the result of the comparison:
Examples
compareText("B
A")
compareText("A
B")
compareText("A
equal
Check equality of two values. Returns true if the values are equal, and false if not.
Syntax
x == y | equal(x | y)
Parameters
| Name | Type | Description |
| x | number | BigNumber | bigint | boolean | Complex | Unit | string | Array | Matrix | First value to compare |
| y | number | BigNumber | bigint | boolean | Complex | Unit | string | Array | Matrix | Second value to compare |
Returns
boolean | Array | Matrix — Returns true when the compared values are equal, else returns false
Examples
2+2 == 3
2+2 == 4
a = 3.2
b = 6-2.8
a == b
equalScalar
Test whether two scalar values are nearly equal.
Type Signatures
boolean, boolean, number, number, BigNumber, BigNumber, bigint, bigint, Fraction, Fraction, Complex, Complex
Parameters
| Name | Type | Description |
| x | number | BigNumber | bigint | Fraction | boolean | Complex | Unit | First value to compare |
| y | number | BigNumber | bigint | Fraction | boolean | Complex | Second value to compare |
Returns
boolean — Returns true when the compared values are equal, else returns false
equalText
Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.
Parameters
| Name | Type | Description |
| x | string | Array | DenseMatrix | First string to compare |
| y | string | Array | DenseMatrix | Second string to compare |
Returns
number | Array | DenseMatrix — Returns true if the values are equal, and false if not.
Examples
equalText("Hello
Hello")
equalText("a
A")
equal("2e3
larger
Check if value x is larger than y. Returns true if x is larger than y, and false if not. Comparing a value with NaN returns false.
Syntax
x > y | larger(x | y)
Type Signatures
Fraction, BigNumber, BigNumber, Fraction, Complex, Complex, number, number
Parameters
| Name | Type | Description |
| x | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | First value to compare |
| y | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | Second value to compare |
Returns
boolean | Array | Matrix — Returns true when the x is larger than y, else returns false
Examples
2 > 3
5 > 2*2
a = 3.3
b = 6-2.8
(a > b)
largerEq
Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.
Syntax
x >= y | largerEq(x | y)
Type Signatures
BigNumber, BigNumber, bigint, bigint, Complex, Complex, number, number
Parameters
| Name | Type | Description |
| x | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | First value to compare |
| y | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | Second value to compare |
Returns
boolean | Array | Matrix — Returns true when the x is larger or equal to y, else returns false
Examples
2 >= 1+1
2 > 1+1
a = 3.2
b = 6-2.8
(a >= b)
smaller
Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not. Comparing a value with NaN returns false.
Syntax
x < y | smaller(x | y)
Type Signatures
Fraction, BigNumber, BigNumber, Fraction, Complex, Complex, number, number
Parameters
| Name | Type | Description |
| x | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | First value to compare |
| y | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | Second value to compare |
Returns
boolean | Array | Matrix — Returns true when the x is smaller than y, else returns false
Examples
2 < 3
5 < 2*2
a = 3.3
b = 6-2.8
(a < b)
smallerEq
Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.
Syntax
x <= y | smallerEq(x | y)
Type Signatures
BigNumber, BigNumber, Complex, Complex, number, number
Parameters
| Name | Type | Description |
| x | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | First value to compare |
| y | number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | Second value to compare |
Returns
boolean | Array | Matrix — Returns true when the x is smaller than y, else returns false
Examples
2 <= 1+1
2 < 1+1
a = 3.2
b = 6-2.8
(a <= b)
unequal
Check unequality of two values. Returns true if the values are unequal, and false if they are equal.
Syntax
x != y | unequal(x | y)
Parameters
| Name | Type | Description |
| x | number | BigNumber | Fraction | boolean | Complex | Unit | string | Array | Matrix | undefined | First value to compare |
| y | number | BigNumber | Fraction | boolean | Complex | Unit | string | Array | Matrix | undefined | Second value to compare |
Returns
boolean | Array | Matrix — Returns true when the compared values are unequal, else returns false
Examples
2+2 != 3
2+2 != 4
a = 3.2
b = 6-2.8
a != b