On a general note, I consider it unwise of the module author to use bignum and doubly-unwise for them to recommend that everyone using their module should do so. Each of bignum, bigint, bigrat can be fine and useful for simple one-liners, but for anything more complex they are very likely to cause problems.

For this specific issue, note that the current Math::BigInt maintainer has made wide-reaching changes multiple times in recent months in an attempt to make the interactions between the different classes behave more sanely in the context of use bignum; it is not clear to me whether it has now reached a stable point. So you may want to try both more recent and older versions of the distribution - check the changelog for references to "upgrading and downgrading".

For getting the calculations you are using to work reliably, I suggest ditching bignum; instead instantiate your numbers as Math::BigFloat, and hope that the use of bignum inside Astro::Units doesn't result in unexpected conversions to Math::BigInt or Math::BigRat.

Note that you should also be able to change the Math::BigFloat configuration after loading Astro::Units, if the latter's choices are not suitable for your needs.


In reply to Re: Deep recursion on subroutine with bignum and Astro::Units by hv
in thread Deep recursion on subroutine with bignum and Astro::Units by Anonymous Monk

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.