Skip to content

Mod Operator % incorrect behaviour #1318

@shehzan10

Description

@shehzan10

Code:

af::info();
af::array x = iota(dim4(5, 5), dim4(1), f32) % 3;
af::array y = iota(dim4(5, 5), dim4(1), f32);
af::array z = y % 3;

Output: (Consistent with all backends)

ArrayFire v3.4.0 (CPU, 64-bit Linux, build 3dbb7a9)
[0] Intel: Genuine Intel(R) CPU @ 2.60GHz, 48351 MB, Max threads(16)
x
[5 5 1 1]
0.0000 -1.0000 1.0000 0.0000 -1.0000
1.0000 0.0000 -1.0000 1.0000 0.0000
-1.0000 1.0000 0.0000 -1.0000 1.0000
0.0000 -1.0000 1.0000 0.0000 -1.0000
1.0000 0.0000 -1.0000 1.0000 0.0000

y
[5 5 1 1]
0.0000 5.0000 10.0000 15.0000 20.0000
1.0000 6.0000 11.0000 16.0000 21.0000
2.0000 7.0000 12.0000 17.0000 22.0000
3.0000 8.0000 13.0000 18.0000 23.0000
4.0000 9.0000 14.0000 19.0000 24.0000

z
[5 5 1 1]
0.0000 -1.0000 1.0000 0.0000 -1.0000
1.0000 0.0000 -1.0000 1.0000 0.0000
-1.0000 1.0000 0.0000 -1.0000 1.0000
0.0000 -1.0000 1.0000 0.0000 -1.0000
1.0000 0.0000 -1.0000 1.0000 0.0000

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions