OMNeT++/OMNEST Bug Tracker - OMNeT++
View Issue Details
0000043OMNeT++simulation kernelpublic2009-01-13 13:402010-04-23 18:49
baumgart 
andras 
highmajoralways
resolvedfixed 
4.0rc1 
4.1 
0000043: truncnormal() sometimes returns INFINITY
truncnormal() sometimes returns infinity

With a propability of 2^32 genk_dblrand(rng) returns 0. In this case normal() returns infinity (log(0)).

This probably effects other distribution functions with use log() as well.
No tags attached.
Issue History
2009-01-13 13:40baumgartNew Issue
2009-01-13 13:40baumgartAssigned To => andras
2009-08-27 13:00stkrauseNote Added: 0000167
2009-11-09 18:38rhornigNote Added: 0000193
2009-11-09 18:38rhornigPrioritynormal => high
2010-04-23 18:49andrasNote Added: 0000243
2010-04-23 18:49andrasStatusnew => resolved
2010-04-23 18:49andrasFixed in Version => 4.1
2010-04-23 18:49andrasResolutionopen => fixed

Notes
(0000167)
stkrause   
2009-08-27 13:00   
This bug still affects the current release. It does not only affect truncnormal(), but all other functions that call log(genk_dblrand()).

Additionally, (trunc)normal can return NaN if it is called with a deviation parameter of 0.

This can really break results in a simulation in unpredictable ways.

A possible fix would be to create a gend_dblrand_nonzero() (the random number generators already support this, it is just not easily accessible from outside) and use it instead of genk_dblrand in those functions.
(0000193)
rhornig   
2009-11-09 18:38   
A similar issue is occurring with the exponential distribution returning INF if the provided argument is 0 or very small. Generally we should not return INF.
the call that led to a Inf value was actually exponential(1/(1770E6))
(0000243)
andras   
2010-04-23 18:49   
Affected distributions: normal(), truncnormal(), exponential(), geometric().

Actually, internally we should have used uniform variables on (0,1] not [0,1). Resolved by replacing dblrand() with 1.0-dblrand().

Other distributions containing log() seem to be correct (already contain 1-U).

This fix will change simulation fingerprints!