I would guess it comes down to the relative uselessness of floating point equality testing.
Have you ever tried to do assert(0.1 + 0.2 == 0.3)
?
Try it. I'll wait.
In case you already know the answer, it'll be clear why a closed interval is not easy to implement correctly. Backgrounders:
- Is floating point math broken?
- Why doesn't GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)?
- What Every Programmer Should Know About Floating-Point Arithmetic
Also, if you have two consecutive closed intervals [a,b][b,c]
. in which interval does b
belong?