Skip to content

Commit

Permalink
Multiplication test: fix division resulting in NAN
Browse files Browse the repository at this point in the history
  • Loading branch information
MaEtUgR authored and jkflying committed Sep 18, 2019
1 parent 3747232 commit b0b7d72
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/matrixMult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,17 @@ int main()
Matrix3f C_check = eye<float, 3>()*2;
TEST(isEqual(B, B_check));
Matrix3f C = B_check.edivide(C_check);
TEST(isEqual(C, C_check));

// off diagonal are NANs because division by 0
for (size_t i = 0; i < 3; i++) {
for (size_t j = 0; j < 3; j++) {
if (i == j) {
TEST(isEqualF(C(i,j), 2.f));
} else {
TEST(isnan(C(i,j)));
}
}
}

// Test non-square matrix
float data_43[12] = {1,3,2,
Expand Down

0 comments on commit b0b7d72

Please sign in to comment.