sign
Description
Extract sign of value.
Signature
int sign<T>(T x) where T : __BuiltinSignedArithmeticType; vector<int, N> sign<T, N:int>(vector<T, N> x) where T : __BuiltinSignedArithmeticType; matrix<int, N, M> sign<T, N:int, M:int>(matrix<T, N, M> x) where T : __BuiltinSignedArithmeticType;
Generic Parameters
T: __BuiltinSignedArithmeticType
N : int
M : int
Parameters
x : T
The value to extract the sign of.
x : vector<T, N>
The value to extract the sign of.
x : matrix<T, N, M>
The value to extract the sign of.
Return value
-1 if x is negative, 0 if x is zero, and 1 if x is positive.
Availability and Requirements
Defined for the following targets:
hlsl
Available in all stages.
glsl
Available in all stages.
cpp
Available in all stages.
cuda
Available in all stages.
wgsl
Available in all stages.
spirv
Available in all stages.