♻️ HalfStepInt
refactor
#307
Labels
type: refactor ♻️
Code change that neither fixes a bug nor adds a feature
HalfStepInt
refactor
#307
♻️ Refactor
HalfStepInt
was introduced to deal with possible half-step values (0.5) that might appear when we calculate the median of integers.The current implementation of
HalfStepInt
uses a number of typeT
to represent the integer part of a number. However, this is more prone to an overflow while calculating the median than usinguint64
. The current implementation is also confusing in that theinteger
field and theneg
field are both used to infer the sign of the number. This issue calls for refactoring the code so that it conforms to the following, more straightforward, type:In addition, detect any possible overflow and handle it properly.
The text was updated successfully, but these errors were encountered: