Understanding floating point precision

前端 未结 3 1700
情话喂你
情话喂你 2021-01-06 17:45

Is it the case that:

  1. Representable floating point values are densest in the real number line near zero?
  2. Representable floating point values grow spars
3条回答
  •  爱一瞬间的悲伤
    2021-01-06 18:07

    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.

提交回复
热议问题