Make sure to use double only when call std::pow.