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