The current implementation of transform in class Float2Scalar uses the conversion method .astype(int) which rounds down by default. I have observed a floating point error where 0.3 scales by 100 to 29.999997 which rounds down to 29 instead of the desired 30.
Proposing a three line fix to use a np.rint() check to round to the nearest integer instead of .astype(int) when values are closer than $10^{-8}$ to the nearest integer.
The current implementation of
transformin classFloat2Scalaruses the conversion method.astype(int)which rounds down by default. I have observed a floating point error where0.3scales by 100 to29.999997which rounds down to29instead of the desired30.Proposing a three line fix to use a$10^{-8}$ to the nearest integer.
np.rint()check to round to the nearest integer instead of.astype(int)when values are closer than