[Ns-bugs] [Bug 100] New: DefaultValue::Bind() is not correct for floating points
bugzilla-daemon@nsnam-www.ece.gatech.edu
bugzilla-daemon at nsnam-www.ece.gatech.edu
Fri Nov 2 07:47:43 PDT 2007
http://www.nsnam.org/bugzilla/show_bug.cgi?id=100
Summary: DefaultValue::Bind() is not correct for floating points
Product: ns-3
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P3
Component: simulation core
AssignedTo: ns-bugs at isi.edu
ReportedBy: tomh at tomh.org
This code snippet does not work:
NumericDefaultValue<double> y ("test-y", "help-y", 10.0);
DefaultValue::Bind ("test-y", "0"); // fails
DefaultValue::Bind ("test-y", "-1.0"); //fails
DefaultValue::Bind ("test-y", "1.0"); // OK
This bind will fail unless the default value passed is greater than zero.
The problem is in NumericDefaultValue::DoParseValue because the value is
compared against std::numeric_limits<double>::min() and max(), which are both
positive numbers.
One change would be to separate integer from float default values. However, I
question whether the DoParseValue() code is even doing the right thing, because
the act of passing the string value into a numeric value before the comparison
is made is going to put this test m_value within range of the numeric limits.
So perhaps the right solution is to remove these checks for
NumericDefaultValue?
--
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Ns-bugs
mailing list