3 ms·
Most of the ternary implementations here are less correct than the original. You generally want min/max to satisfy the following: 1. min/max of NaN and anythin
by ridiculous_fish 6y ago
Most of the ternary implementations here are less correct than the original. You generally want min/max to satisfy the following:
1. min/max of NaN and anything is NaN
2. negative 0 is strictly smaller than positive 0
it's a fun exercise to implement clamp under these constraints.