Understanding floating point precision

佐手、 提交于 2019-11-30 23:46:40

The term precision usually refers to the number of significant digits (bits) in the represented value. So precision varies with the number of bits (or digits) in the mantissa of representation. Distance from the origin has no role.

What you say is true about the density of floats on the real line. But in this case the right term is accuracy, not precision. FP numbers of small magnitude are far more accurate that larger ones. This contrasts with integers, which have uniform accuracy over their ranges.

I highly recommend the paper What Every Computer Scientist Should Know About Floating Point Arithmetic, which covers this and much more.

Floating point numbers are basically stored in scientific notation. As long as they are normalized, they consistently have the same number of significant figures, no matter where you are on the number line.

If you consider density linearly, then the floating point numbers get exponentially more dense as you get closer to 0.

As you get extremely closed to 0, and the exponent reaches its lowest point, the floating point numbers become denormalized. At this point, they have 1 extra significant figure and are thus more precise.

tinkerbeast

Answers:

  1. Representable floating point values are densest in the real number line near zero? Yes
  2. Representable floating point values grow sparser (exponentially? Yes) as the number line moves away from zero? Yes
  3. If the above two are true, does that mean there is less precision farther from zero? Yes

Overall question: Does precision in some way refer to or depend on the density of numbers you can represent (accurately)?

See https://stackoverflow.com/a/24179424

I also recommend What Every Computer Scientist Should Know About Floating Point Arithmetic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!