negative zero in python
问题 I encountered negative zero in output from python; it\'s created for example as follows: k = 0.0 print(-k) The output will be -0.0 . However, when I compare the -k to 0.0 for equality, it yields True. Is there any difference between 0.0 and -0.0 (I don\'t care that they presumably have different internal representation; I only care about their behavior in a program.) Is there any hidden traps I should be aware of? 回答1: Check out : −0 (number) in Wikipedia Basically IEEE does actually define a