Refactoring using mathematical properties of min(bor0.wordpress.com)
bor0.wordpress.com
Refactoring using mathematical properties of min
https://bor0.wordpress.com/2018/06/15/refactoring-using-mathematical-properties-of-min/
1 comments
The blog post doesn't mention integer overflows. If integers wrap around on overflow, min(INT_MIN - 1, 0 - 1) = -1 but min(INT_MIN, 0) - 1 = INT_MAX. However, in PHP the values are converted to floats, which should preserve the equation min(a -c, b - c) = min(a, b) - c.