It's not really a major issue, but on occasion when I look for the output of a float number (usually to the thousandths place) and an int, I get a number that has the correct answer, but then a bunch of trailing zeroes and another integer. Here's some code I encountered this in, and my various tests to try isolating the problem:
Code:
def returnit():
return float(17.556)
var1 = 17.556
var2 = (17.556 * 3)
print(returnit() * 3)
print(var1 * 3)
print(var2)
print(str(17.556 * 3))
print(17.556 * 3)
The output for all of them is 52.668000000000006
.
Honestly I'm just curious as to why this happens, and the sum of my research has yielded "uhh... floating points don't do amazingly with math sometimes?"