Improved pow performance by using repeated squaring