bug 441: double precision issue on x86 32bit systems.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed, 10 Dec 2008 02:36:28 -0800
changeset 4007 d6f0c6f47cc4
parent 4006 e5843adc7d22
child 4008 b8feac108e89
bug 441: double precision issue on x86 32bit systems.
src/applications/onoff/onoff-application.cc
--- a/src/applications/onoff/onoff-application.cc	Wed Dec 10 02:10:07 2008 -0800
+++ b/src/applications/onoff/onoff-application.cc	Wed Dec 10 02:36:28 2008 -0800
@@ -165,7 +165,8 @@
     { // Cancel the pending send packet event
       // Calculate residual bits since last packet sent
       Time delta(Simulator::Now() - m_lastStartTime);
-      m_residualBits += (uint32_t)(m_cbrRate.GetBitRate() * delta.GetSeconds());
+      Scalar bits = delta * Scalar (m_cbrRate.GetBitRate ()) / Seconds (1.0);
+      m_residualBits += (uint32_t)bits.GetDouble ();
     }
   Simulator::Cancel(m_sendEvent);
   Simulator::Cancel(m_startStopEvent);