Use normalize for load average values.
This commit is contained in:
parent
901f1a7ab1
commit
a4d35065d9
4 changed files with 26 additions and 11 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue