So I have this toy algorithm that is a stripped down version of something I am working on and I have noticed a strange behavior. In the month of July 2014 there it calculates a change in unemployment rate of -0.2 and then does a two sets of comparisons, both simple if unr_diff < -0.2 and in one case it results in false and in the other it says true. What is going on?
This is the relevant part of the code:
log.info("unr_diff: %.2f" % unr_diff)
log.info("unr_diff < -0.2: %s" % unr_diff < -0.2)
if unr_diff < -0.2:
outlook += 0.5
log.info("(unr_diff < -0.2) outlook + .5")
This is the relevant part of the log:
2014-07-07trade_unr:52 INFO unr_diff: -0.20
2014-07-07trade_unr:53 INFO False
2014-07-07trade_unr:57 INFO (unr_diff < -0.2) outlook + .5
2014-07-07trade_unr:60 INFO Outlook: 0.5