Included cmath in common.hpp to avoid isnan complaints from the xcode co...

...mpiler
Thanks for the comments @Yangqing ! I should have noticed that before committing.