Serious error in int() function?
Peter Otten
__peter__ at web.de
Wed Apr 13 04:03:00 EDT 2016
martin.spichty at gmail.com wrote:
> Hi,
>
> there may be a serious error in python's int() function:
>
> print int(float(2.8/0.1))
>
> yields
>
> 27
>
> instead of 28!!
>
> I am using Python Python 2.7.6, GCC 4.8.2 on Linux Ubuntu.
>
> Is that known?
Yes. C has the same error as has every other language that uses the floating
point numbers supported by your computer's hardware. See
https://docs.python.org/2/tutorial/floatingpoint.html
More information about the Python-list
mailing list