On 1/05/20 8:33 pm, R.Wieser wrote:

getcontext().rounding=ROUND_HALF_UP

print(round(1.5))
print(round(2.5))

If you're talking about getcontext() from the decimal module,
that only affects operations with Decimals, not regular floats.
Python doesn't provide a way to change the rounding mode for
floats.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to