UNPKG

mathjs

Version:

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices.

55 lines (35 loc) 1.38 kB
# Function smaller Test whether value x is smaller than y. The function returns true when x is smaller than y and the relative difference between x and y is larger than the configured epsilon. The function cannot be used to compare values smaller than approximately 2.22e-16. For matrices, the function is evaluated element wise. ## Syntax ```js math.smaller(x, y) ``` ### Parameters Parameter | Type | Description --------- | ---- | ----------- `x` | Number &#124; BigNumber &#124; Boolean &#124; Unit &#124; String &#124; Array &#124; Matrix &#124; null | First value to compare `y` | Number &#124; BigNumber &#124; Boolean &#124; Unit &#124; String &#124; Array &#124; Matrix &#124; null | Second value to compare ### Returns Type | Description ---- | ----------- Boolean &#124; Array &#124; Matrix | Returns true when the x is smaller than y, else returns false ## Examples ```js math.smaller(2, 3); // returns true math.smaller(5, 2 * 2); // returns false var a = math.unit('5 cm'); var b = math.unit('2 inch'); math.smaller(a, b); // returns true ``` ## See also [equal](equal.md), [unequal](unequal.md), [smallerEq](smallerEq.md), [larger](larger.md), [largerEq](largerEq.md), [compare](compare.md) <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->