0
$\begingroup$

Let's pretend I have a five places floating-point register.

I have to represent the following numbers: $256.786$ and $256750000$.

I can represent the first number as $2.568 \cdot 10^2$. The relative error would be: $e_r=|\frac{2.568 \cdot 10^2-256.786}{256.786}|=0.00545 \% $

I can represent the second number as $2.568\cdot10^8$ The relative error would be: $e_r=|\frac{2.568 \cdot 10^8-256750000}{256750000}|=0.0194 \% $

I was told in this video that with floating point register, the order of relative error is the same with every number.

But in this case, this isn't true, is it? What's wrong?

Many thanks

  • 0
    @hardmath decimal representations. Could you expand a little your comment? I haven't fully understood it :)2012-12-10

1 Answers 1

1

Usually a five place decimal register would store five digits, so the first would be $2.5679 \cdot 10^2$ and the second would be $2.5675 \cdot 10^8$, but we can use your four-place values. The relative error is of the same order with every number, but is not exactly the same. For values which can be represented exactly, the error is $0$, so if you were given $256.7$ to represent, you would get $2.567 \cdot 10^2$ with no error at all. In your case, the first is off by $0.114$ of the last place, while the second is off by $0.5$ of the last place, so the relative error should be about $4.4$ times larger, which it is.

The variation can get worse as hardmath points out. If you want to represent $1.0005$ the error is $5 \cdot 10^{-4}$. If you want to represent $9.9999$ the error is $10^{-6}$. But the fractional error cannot get worse than $5 \cdot 10^{-4}=0.05\%$

  • 0
    I got it! :) Thank you so much!2012-12-12