Re:Refactoring using mathematical properties of min
by UniQP on Friday June 15, 2018 @10:00AM
(#17319800)
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.
[ Parent
| on HN ]