operator unary- method
The negation of this value.
The negation of a number is a number of the same kind (int
or double
) representing the negation of the numbers numerical value (the result of subtracting the number from zero), if that value exists.
Negating a double gives a number with same magnitude as the original value (number.abs() == (-number).abs()
), and the opposite sign (-(number.sign) == (-number).sign
).
Negating an integer, -number
, is equivalent to subtracting it from zero, 0 - number
.
(Both properties generally also hold for the other type, but with a few edge case exceptions).
Implementation
double operator -();
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-core/double/operator_unary_minus.html