The C standard provides that a float has to be able to represent at least six significant figures and allow a range of at least 10-37 to 10+37. The first requirement means, for example, that a float has to represent accurately at least the first six digits in a number such as 33.333333. The second requirement is handy if you like to use numbers such as the mass of the sun (2.0e30 kilograms), the charge of a proton (1.6e–19 coulombs), or the national debt. Often, systems use 32 bits to store a floating-point number. Eight bits are used to give the exponent its value and sign, and 24 bits are used to represent the nonexponent part, called the mantissa or significand, and its sign.
非特别指明输出格式,printf输出的float和double数小数位是6位
阅读(971) | 评论(0) | 转发(0) |