Explicit type conversions are performed with constructors. For example,
float f = 2.3;
bool b = bool(f);
The OpenGL Shading Language does not provide C-style typecast syntax, which can be ambiguous as to whether a value is converted to a different type or is simply reinterpreted as a different type. In fact, there is no way of reinterpreting a value as a different type in the OpenGL Shading Language. There are no pointers, no type unions, no implicit type changes, and no reinterpret casts. Instead, constructors perform conversions. The arguments to a constructor are converted to the type they are constructing. Hence, the following are allowed:
float f = float(3); // convert integer 3 to floating-point 3.0
float g = float(b); // convert Boolean b to floating point
vec4 v = vec4(2); // set all components of v to 2.0