Skip to content

Commit

Permalink
fix tc_json when double/float isinf or isnan
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanshudong committed Aug 23, 2024
1 parent 7992aaf commit 35e3a34
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion util/src/tc_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,18 @@ void TC_Json::writeNum(const JsonValueNumPtr & p, string& ostr)
}
else if (!p->isInt)
{
ss << TC_Common::tostr(p->value) ;
if(std::isinf(p->value))
{
ss << "null";
}
else if(std::isnan(p->value))
{
ss << "null";
}
else
{
ss << TC_Common::tostr(p->value);
}
}
else
{
Expand Down

0 comments on commit 35e3a34

Please sign in to comment.