[FLASH-USERS] Indexing Bug in Multipole_experimental

Norbert Flocke flocke at flash.uchicago.edu
Tue Sep 20 13:09:59 EDT 2011


Dear James Guillochon,

You are right. This is a computer representability issue for very small 
numbers. In case r falls below the smallest representable number, then
rscaled is zero and the ceiling functions returns 0 as well. Thank you
very much for reporting this issue. It will be fixed right away.

Regards,
Norbert Flocke


On Tue, 20 Sep 2011, James Guillochon wrote:

> Hi, I've discovered a small bug in Multipole_experimental. In a couple
> places in gr_mpolePot* and gr_mpoleMom* there is the following set of lines:
>
> rscaled = r * dr_inner_zone_inv
>> dr_unit = int (ceiling (rscaled * inner_zone_grid_inv) * inner_zone_grid)
>> Q_lower = inner_zone_Qlower (dr_unit)
>>
>
> Occasionally, if r is small enough, dr_unit will be 0, which causes an out
> of bounds error when referencing inner_zone_Qlower. The fix is to replace
> the dr_unit assignments with the following:
>
> dr_unit = max(int (ceiling (rscaled * inner_zone_grid_inv) *
>> inner_zone_grid), 1)
>>
>
> Cheers,
> - James
>
> -- 
> James Guillochon
> Department of Astronomy & Astrophysics
> University of California, Santa Cruz
> jfg at ucolick.org
>



More information about the flash-users mailing list