material-range-bar
material-range-bar copied to clipboard
float number precision loss when the range is large.
Since all the methods like setTickStart(), setTickEnd(), setTickInterval(),setRangePinsByValue() and the others all take float values, when the range is large the numbers loose precision and hence loose data. Please take note on this issue
Hi, please use this code to fix setRangePinsByValue() in RangeBar:
mLeftIndex = Math.round((leftPinValue - mTickStart) / mTickInterval);
mRightIndex = Math.round((rightPinValue - mTickStart) / mTickInterval);
instead of (incorrect)
mLeftIndex = (int) ((leftPinValue - mTickStart) / mTickInterval);
mRightIndex = (int) ((rightPinValue - mTickStart) / mTickInterval);
Hope it will helpful.
thanx..i ended up doing just that. sorry for not posting the same earlier