unaryMinus
Returns the negative of this decimal.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
val x: Decimal = Decimal.parse("3.14")
val result: Decimal = -x
val expected: Decimal = Decimal.parse("-3.14")
check(result == expected)Content copied to clipboard
Calling from Java
Here's an example of calling this function from Java code:
final Decimal x = Decimal.parse("3.14");
final Decimal result = x.unaryMinus();
final Decimal expected = Decimal.parse("-3.14");
final boolean check = result.equals(expected);
if (!check) throw new IllegalStateException("Check failed.");Content copied to clipboard