我需要用π来计算.当我判断M_PI的精度时,它只打印了7位小数.我#defined
我自己的MY_PI
但我仍然面临着同样的问题.double
应该支持15-17位十进制数字.为什么我只有6个
#define MY_PI 3.1415926535897932384626433832795028841971
#include<stdio.h>
#include<math.h>
int main()
{
printf("%f\n%lf\n%20lf\n",M_PI,M_PI,M_PI);
printf("%d\n%d\n",sizeof(float),sizeof(double));
printf("%f\n%lf\n%20lf\n",MY_PI,MY_PI,MY_PI);
return 0;
}
执行代码会导致这一结果,
3.141593
3.141593
3.141593
4
8
3.141593
3.141593
3.141593
Process returned 0 (0x0) execution time : 0.080 s
Press any key to continue.