mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-16 15:57:38 +00:00
Merge pull request #3518 from SChernykh/dev
Make Json::normalize more strict
This commit is contained in:
commit
b4a47d6ed0
1 changed files with 4 additions and 2 deletions
|
@ -211,11 +211,13 @@ rapidjson::Value xmrig::Json::normalize(double value, bool zero)
|
|||
{
|
||||
using namespace rapidjson;
|
||||
|
||||
if (!std::isnormal(value)) {
|
||||
const double value_rounded = floor(value * 100.0) / 100.0;
|
||||
|
||||
if (!std::isnormal(value) || !std::isnormal(value_rounded)) {
|
||||
return zero ? Value(0.0) : Value(kNullType);
|
||||
}
|
||||
|
||||
return Value(floor(value * 100.0) / 100.0);
|
||||
return Value(value_rounded);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue