OMNeT++/OMNEST Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000693OMNeT++simulation kernelpublic2013-12-08 19:382013-12-09 10:30
Reporterwoife 
Assigned Toandras 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version4.3.1 
Target VersionFixed in Version4.4 
Summary0000693: truncnormal can return negative values
Description
The documentation for the function truncnormal states the following:
"Normal distribution truncated to nonnegative values." [1]

There is a SimTime-version of truncnormal, and this version can return negative values:

-----------[ Code in OMNeT/include/distrib.h ------------------------------
/**
 * Normal distribution truncated to nonnegative values.
 * It is implemented with a loop that discards negative values until
 * a nonnegative one comes. This means that the execution time is not bounded:
 * a large negative mean with much smaller stddev is likely to result
 * in a large number of iterations.
 *
 * The mean and stddev parameters serve as parameters to the normal
 * distribution before truncation. The actual random variate returned
 * will have a different mean and standard deviation.
 *
 * @param mean mean of the normal distribution
 * @param stddev standard deviation of the normal distribution
 * @param rng the underlying random number generator
 */
SIM_API double truncnormal(double mean, double stddev, int rng=0);

/**
 * SimTime version of truncnormal(double,double,int), for convenience.
 */
inline SimTime truncnormal(SimTime mean, SimTime stddev, int rng=0) {return normal(mean.dbl(), stddev.dbl(), rng);}
------------------------------------------------------------------

The problem here is that the SimTime-version internally does not call truncnormal(), but the standard normal() function.

[1] http://www.omnetpp.org/doc/omnetpp/api/group__RandomNumbersCont.html#ge59607f50d297c0f8ce72b833c343c50 [^]
Additional InformationI don't know OMNeT well enough for the 'Category' where this bug fits, so I have chosen 'simulation kernel'.
Please adjust as appropriate.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0000858)
andras (administrator)
2013-12-09 10:30

Thanks for the report, came just in time to be included in OMNeT++ 4.4. It was a copy-paste bug, fixed.

- Issue History
Date Modified Username Field Change
2013-12-08 19:38 woife New Issue
2013-12-09 10:30 andras Note Added: 0000858
2013-12-09 10:30 andras Status new => resolved
2013-12-09 10:30 andras Fixed in Version => 4.4
2013-12-09 10:30 andras Resolution open => fixed
2013-12-09 10:30 andras Assigned To => andras


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker