cubic root subroutine

A

Arndt Jonasson

I'm still at a loss as to why Math::Complex's cbrt() isn't
considered sufficient.

c:\users\jgamble>perl -MMath::Complex -le "print cbrt(64);"
4

Somehow I missed your suggestion when I continued to critizise the
"**(1/3)" solution. Sorry about that. 'cbrt' seems to take care about
integerness (whether that is guaranteed I couldn't see from a quick
glance in the manual):

arndt ~/perl 4359> perl -MMath::Complex -le "print (cbrt(64)==4);"
1
arndt ~/perl 4360> perl -le "print (((64)**(1/3))==4)"

arndt ~/perl 4361>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top