[Ns-bugs] [Bug 695] DcfManager::UpdateBackoff () uses slow HighPrecision::Div()
code@nsnam.ece.gatech.edu
code at nsnam.ece.gatech.edu
Tue Nov 24 05:51:12 PST 2009
http://www.nsnam.org/bugzilla/show_bug.cgi?id=695
--- Comment #12 from Andrey Mazo <mazo at iitp.ru> 2009-11-24 08:51:11 EDT ---
(In reply to comment #10)
> can you review it for correctness and push if it is ok ? (all tests appear to
> pass, but, who knows...)
I've noticed, that your patch and original code will behave differently in
several situations, because you've replaced lrint() with integer devision,
which works more like floor().
Old code:
Simulator::Now() = 27000;
backoffStart = 10000;
m_slotTime = 9000;
nSlots = (Simulator::Now () - backoffStart) / m_slotTime = 1.88888;
nIntSlots = lrint (nSlots.GetDouble ()) = 2;
New code:
Simulator::Now().GetMicroSeconds() = 27;
backoffStart.GetMicroSeconds() = 10;
m_slotTimeUs = 9;
nus = 27 - 10 = 17;
nIntSlots = nus / m_slotTimeUs = 17/9 = 1;
I don't know, which of the answers is correct according to the standard.
--
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the Ns-bugs
mailing list