函数 larger #
测试值 x 是否大于 y。
当 x 大于 y,并且 x 和 y 之间的相对差大于配置的 relTol 和 absTol 时,该函数返回 true。该函数不能用于比较小于大约 2.22e-16 的值。
对于矩阵,该函数是逐元素计算的。字符串按其数值大小进行比较。
Syntax #
math.larger(x, y)
Parameters #
| Parameter | Type | Description |
|---|---|---|
x |
number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | 要比较的第一个值 |
y |
number | BigNumber | bigint | Fraction | boolean | Unit | string | Array | Matrix | 要比较的第二个值 |
Returns #
| Type | Description |
|---|---|
| boolean | Array | Matrix | 当 x 大于 y 时返回 true,否则返回 false。 |
Throws #
Type | Description —- | ———–
Examples #
math.larger(2, 3) // returns false
math.larger(5, 2 + 2) // returns true
const a = math.unit('5 cm')
const b = math.unit('2 inch')
math.larger(a, b) // returns false