[issue1811] True division of integers could be more accurate

Mark Dickinson report at bugs.python.org
Sat Jan 12 06:20:29 CET 2008


New submission from Mark Dickinson:

Division of two longs can produce results that are needlessly 
inaccurate:

>>> from __future__ import division
>>> 10**40/10**39
10.000000000000002

The correct result is, of course, 10.0, which is exactly representable 
as a float.

The attached snippet of Python code shows that things don't have to be 
this way.

----------
files: int_truediv.py
messages: 59798
nosy: marketdickinson
severity: minor
status: open
title: True division of integers could be more accurate
type: behavior
Added file: http://bugs.python.org/file9137/int_truediv.py

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1811>
__________________________________


More information about the Python-bugs-list mailing list