Median works in its place on a technicality.
Consider three cases.
1) X < L < H
2) L < X < H
3) L < H < X
in each of these three cases, median picks the middle number. If X < L, median picks L since L happens to be in the middle. If X > H, median picks H since H happens to be in the middle. If L<X<H, median picks X.
However newbies aren't privy to this fact, since the name isn't exactly self explanatory, and it's not normally documented for this purpose. Having a clamp that simply delegates to median would work fine.
Consider three cases.
1) X < L < H
2) L < X < H
3) L < H < X
in each of these three cases, median picks the middle number. If X < L, median picks L since L happens to be in the middle. If X > H, median picks H since H happens to be in the middle. If L<X<H, median picks X.
However newbies aren't privy to this fact, since the name isn't exactly self explanatory, and it's not normally documented for this purpose. Having a clamp that simply delegates to median would work fine.
