O'Reilly logo

OpenCL Parallel Programming Development Cookbook by Raymond Tay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Arithmetic and rounding in OpenCL

Rounding is an important topic in OpenCL and we have not really dived into it yet but that's about to change. OpenCL 1.1 supports four rounding modes: round to nearest (even number), round to zero, round to positive infinity, and round to negative infinity. The only round mode required by OpenCL 1.1 compliant devices is the round to nearest even.

Note

If the result is intermediate between two representable values, the even representation is chosen. Even, here, means that the lowest bit is zero.

You should be aware that these are applicable to single-precision floating-point values supported in OpenCL 1.1; we have to check with the vendors who provide functions that operate on double-precision floating-point values, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required