problem s roundovanim asi

This commit is contained in:
Aleš Novysedlák 2025-03-10 14:17:25 +01:00
parent 100f8e2e89
commit fd681e9a86

View File

@ -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<output_length; i++) {
printf("%s\n", output[i]);