[Ns-developers] Bug in shadowing.cc

Marcello Caleffi marcello.caleffi at unina.it
Mon Jan 28 02:58:06 PST 2008


In the function Shadowing::Pr() the avg_db is calculated as
-10.0 * pathLossExp_ * log10(dist/dis0)
without checking if dist is equal to 0, as happens if the send and  
the recv node have the same position. If so, an arithmetic exception  
happens.

What about adding a check as the following:
if (dist == 0)
    dist = 1e-23;
before the avg_db computation?

-----------------------------------------

Marcello Caleffi
Department of Electronic and Telecommunication Engineering
University of Naples "Federico II"
21 Claudio street - 80125 Naples ITALY
Tel +39-(0)81-7683810. Fax +39-(0)81-7683149
http://wpage.unina.it/marcello.caleffi/




More information about the Ns-developers mailing list