Relative error and wobble

前端 未结 1 1413
忘了有多久
忘了有多久 2021-01-06 09:04

The full context of the below is on page 8 of What Every Computer Scientist Should Know About Floating-Point Arithmetic. In the below it is stated "In general, when the

相关标签:
1条回答
  • 2021-01-06 09:43

    It is demonstrated on the same page as the quotes you give, in the paragraph before “In general, when the base is b, a fixed relative error expressed in ulps can wobble by a factor of up to b.”

    That paragraph explains that numbers from 1.0000…0 • be to d.ffffdd…d • be, where d is, as I use it here, the digit b-1, have the same ULP, because the ULP is the value of the last digit, and that value of the last digit is determined by the exponent of b (and the number of digits in the significand, which is fixed for the format).

    These numbers span a ratio of (almost) b, because d.ffffdd…d is almost b, so d.ffffdd…d / 1 is almost b. But they have the same ULP. Therefore, the magnitude of one ULP relative to the number spans a ratio of b.

    Addressing the October 30, 2013, edit:

    And what exactly does it mean by "a fixed relative error expressed in ulps can wobble by a factor of up to b."; if the relative error is fixed then how can it wobble or change?

    The error is said to be a fixed number of ULP. But the value of an ULP is not fixed or constant truly fixed or constant relative to floating-point values.

    There is just a language issue here. It is not accurate to speak of an ULP as a “fixed relative error”. However, people sometimes express error bounds or error amounts in ULPs because the nature of floating-point quantizes values, and those quanta are ULPs.

    ULP is approximately a relative error. It stays in the same range throughout the entire scale of a floating-point format. Consider a three-digit decimal format:

    • In the interval from 1.00 to 9.99, the absolute value of the ULP is .005. Its value relative to numbers in the interval ranges from .005 to (almost) .0005.
    • In the interval from 1,000,000 to 9,990,000, the absolute value of the ULP is 5,000. Its value relative to numbers in the interval ranges from .005 to (almost) .0005.
    • In the interval from 1.00•10-100 to 9.99•10-100, the absolute value of the ULP is .005•10-100. Its value relative to numbers in the interval ranges from .005 to (almost) .0005.

    As you see, the value of the ULP relative to floating-point numbers always stays within a small interval. Thus, it serves as an approximation of a relative error.

    The fact that our expressions of relative errors in floating-point arithmetic wobble by a factor of b comes from two mathematical facts:

    • When you work with floating-point arithmetic and calculate or derive a proof about the errors that may occur, you will find yourself expressing errors in units of ULP, because the quantization of the floating-point format causes bounds to be in ULPs or half-ULPs.
    • For floating-point values x, the value of an ULP of x divided by x changes by a factor of b as x changes within a single exponent interval of the floating-point format. When the exponent changes, the value ULP(x)/x resets.
    0 讨论(0)
提交回复
热议问题