Python3,float and math, what the hell?

So it was late at night and I was hacking away at my touch-controls for my UnicornHat. I was trying to set the brightness in nine steps between 0.1 and 0.9. When all of a sudden, this happened: >>> foo=0.1 >>> foo+=0.1 >>> print(foo) 0.2 >>> foo+=0.1 >>> print(foo) 0.30000000000000004 So according to my internal senses this looked not very precise. But according to the almighty Stackoverflow and one of my beloved coworkers who can indeed speak ASM fluently, this is in fact very precise (for a float)....

2016-03-14 · 1 min · 183 words · Jan