From fd681e9a869caeeb89606c2898ea38042f7ead01 Mon Sep 17 00:00:00 2001 From: an154gf Date: Mon, 10 Mar 2025 14:17:25 +0100 Subject: [PATCH] problem s roundovanim asi --- du3/program.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/du3/program.c b/du3/program.c index 144be99..8dac2b5 100644 --- a/du3/program.c +++ b/du3/program.c @@ -78,8 +78,8 @@ int main() { total = divided(total, atof(equation[i])); break; case '=': - total = round(total * 100) / 100; - if (fabs(total - atof(equation[i])) < 1e-6) { + //total = round(total * 100) / 100; + if (fabs((round(total * 100) / 100) - atof(equation[i])) < 1e-6) { strcpy(output[output_length], "OK"); output_length++; } else { @@ -99,6 +99,7 @@ int main() { sign = !sign; } memset(equation, 0, sizeof(equation)); + //printf("%f - %f\n",total, (round(total * 100) / 100)); } for (int i=0; i