I'm doing some stuff with the module
Astro::Units whose pod suggests to explicitly use
bignum. The program works fine until I try doing some simple arithmetic. I can't reproduce the error with an SSCE so here are the errors and the calculations causing them:
Deep recursion on subroutine "Math::BigFloat::bdiv" at /5.26.2/Math/BigInt.pm line 1867.
Deep recursion on subroutine "Math::BigInt::Calc::_lsft" at /5.26.2/Math/BigFloat.pm line 1948.
Deep recursion on anonymous subroutine at /5.26.2/Math/BigInt/Calc.pm line 1412.
Deep recursion on subroutine "Math::BigInt::bdiv" at /5.26.2/Math/BigInt.pm line 54.
Here's the math and the results when loading and not loading (but not directly using) both bignum and Astro::Units:
perl -le '$Da=406700; $Dp=356400; $Dm=361918; $pct = ($Da - $Dm) / ($D
+a - $Dp); print $pct'
0.890298210735586
perl -Mbignum -le '$Da=406700; $Dp=356400; $Dm=361918; $pct = ($Da - $
+Dm) / ($Da - $Dp); print $pct'
0.8902982107355864811133200795228628230616
perl -Mbignum -MAstro::Units -le '$Da=406700; $Dp=356400; $Dm=361918;
+$pct = ($Da - $Dm) / ($Da - $Dp); print $pct'
0.8902982
perl -MAstro::Units -le '$Da=406700; $Dp=356400; $Dm=361918; $pct = ($
+Da - $Dm) / ($Da - $Dp); print $pct'
0.890298210735586
Can anyone see what's going on here? That third result is puzzling. What could be causing such errors? Thanks!
-
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.