fixnuty floating point presnost

This commit is contained in:
Aleš Novysedlák 2025-03-10 13:33:36 +01:00
parent 1b903cb9fa
commit ab1db7e617

View File

@ -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<output_length; i++) {