OMNeT++/OMNEST Bug Tracker - OMNeT++
View Issue Details
0001038OMNeT++simulation kernelpublic2018-05-15 13:292018-06-19 16:59
levy 
andras 
normalminoralways
closedfixed 
5.3 
5.4 
0001038: SimTime::operator/ may lose precision unnecessarily
The SimTime::operator/ often converts the simulation time to double and calculate with the double instead. This often leads to unnecessary precision loss in the result. In such cases, the calculation could be done without precision loss (e.g. 12 / SimTime(0.3) -> exact 40, or SimTime(0.00012) / SimTime(0.0003) -> exact 4)

Maybe the best would be to introduce a new division operation into SimTime and use that where precision loss is unacceptable (e.g. Ieee80211ModeSet). It would give a hint for the future maintainers not to "fix the code".
No tags attached.
Issue History
2018-05-15 13:29levyNew Issue
2018-06-19 16:57andrasStatusnew => closed
2018-06-19 16:57andrasAssigned To => andras
2018-06-19 16:57andrasResolutionopen => fixed
2018-06-19 16:57andrasFixed in Version => 5.4
2018-06-19 16:59andrasNote Added: 0001361

Notes
(0001361)
andras   
2018-06-19 16:59   
Division is done using integer arithmetic as long as possible, and only falls back to floating-point division if necessary.