'float' vs. 'double' precision

后端 未结 6 787
情话喂你
情话喂你 2020-11-22 14:56

The code

float x  = 3.141592653589793238;
double z = 3.141592653589793238;
printf(\"x=%f\\n\", x);
printf(\"z=%f\\n\", z);
printf(\"x=%20.18f\\n\", x);
print         


        
6条回答
  •  执念已碎
    2020-11-22 15:20

    float : 23 bits of significand, 8 bits of exponent, and 1 sign bit.

    double : 52 bits of significand, 11 bits of exponent, and 1 sign bit.

提交回复
热议问题