mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-06 21:08:53 +08:00
Multiplication test: fix division resulting in NAN
This commit is contained in:
committed by
Julian Kent
parent
3747232724
commit
b0b7d7229a
+11
-1
@@ -27,7 +27,17 @@ int main()
|
|||||||
Matrix3f C_check = eye<float, 3>()*2;
|
Matrix3f C_check = eye<float, 3>()*2;
|
||||||
TEST(isEqual(B, B_check));
|
TEST(isEqual(B, B_check));
|
||||||
Matrix3f C = B_check.edivide(C_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
|
// Test non-square matrix
|
||||||
float data_43[12] = {1,3,2,
|
float data_43[12] = {1,3,2,
|
||||||
|
|||||||
Reference in New Issue
Block a user