QUERY · ISSUE
MICROPY_PY_BUILTINS_ROUND_INT==0 breaks round(<int>, <n>)
Before https://github.com/micropython/micropython/commit/b318ebf1015ced6354f8bbaf035308214b3f5c5d, which was a rework of #3557, round(<int>, <n>) worked. Now, if MICROPY_PY_BUILTINS_ROUND_INT is set to 0, round(2, 2) or similar throws NotImplementedError. round(2) still works.
@dpgeorge Was it your intention to disable rounding of integers in this way completely, instead of just not handling negative values for the second arg if it was an int?
A user discovered this after ending up with an integer zero while doing some floating arithmetic.
CANDIDATE · ISSUE
round(x, -1) is not implemented for integers, whereas it is in CPython
round(x, -1) is not implemented for integers, whereas it is both in CPython and for floats in MicroPython.
MicroPython v1.9.2-87-gda8c4c26 on 2017-09-13; PYBv1.1 with STM32F405RG
>>> x = 98836
>>> round(x, -1)
98836
>>> x = 98836.
>>> round(x, -1)
98840.0
In CPython:
In [1]: x = 98836
In [2]: round(x, -2)
Out[2]: 98800
Some more information: https://stackoverflow.com/a/3349102/2192488