Replace pow() with iterative multiplication