Skip to content

Commit

Permalink
Fixed float number truncation in cjson library reading configuration …
Browse files Browse the repository at this point in the history
…item min
  • Loading branch information
YamingPei committed Jul 3, 2024
1 parent be8d6ae commit 49eeac4
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/benchJsonOpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,14 @@ static int getColumnAndTagTypeFromInsertJsonFile(
scalingFactor = 1;
}
} else {
scalingFactor = 1;
if (0 < (max - min) && (max - min) <= 1) {
scalingFactor = 1000;
max = maxInDbl * scalingFactor;
min = minInDbl * scalingFactor;
} else {
scalingFactor = 1;
}

}

// gen
Expand Down Expand Up @@ -490,7 +497,13 @@ static int getColumnAndTagTypeFromInsertJsonFile(
scalingFactor = 1;
}
} else {
scalingFactor = 1;
if (0 < (max - min) && (max - min) <= 1) {
scalingFactor = 1000;
max = maxInDbl * scalingFactor;
min = minInDbl * scalingFactor;
} else {
scalingFactor = 1;
}
}

tools_cJSON *dataValues = tools_cJSON_GetObjectItem(tagObj, "values");
Expand Down

0 comments on commit 49eeac4

Please sign in to comment.