Description
The relational operators^{16} greater than (>), less than (<), greater than or equal (>=), and less than or equal (<=) operate on scalar and vector types. All relational operators result in an integer type. After operand type conversion, the following cases are valid:
[16] To test whether any or all elements in the result of a vector relational operator test true, for example to use in the context in an if ( ) statement, please see the any and all builtins.

The two operands are scalars. In this case, the operation is applied, resulting in an
int
scalar. 
One operand is a scalar, and the other is a vector. In this case, the scalar may be subject to the usual arithmetic conversion to the element type used by the vector operand. The scalar type is then widened to a vector that has the same number of components as the vector operand. The operation is done componentwise resulting in the same size vector.

The two operands are vectors of the same type. In this case, the operation is done componentwise resulting in the same size vector.
All other cases of implicit conversions are illegal.
The result is a scalar signed integer of type int
if the source operands
are scalar and a vector signed integer type of the same size as the source
operands if the source operands are vector types.
Vector source operands of type charn
and ucharn
return a
charn
result; vector source operands of type shortn
and
ushortn
return a shortn
result; vector source operands of type
intn
, uintn
and floatn
return an intn
result; vector
source operands of type longn
, ulongn
and doublen
return a
longn
result.
For scalar types, the relational operators shall return 0 if the specified
relation is false and 1 if the specified relation is true.
For vector types, the relational operators shall return 0 if the specified
relation is false and 1 (i.e. all bits set) if the specified relation is
true.
The relational operators always return 0 if either argument is not a number
(NaN).
See Also
Document Notes
For more information, see the OpenCL C Specification
This page is extracted from the OpenCL C Specification. Fixes and changes should be made to the Specification, not directly.
Copyright
Copyright (c) 20142020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.