diff --git a/tests/lib/c_lib/common/src/test_sqrt.c b/tests/lib/c_lib/common/src/test_sqrt.c index 3c465b8f0eb..023f7f0d07f 100644 --- a/tests/lib/c_lib/common/src/test_sqrt.c +++ b/tests/lib/c_lib/common/src/test_sqrt.c @@ -29,6 +29,7 @@ static float test_floats[] = { }; #define NUM_TEST_FLOATS (sizeof(test_floats)/sizeof(float)) +#if __SIZEOF_DOUBLE__ == 8 static double test_doubles[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, /* numbers across the decade */ @@ -59,6 +60,7 @@ static int isnan(double x) ((ieee754.u & 0x000fffffffffffff) != 0); } #endif +#endif /* __SIZEOF_DOUBLE__ == 8 */ #ifndef isinff static int isinff(float x) @@ -147,6 +149,10 @@ int32_t *p_root_squared = (int32_t *)&root_squared; ZTEST(libc_common, test_sqrt) { +#if __SIZEOF_DOUBLE__ != 8 + TC_PRINT("test_sqrt skipped, double not 64 bits\n"); + ztest_test_skip(); +#else int i; double resd, error, square, root_squared, exponent; uint64_t max_error; @@ -202,4 +208,5 @@ int64_t *p_root_squared = (int64_t *)&root_squared; zassert_true(max_error < 0x04, "huge errors in sqrt implementation"); /* print the max error */ TC_PRINT("test_sqrt max error %d counts\n", (uint32_t)max_error); +#endif }