Use normalize for load average values.

This commit is contained in:
XMRig 2019-12-04 10:25:26 +07:00
parent 901f1a7ab1
commit a4d35065d9
No known key found for this signature in database
GPG key ID: 446A53638BE94409
4 changed files with 26 additions and 11 deletions

View file

@ -30,6 +30,7 @@
#include "backend/common/Hashrate.h"
#include "base/io/json/Json.h"
#include "base/tools/Chrono.h"
#include "base/tools/Handle.h"
#include "rapidjson/document.h"
@ -157,13 +158,7 @@ const char *xmrig::Hashrate::format(double h, char *buf, size_t size)
rapidjson::Value xmrig::Hashrate::normalize(double d)
{
using namespace rapidjson;
if (!std::isnormal(d)) {
return Value(kNullType);
}
return Value(floor(d * 100.0) / 100.0);
return Json::normalize(d, false);
}