Checked::checked_neg
fn checked_neg(S a) -> Option<S> Import
Source: use arith::{Checked}; src/arith.hy -a, or None when it does not fit.
Parameters#
| Name | Type |
|---|---|
a | S |
Returns#
Option<S>
See also#
Checked: Integer arithmetic that returnsNoneinstead of panicking when the result does not fit.Checked::checked_add:a + b, orNonewhen it does not fit.Checked::checked_sub:a - b, orNonewhen it does not fit.Checked::checked_mul:a * b, orNonewhen it does not fit.Checked::checked_div:a / b, orNonewhenbis zero or the quotient does not fit.Checked::checked_rem:a % b, orNonewhenbis zero.Checked::checked_pow:a ** exp, orNonewhen it does not fit orexpis negative.Checked::checked_shl:a << n, orNonewhennis outside0..=63.