PTX ISA v9.4

9.7.1.10. Integer Arithmetic Instructions: rem

rem

The remainder of integer division.

Syntax

ptx
rem.type  d, a, b;

.type = { .u16, .u32, .u64,
          .s16, .s32, .s64 };

Description

Divides a by b, store the remainder in d.

Semantics

ptx
d = a % b;

Notes

The behavior for negative numbers is machine-dependent and depends on whether divide rounds towards zero or negative infinity.

Division by zero yields an unspecified, machine-specific value.

PTX ISA Notes

Introduced in PTX ISA version 1.0.

Target ISA Notes

Supported on all target architectures.

Examples

ptx
rem.s32  x,x,8;    // x = x%8;
esc
Type to search across all documentation