Update 1
In Haskell, you can find Ι using floatRange . The C ++ part below applies otherwise.
Note: The answer below was written before the OP expressed the answer to Haskell
You do not specify the implementation language in the question, so I'm going to suggest C ++ here.
Take a look at std::nextafter .
This will allow you to get the next possible value that you can add to the upper limit, which will cause your code to act as if it were included.
As for branching, you can overload the function to avoid branching. However, this leads to code duplication.
I would recommend allowing the branch and letting the compiler do such micro-optimizations if you really don't need performance, and can provide a more specialized implementation than the standard one ( see Pascal Cuoq comments ).
source share