Unallow float to be given to DecimalConverter.convert due to safety reasons
repr(float) seems to be doing a good job while representing decimals since:
- Decimal(0.1) results in Decimal('0.1000000000000000055511151231257827021181583404541015625') but:
- Decimal(repr(0.1)) results in Decimal('0.1')
But overall in case of high-precision integers like:
- 2**53 + 1 which results in 9007199254740993 (correctly) vs:
- repr(float(2**53 + 1)) which results in 9007199254740992.0
some rounding happens since floats cannot represent values over 53 bits. And in our case we need to use int64, so this might be an issue.
Since the float type was accepted only due to simplier developer usage, this issue was addressed so in the future there will no place for such a mistake.
Instead of float, just a literal string like '0.1' could be given, or when some calculation required - Decimals could be used.
See: