#include #include double ToRoundUp(double dValue, int iDigits) { double dCoef; dCoef = pow(10, iDigits); return dValue > 0 ? ceil(dValue * dCoef) / dCoef: floor(dValue * dCoef) / dCoef; } void MathToRoundUp(void) { double dst; dst = ToRoundUp(12.324, 2); printf("%f\n", dst); /* 12.33 */ } int main(void) { MathToRoundUp(); return 0; }