1 |
|
2 |
|
3 | # Function smaller
|
4 |
|
5 | Test whether value x is smaller than y.
|
6 |
|
7 | The function returns true when x is smaller than y and the relative
|
8 | difference between x and y is smaller than the configured epsilon. The
|
9 | function cannot be used to compare values smaller than approximately 2.22e-16.
|
10 |
|
11 | For matrices, the function is evaluated element wise.
|
12 | Strings are compared by their numerical value.
|
13 |
|
14 |
|
15 | ## Syntax
|
16 |
|
17 | ```js
|
18 | math.smaller(x, y)
|
19 | ```
|
20 |
|
21 | ### Parameters
|
22 |
|
23 | Parameter | Type | Description
|
24 | --------- | ---- | -----------
|
25 | `x` | number | BigNumber | Fraction | boolean | Unit | string | Array | Matrix | First value to compare
|
26 | `y` | number | BigNumber | Fraction | boolean | Unit | string | Array | Matrix | Second value to compare
|
27 |
|
28 | ### Returns
|
29 |
|
30 | Type | Description
|
31 | ---- | -----------
|
32 | boolean | Array | Matrix | Returns true when the x is smaller than y, else returns false
|
33 |
|
34 |
|
35 | ## Examples
|
36 |
|
37 | ```js
|
38 | math.smaller(2, 3) // returns true
|
39 | math.smaller(5, 2 * 2) // returns false
|
40 |
|
41 | const a = math.unit('5 cm')
|
42 | const b = math.unit('2 inch')
|
43 | math.smaller(a, b) // returns true
|
44 | ```
|
45 |
|
46 |
|
47 | ## See also
|
48 |
|
49 | [equal](equal.md),
|
50 | [unequal](unequal.md),
|
51 | [smallerEq](smallerEq.md),
|
52 | [smaller](smaller.md),
|
53 | [smallerEq](smallerEq.md),
|
54 | [compare](compare.md)
|