|
||||
|
Hi all, I've got a semi-urgent (I'd love to know by Sunday) question that hopefully somebody here can answer: I've written a program that, at one point, does the following: value = 0 for i in range(12): value += 1.2 return value The problem is, instead of the expected 14.4, it returns 14.399999999999997. This isn't just an issue with my program...the interactive Python prompt does the same thing. It reminds me of something I saw in a class I took in C, a sort of "fix the bugs" assignment...but I didn't exactly do well in that class, so I haven't got a clue what the problem is. For reference, I'm using Python 2.5 on Mac OS X (Intel). If anyone has any thoughts and/or manages to duplicate the bug, please let me know. Edit: That should in fact be an indent in that 'for' loop, but apparently LJ deletes line-initial whitespace? |
||||
|
|
