#ifndef _FUNCTION_ #define _FUNCTION_ #include #include #include #include using namespace std; class XFunction{ public: static float format_float(float v, int dotCnt) //dotCnt { if(dotCnt > 6) dotCnt = 6; float k = pow(10.0f, dotCnt); float i = floor(v * k) / k; return i; } static double format_double(double v, int dotCnt) //dotCnt { if(dotCnt > 6) dotCnt = 6; double k = pow(10.0f, dotCnt); double i = floor(v * k) / k; return i; } static string Format(int v, int outlen) { char buf[50]; memset(buf, 0, 50); sprintf(buf, "%d", v); string r = buf; size_t k = r.length(); for(int i=0; i