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 saturatingAdd

std/ops/num::saturatingAdd


Generics

◻ N: SaturatingAdd

Inputs

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

Outputs

↦ sum: Stream<N>


Add values from two streams, saturating to bounds.

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