is int(round(val)) safe?
Russell E. Owen
rowen at cesmail.net
Mon Nov 22 14:13:17 EST 2004
I realize this probably a stupid question, but...is it safe to
round to the nearest integer by using int(round(val))?
I suspect it is fine, but wanted to be sure that weird floating point
representation on some platform might make it unsafe there (i.e. get the
wrong value due to the floating point value being an approximation) and
if so, is there a Better Way).
-- Russell
More information about the Python-list
mailing list