Hi, Also, it is clear that (x+delta) - x != delta for > some values of delta so I doubt that the optimization happens. > > Is there a specification where this is clearly stated ? I am actually strugggling to find what kind of optimizations are performed by --say-- Oracle's JVM. One reason for this would be this issue, another would be: is it possible to write the code in a way that would "help" the JIT (for example to remove array bounds checks, and so on). If anyone could share any hint about this, I would be grateful.
Regarding Gilles's issue. If we were to define a private *class variable* called dummy, then I think the JIT would *have to compute* dummy {code} dummy = x + h; h = dummy - x; {code} Now, this is not a perfect solution, because for the proposed (static) method representableDelta, the class variable dummy woud need to be static as well, which I think raises thread-safety issues? Do you think a solution can be worked along those lines? Thank you beforehand, Sébastien