Checked::checked_sub
fn checked_sub(S a, S b) -> Option<S> Import
Source: use arith::{Checked}; src/arith.hy a - b, or None when it does not fit.
Parameters#
| Name | Type |
|---|---|
a | S |
b | 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_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_neg:-a, orNonewhen it does not fit.Checked::checked_pow:a ** exp, orNonewhen it does not fit orexpis negative.Checked::checked_shl:a << n, orNonewhennis outside0..=63.