Skip to content

On rounding of intervals

CuInterval makes use of the built-in CUDA math functions which use round-to-nearest-even. Since some math functions are not fully accurate up to machine presicion — they do not conform to IEEE754 — we have to perform additional outward rounding to cover the worst-cases of the specified maximum ulp-error of an intrinsic function.

The CUDA math functions use round-to-nearest-even and thus pick the even floating point number if the number would land exactly between two floating point values, otherwise it picks the nearest available value between two floating point values.

If the intrinsic function has a reported max. error of 1 ulp, then the resulting interval output will have a max. error of 2.5 ulps. To see why, let’s look at all the scenarios that could be possible:

Rounding to nearest one error closer to even left. Rounding to nearest one error closer to even right. Rounding to nearest one error closer to odd left. Rounding to nearest one error closer to odd right. Rounding to nearest one error closer to exact even. Rounding to nearest one error closer to exact odd. Rounding to nearest one error halfway above. Rounding to nearest one error halfway below.

We denote the absolute error from the true floating point value by Δulp\Delta\text{ulp}. A Δulp\Delta\text{ulp} of 0.5 indicates that the value is 0.5 ulps away from the correct floating point value because it is not representable as, e.g., a 64 bit floating point number.

So, inf(Fanalytic(X))inf(F(X))2.5 ulps|\inf(F_{\text{analytic}}(X)) - \inf(F(X))| \leq 2.5 \text{ ulps} is what we guarantee in this case.