Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

How to get better exponentiation?

by Athanasius (Archbishop)
on Jan 22, 2022 at 07:14 UTC ( [id://11140698]=perlquestion: print w/replies, xml ) Need Help??

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);
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11140698]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-19 09:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found