From ab1db7e6179ecc8171008817fe25674a890f10ae Mon Sep 17 00:00:00 2001 From: an154gf Date: Mon, 10 Mar 2025 13:33:36 +0100 Subject: [PATCH] fixnuty floating point presnost --- du3/program.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/du3/program.c b/du3/program.c index c9fce20..3351bf2 100644 --- a/du3/program.c +++ b/du3/program.c @@ -65,7 +65,7 @@ int main() { total = divided(total, atof(equation[i])); break; case '=': - if (total == atof(equation[i])) { + /*if (total == atof(equation[i]))*/if (fabs(total - atof(equation[i])) < 1e-6) { strcpy(output[output_length], "OK"); output_length++; } @@ -88,7 +88,7 @@ int main() { sign = !sign; } memset(equation, 0, sizeof(equation)); - //printf("%s\n",out); + printf("%f", total); } for (int i=0; i