There are two methods to calculate the median of an interval [low, high].
- m = ( l + h ) / 2
- m = l + ( h – l ) / 2
l + h may have addition overflow, but h-l will not. Therefore, it is best to use the second method of calculation.
There are two methods to calculate the median of an interval [low, high].
l + h may have addition overflow, but h-l will not. Therefore, it is best to use the second method of calculation.