I had to add `#include <cmath>` here to get it to build on OS X. (I haven't checked to see if this affects other platforms.)