fractions and floating point



Hi,

is it possible to have two fractions, which (mathematically) have the order a/b < c/d (a,b,c,d integers), but when (correctly) converted into floating point representation just have the opposite order?

The idea is that the two fractions are almost identical and that the error introduced by going to floating point representation is bigger than the exact difference, but different for the two fractions such that it somehow turns them around.

I tried some numbers, but so far it always was ok.

I know that this depends on the way floating points are represented, so the more precise question would be: is there a standard that would ensure that this never happens? Does somebody have a concrete example for a specific platform?

Thanks
  Steffen




.


Quantcast