(-1)^i for integer i replaced with ?: test
Invoking std::pow to compute this was both unnecessary and caused
confusion for some older compiler versions. Replaced by a ternary
operator test ? : as there are only two possible outcomes.