Menu

반올림, 자리수 설정가능

2016. 12. 5. 13:01

냥쿤이 Language

"math.h"


inline double Rounding(double x, int digit)

{

return (floor((x)* pow(float(10), digit) + 0.5f) / pow(float(10), digit));

}


// Define

#define ROUNDING(x, dig)    ( floor((x) * pow(float(10), dig) + 0.5f) / pow(float(10), dig) )