PTX ISA v9.4

9.7.3.9. Floating Point Instructions: abs

abs

Absolute value.

Syntax

ptx
abs{.ftz}.f32  d, a;
abs.f64        d, a;

Description

Take the absolute value of a and store the result in d.

Semantics

ptx
d = |a|;

Notes

Subnormal numbers:

  • sm_20+
  • By default, subnormal numbers are supported.
  • abs.ftz.f32 flushes subnormal inputs and results to sign-preserving zero.
  • sm_1x
  • abs.f64 supports subnormal numbers.
  • abs.f32 flushes subnormal inputs and results to sign-preserving zero.

For abs.f32, NaN input yields unspecified NaN. For abs.f64, NaN input is passed through unchanged. Future implementations may comply with the IEEE 754 standard by preserving payload and modifying only the sign bit.

PTX ISA Notes

Introduced in PTX ISA version 1.0.

Target ISA Notes

abs.f32 supported on all target architectures.

abs.f64 requires sm_13 or higher.

Examples

ptx
abs.ftz.f32  x,f0;
esc
Type to search across all documentation