Analyzing uses of abs(SIGNED) in a large software system several years ago, I found that the most useful replacement was `UNSIGNED absdiff(SIGNED a, SIGNED b)`. The _absolute_ difference of two N-bit signed numbers can always fit in an N-bit unsigned number, but lots of `abs(a-b)` involve intermediate values which don't fit in the SIGNED type and thus invoke undefined behavior. The system was in C++, so it was possible to provide an absdiff template that covered all integral types. However, actually using it tended to introduce cascading type changes because the types of the expressions `abs(a-b)` and `absdiff(a,b)` differed.