From 21834035950feaadac9d4c7cad82b90ee624c984 Mon Sep 17 00:00:00 2001 From: yy1717 <fctom1215@outlook.com> Date: 星期一, 17 八月 2020 19:30:06 +0800 Subject: [PATCH] 传感器变更 --- lib/src/main/cpp/utils/num.cpp | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/lib/src/main/cpp/utils/num.cpp b/lib/src/main/cpp/utils/num.cpp index 0019ccf..6627921 100644 --- a/lib/src/main/cpp/utils/num.cpp +++ b/lib/src/main/cpp/utils/num.cpp @@ -3,6 +3,11 @@ // #include "num.h" +#include <sstream> +#include <iosfwd> +#include <iomanip> + +using namespace std; long str2int(const uint8_t *s, uint16_t length) { @@ -85,3 +90,10 @@ return n ; } + +double round(double number, unsigned int bits) { + stringstream ss; + ss << setiosflags(ios::fixed) << setprecision(bits) << number; + ss >> number; + return number; +} -- Gitblit v1.8.0