Absolute Value

Take the absolute value of a source operand used in an arithmetic operation.

_abs

 

This modifier is used for single and double precision floating point and instructions only. The _abs modifier forces the sign of the number(s) on the source operand positive, including on INF values.

Applying _abs on NaN preserves NaN, although the particular NaN bit pattern that results is not defined.

When _abs is combined with the negate modifier, the combination forces the sign to be negative, as if the _abs modifier is applied first, then the negate.

Minimum Shader Model

This modifier is supported in the following shader models.

Shader Model Supported
Shader Model 5 yes
Shader Model 4.1 yes
Shader Model 4 yes
Shader Model 3 (DirectX HLSL) no
Shader Model 2 (DirectX HLSL) no
Shader Model 1 (DirectX HLSL) no

 

Instruction Modifiers