Closed CMCDragonkai closed 3 years ago
These changes were essential to fixing the IdSortable
:
// if the fractional is rounded to 1
// then it should be added to the integer
if (fractional === 1) {
integer += fractional;
fractional = 0;
}
// floor is used to round down to a number that can be represented by the bit size
// if ceil or round was used, it's possible to return a number that would overflow the bit size
// for example if 12 bits is used, then 4096 would overflow to all zeros
// the maximum for 12 bit is 4095
const fractionalFixed = Math.floor(fractional * (2 ** size));
return [integer, fractionalFixed];
Description
Issues Fixed
Tasks
toFixedPoint
check if the fractional becomes1
and adds it to theinteger
Math.round
toMath.floor
in assignment offractionalFixed
to avoid4096
in 12 bits intoFixedPoint
toFixedPoint
andfromFixedPoint
IdSortable
is producing bad ids after a long timeFinal checklist