JRaz Posted June 12, 2006 Share Posted June 12, 2006 which one of the above is faster? and is pow(x,1/3) the only way to do cube root? Link to comment https://forums.phpfreaks.com/topic/11768-sqrtx-vs-powx12/ Share on other sites More sharing options...
Barand Posted June 12, 2006 Share Posted June 12, 2006 1 ) sqrt()[code]$t1 = microtime(true);for($i=1;$i<=1000;$i++){ $x = sqrt($i);}$t2 = microtime(true);for($i=1;$i<=1000;$i++){ $y = pow($i, 1/2);}$t3 = microtime(true);echo 'sqrt : ', $t2-$t1, '<br>';echo 'pow : ', $t3-$t2, '<br>';[/code]2 ) AFAIK it is the only way. Link to comment https://forums.phpfreaks.com/topic/11768-sqrtx-vs-powx12/#findComment-44553 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.