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.

44 lines (26 loc) 987 B
# Function unaryPlus Unary plus operation. Boolean values and strings will be converted to a number, numeric values will be returned as is. For matrices, the function is evaluated element wise. ## Syntax ```js math.unaryPlus(x) ``` ### Parameters Parameter | Type | Description --------- | ---- | ----------- `x` | Number &#124; BigNumber &#124; Boolean &#124; String &#124; Complex &#124; Unit &#124; Array &#124; Matrix &#124; null | Input value ### Returns Type | Description ---- | ----------- Number &#124; BigNumber &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Returns the input value when numeric, converts to a number when input is non-numeric. ## Examples ```js math.unaryPlus(3.5); // returns 3.5 math.unaryPlus(1); // returns 1 ``` ## See also [unaryMinus](unaryMinus.md), [add](add.md), [subtract](subtract.md) <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->