Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Treatment saturatingSub

std/ops/num::saturatingSub


Generics

◻ N: SaturatingSub

Inputs

⇥ a: Stream<N>
⇥ b: Stream<N>

Outputs

↦ diff: Stream<N>


Substract values from two streams, saturating to bounds.

Values passed through b are substracted to a and send in diff. This treatment is infaillible and saturate to the closest bound, minimal or maximal, if a - b is out of bounds for the data type.