Hi Norbert, just to clarify, rscaled is not zero in this case, it's just a small number. The issue is that the ceiling function only applies to the first product in the expression rscaled*inner_zone_grid_inv, and then the int() rounds the second product to the nearest whole number.<br>
<br><div class="gmail_quote">On Tue, Sep 20, 2011 at 10:09 AM, Norbert Flocke <span dir="ltr"><<a href="mailto:flocke@flash.uchicago.edu">flocke@flash.uchicago.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Dear James Guillochon,<br>
<br>
You are right. This is a computer representability issue for very small numbers. In case r falls below the smallest representable number, then<br>
rscaled is zero and the ceiling functions returns 0 as well. Thank you<br>
very much for reporting this issue. It will be fixed right away.<br>
<br>
Regards,<br><font color="#888888">
Norbert Flocke</font><div><div></div><div class="h5"><br>
<br>
<br>
On Tue, 20 Sep 2011, James Guillochon wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi, I've discovered a small bug in Multipole_experimental. In a couple<br>
places in gr_mpolePot* and gr_mpoleMom* there is the following set of lines:<br>
<br>
rscaled = r * dr_inner_zone_inv<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
dr_unit = int (ceiling (rscaled * inner_zone_grid_inv) * inner_zone_grid)<br>
Q_lower = inner_zone_Qlower (dr_unit)<br>
<br>
</blockquote>
<br>
Occasionally, if r is small enough, dr_unit will be 0, which causes an out<br>
of bounds error when referencing inner_zone_Qlower. The fix is to replace<br>
the dr_unit assignments with the following:<br>
<br>
dr_unit = max(int (ceiling (rscaled * inner_zone_grid_inv) *<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
inner_zone_grid), 1)<br>
<br>
</blockquote>
<br>
Cheers,<br>
- James<br>
<br>
-- <br>
James Guillochon<br>
Department of Astronomy & Astrophysics<br>
University of California, Santa Cruz<br>
<a href="mailto:jfg@ucolick.org" target="_blank">jfg@ucolick.org</a><br>
<br>
</blockquote>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>James Guillochon<br>Department of Astronomy & Astrophysics<br>University of California, Santa Cruz<br><a href="mailto:jfg@ucolick.org" target="_blank">jfg@ucolick.org</a><br>