Help for this page

Select Code to Download


  1. or download this
    16:46 >perl -wE "my $cube_root = (-8)**(1/3); say $cube_root;"
    NaN
    ...
    16:46 >perl -v
    
    This is perl 5, version 32, subversion 1 (v5.32.1) built for MSWin32-x
    +64-multi-thread
    
  2. or download this
    sub cube_root
    {
    ...
    
        return (abs( $n ) ** (1 / 3)) * ($n < 0 ? -1 : 1);
    }