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