O'Reilly logo

OpenCL Programming by Example by Koushik Bhattacharyya, Ravishekhar Banger

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

Conversions and type casts

All programming languages support converting a numerical data type to another numerical data type. There is also a need to reinterpret a data type in some other form, for example, if one wants to extract only the exponent component from a floating point data type, how can one do that? We will discuss the implicit and explicit type conversions, followed by reinterpreting the data types.

Implicit conversion

Implicit conversion refers to the conversion of a data in one type to another type, which is equivalent to the original data type. This conversion is allowed for basic data types, which is described in the table earlier. For example, the integer value 1 will be converted to an equivalent floating point value 1.0f. The ...

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