Improved pow implementation and return type.