Hmm .. I suppose you want Math::BigNum and not the unknown bugnum module.

And .. after that, this module does have log functions ..

... $x->blog(); # logarithm of $x to base e (Euler's number) $x->blog($base); # logarithm of $x to base $base (e.g., base 2) $x->bexp(); # calculate e ** $x where e is Euler's number $x->bilog2(); # log2($x) rounded down to nearest int $x->bilog10(); # log10($x) rounded down to nearest int $x->bclog2(); # log2($x) rounded up to nearest int $x->bclog10(); # log19($x) rounded up to nearest int ...
The log functions are called blog.

If I run this ..

tab@music4:~/Pianoforte/Perlmonks 21:54:45 $ cat !$ cat 11156670.pl #!/usr/bin/perl use strict; use warnings; # use Math::BigNum; { print "Log of .5 is " . log(0.5) . "\n"; } tab@music4:~/Pianoforte/Perlmonks 21:54:51 $ ./11156670.pl Log of .5 is -0.693147180559945 tab@music4:~/Pianoforte/Perlmonks 21:54:57 $
.. I get a good value. That presumably uses Perl's built in log function.

I can strongly recommend a complete, self-contained example that shows the output .. this will help you solve things faster.

Alex / talexb / Toronto

Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.


In reply to Re: log(0.5) with bignum blows up by talexb
in thread log(0.5) with bignum blows up by jimav

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.