problem s roundovanim asi
This commit is contained in:
parent
100f8e2e89
commit
fd681e9a86
@ -78,8 +78,8 @@ int main() {
|
|||||||
total = divided(total, atof(equation[i]));
|
total = divided(total, atof(equation[i]));
|
||||||
break;
|
break;
|
||||||
case '=':
|
case '=':
|
||||||
total = round(total * 100) / 100;
|
//total = round(total * 100) / 100;
|
||||||
if (fabs(total - atof(equation[i])) < 1e-6) {
|
if (fabs((round(total * 100) / 100) - atof(equation[i])) < 1e-6) {
|
||||||
strcpy(output[output_length], "OK");
|
strcpy(output[output_length], "OK");
|
||||||
output_length++;
|
output_length++;
|
||||||
} else {
|
} else {
|
||||||
@ -99,6 +99,7 @@ int main() {
|
|||||||
sign = !sign;
|
sign = !sign;
|
||||||
}
|
}
|
||||||
memset(equation, 0, sizeof(equation));
|
memset(equation, 0, sizeof(equation));
|
||||||
|
//printf("%f - %f\n",total, (round(total * 100) / 100));
|
||||||
}
|
}
|
||||||
for (int i=0; i<output_length; i++) {
|
for (int i=0; i<output_length; i++) {
|
||||||
printf("%s\n", output[i]);
|
printf("%s\n", output[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user