in reply to Which function for third root of number ?

27 ** (1/3), which may cause some roundoff error.

Replies are listed 'Best First'.
Re^2: Which function for third root of number ?
by xorl (Deacon) on Jul 09, 2004 at 15:04 UTC
    If you're looking for perfect cubes ....
    use POSIX qw(ceil floor); if (ceil($num ** 1/3) == floor($num ** 1/3)) { print $num . " is a cube of " $num ** 1/3; } else { print $num . " is not a perfect cube."; }
    Like all of my code the above is untested and comes with no warrenty implied or otherwise.