
"Why C++'s floating point types shouldn't be used with bounded objects? [...] there exist a number of myths of what IEEE-compliance really entails from the point of view of program semantics. We shall discuss the following myths, among others: [...] "If x < 1 tests true at one point, then x < 1 stays true later if I never modify x."
I don't fully understand this...AFAIK, this is not allowed for an IEEE complient implementation. How could we ever implement *anything* with respect to floats then?
I also don't like this, but this is the reality (see http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.18 too). It's very important to realise that floating-point operations may be not repeatable. Unfortunately, to be able to have a reliable constrained object, the comparison of two values *must* be repeatable.
I've heard of libraries for "reliable floating-point computations" and of compiler switches that turn some surprising floating-point optimisations off, but I still don't feel competent enough in this respect to find a way that *guarantees* proper working of constrained objects. If somebody does -- you are welcome to help. ;-)
How about, floating point is allowed, but the results may sometimes be surprising? We already accept this sort of floating point behavior in many other situations. So, bounded_float should be allowed, but buyer should beware.