mirror of
https://github.com/josdejong/mathjs.git
synced 2026-02-01 16:07:46 +00:00
1.5 KiB
1.5 KiB
| layout |
|---|
| default |
Function unaryMinus #
Inverse the sign of a value, apply a unary minus operation.
For matrices, the function is evaluated element wise. Boolean values and strings will be converted to a number. For complex numbers, both real and complex value are inverted.
Syntax #
math.unaryMinus(x)
Parameters #
| Parameter | Type | Description |
|---|---|---|
x |
number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Number to be inverted. |
Returns #
| Type | Description |
|---|---|
| number | BigNumber | Fraction | Complex | Unit | Array | Matrix | Returns the value with inverted sign. |
Throws #
| Type | Description |
|---|
Examples #
math.unaryMinus(3.5) // returns -3.5
math.unaryMinus(-4.2) // returns 4.2