I was writing a function to calculate the volume of a sphere when I encounter a problem and I don't know why if I change 4/3 * PI to PI * 4/3 I got different result. What is the order of evaluation, if I use parenthesis like (4/3) * PI and PI * (4/3) I got the wrong answer in both cases.
#define PI 3.141592
float Volume(int radius){
return (4/3 * PI * pow(radius, 3));
}
float Volume(int radius){
return (PI * 4/3 * pow(radius, 3)); //the good one
}