View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] |
ID | Project | Category | View Status | Date Submitted | Last Update |
0000062 | OMNeT++ | IDE / result analysis | public | 2009-04-06 12:36 | 2009-05-12 09:39 |
|
Reporter | stkrause | |
Assigned To | tomi | |
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | |
Platform | | OS | | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | 4.1 | |
|
Summary | 0000062: Bug in scavetool: aggregates runs with different parameter settings |
Description | In some circumstances, scavetool will try to aggregate runs with different parameter settings.
This can occur because when comparing strings that contain floating point numbers strdictcmp, which is used by scavetool when trying to determine which runs to aggregate, sometimes returns zero even if the strings are not equal:
strdictcmp("0.01", "0.1") will return zero
The core of the problem is the usage of strtoul, wich will compare the first part of the number (up to the "."), and the remainder in a second step. In our example, it will conclude ("01" == "1").
A simple fix is to replace strtoul with strtod, which will cope with floating point numbers while retaining the semantic for integers as well. A patch with the change is attached. |
Additional Information | The bug occurs in omnetpp-4.0 release. |
Tags | No tags attached. |
|
Attached Files | strdictcmp.patch [^] (843 bytes) 2009-04-06 12:36 [Show Content] [Hide Content]Index: src/common/stringutil.cc
===================================================================
--- src/common/stringutil.cc (Revision 6230)
+++ src/common/stringutil.cc (Arbeitskopie)
@@ -374,8 +374,11 @@
{
if (opp_isdigit(c1) && opp_isdigit(c2))
{
- unsigned long l1 = strtoul(s1, const_cast<char **>(&s1), 10);
- unsigned long l2 = strtoul(s2, const_cast<char **>(&s2), 10);
+ // strtoul replaced because else "0.01 == 0.1"
+// unsigned long l1 = strtoul(s1, const_cast<char **>(&s1), 10);
+// unsigned long l2 = strtoul(s2, const_cast<char **>(&s2), 10);
+ double l1 = strtod(s1, const_cast<char **>(&s1));
+ double l2 = strtod(s2, const_cast<char **>(&s2));
if (l1!=l2)
return l1<l2 ? -1 : 1;
}
|
|