借助math库的round函数
#include <math.h> double ext_round(double data, int precision) { double base = pow(10, precision); return round(data * base) / base; }
借助math库的round函数
#include <math.h> double ext_round(double data, int precision) { double base = pow(10, precision); return round(data * base) / base; }