java.lang.Math
docs say for many functions, such as Math.pow
:
The computed result must be within 1 ulp of the exact result.
But I haven't been able to find what does this mean precisely. Is it exclusive or inclusive? In other words, if the exact result can be represented with a double, will the returned value contain exact result or it may still be off by 1 ULP?
For example, can we rely on Math.pow(3.0, 2.0) == 9.0
? I know using equality comparison is almost always a bad idea for doubles, so I am mostly asking out of curiosity and to be able to point people to their mistakes (or reassure them) when they do something like that.