<martin.spic...@gmail.com> a écrit dans le message de news:52f7516c-8601-4252-ab16-bc30c59c8...@googlegroups.com...
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?
Best,
Martin


I have a similar question, so I post my message here.
Hope this will not annoy the OP


Is it sure that the square root of a square number is always
an integer ?

I would not like to get a result as 345.99999999

from math import sqrt

sqrt(16)
4.0
sqrt(16).is_integer()
True

for n in range(1000000):
...         if not sqrt(n**2).is_integer():
...             print(sqrt(n**2))

it seems to work ... but does it work for all integers ?



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

Reply via email to