problems with sqrt function
Dear All,
I am terribly confused by something at the moment. If anyone could tell me what they think the problem is that would be great.
Code:
#include<stdio.h>
#include<math.h>
int main()
{
double a=(sqrt(4*M_PI*M_PI+1)/2),b=(sqrt(M_PI*M_PI+1/4));
printf("a=%f\t\tb=%f",a,b);
return(0);
}
As you can easily tell mathematically my definitions of a and b are identical. However when one runs the program a has the correct value stored, but b has the value M_PI.
Thank you for all of your time.
Edz