I have the following code (printfs are for debugging)
float maximum = max(num1, max(num2, num3));
float other1 = min(num1, min(num2, num3));
float other2 = num1 + num2 + num3 - other1 - maximum;
//Now we know the maximum is maybe the hypothenuse
printf("Max %f, other %f, other %f\n", maximum, other1, other2);
printf("%f %f %f\n", pow(other1, 2), pow(other2, 2), pow(maximum, 2));
printf("%d\n", (pow(other1, 2) + pow(other2, 2)) == pow(maximum, 2));
return(pow(other1, 2) + pow(other2, 2) == pow(maximum, 2));
What I am trying to do is to check if 3 numbers are a pythagorean triple. Well, when entering the numbers 3, 4 and 5 it returns 0.
I have no idea why this behaviour happens. I'm pretty sure the problem is with the comparison, but I don't get what's wrong...
I would appreciate some help! Thanks!