UNPKG

1.01 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function unaryMinus
4
5Inverse the sign of a value, apply a unary minus operation.
6
7For matrices, the function is evaluated element wise. Boolean values and
8strings will be converted to a number. For complex numbers, both real and
9complex value are inverted.
10
11
12## Syntax
13
14```js
15math.unaryMinus(x)
16```
17
18### Parameters
19
20Parameter | Type | Description
21--------- | ---- | -----------
22`x` | number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Number to be inverted.
23
24### Returns
25
26Type | Description
27---- | -----------
28number &#124; BigNumber &#124; Fraction &#124; Complex &#124; Unit &#124; Array &#124; Matrix | Returns the value with inverted sign.
29
30
31## Examples
32
33```js
34math.unaryMinus(3.5) // returns -3.5
35math.unaryMinus(-4.2) // returns 4.2
36```
37
38
39## See also
40
41[add](add.md),
42[subtract](subtract.md),
43[unaryPlus](unaryPlus.md)