How can I demostrate that given two numbers A and B, if A <= B, then fl(A) <= fl(B). fl(A) is the float point representation of A. Which is equal to A(1+x), and |x| <= the machine epsilon (eps). The same goes for fl(b).

I've tried a lot of things so far: if I consider that both representations will have the same maximum error (1+epsilon) it's easy:

fl(A) <= fl(B)

A(1+eps) <= B(1+eps)

A<=B, which is true

But, if I consider the worst case scenario, in which the error for A is positive eps, and the error for B is negative eps.

A(1+eps) <= B(1-eps)

Then it's more complicated. I've been playing around with this for a while, and I can't get to any conclusions. I'd be very glad if someone could point me to the right direction.

Thanks in advance.


There are only finitely many float numbers. I assume that $\operatorname{fl}(A)$ is one of the up to two float numbers closest to $A$. For $A,B\in\mathbb R$, we have $$ \left|\operatorname{fl}(A)-A\right|\le \left|\operatorname{fl}(B)-A\right|\qquad \left|\operatorname{fl}(B)-B\right|\le \left|\operatorname{fl}(A)-B\right|$$ Now if $\operatorname{fl}(A)>\operatorname{fl}(B)$ this implies $$ A\ge\frac{\operatorname{fl}(A)+\operatorname{fl}(B)}{2}\qquad B\le\frac{\operatorname{fl}(A)+\operatorname{fl}(B)}{2}$$ and hence $A\ge B$.

  • $\begingroup$ Thanks a lot sir. Now I got it. $\endgroup$ – hlustosa Jul 1 '14 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.