Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
When I try to run your code, I get an incorrect answer for the root. I think the problem is in the exponent. The exponents are $root and ($root - 1), respectively.

When I run this code:
timethese( 100, { 'Root' => '$x = Root( 100, 3 )', 'Root2' => '$y = Root2( 100, 3 )', }); print <<END; Root: $x ----- Root2: $y END
I get this for output:
Benchmark: timing 100 iterations of Root, Root2... Root: 29 wallclock secs (28.39 usr + 0.00 sys = 28.39 CPU) @ 3 +.52/s (n=1 00) Root2: 20 wallclock secs (20.03 usr + 0.00 sys = 20.03 CPU) @ 4 +.99/s (n=1 00) Root: 4.6415888336127788924100763542328778501807372125002714 ----- Root2: 0.6664902595019951166742874561807256134735

___________________
Kurt

In reply to Re: Re: Help w/ Code Optimization by sifukurt
in thread Help w/ Code Optimization by sifukurt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-25 16:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found