Compute pow function like snoopyjc suggested