Given a real (n), a maximum value this real can be (upper), and a minimum value this real can be (lower), how can we most efficiently clip n, such that it remains between lo
Inelegant, unsafe, costly but branchless:
n= 0.5 * (n + lower + fabs(n - lower)); n= 0.5 * (n + upper - fabs(upper - n));