@ -29,6 +29,7 @@ static float test_floats[] = {
} ;
} ;
# define NUM_TEST_FLOATS (sizeof(test_floats) / sizeof(float))
# define NUM_TEST_FLOATS (sizeof(test_floats) / sizeof(float))
# if __SIZEOF_DOUBLE__ == 8
static double test_doubles [ ] = {
static double test_doubles [ ] = {
1.0 , 2.0 , 3.0 , 4.0 ,
1.0 , 2.0 , 3.0 , 4.0 ,
5.0 , 6.0 , 7.0 , 8.0 , 9.0 , /* numbers across the decade */
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 ) ;
( ( ieee754 . u & 0x000fffffffffffff ) ! = 0 ) ;
}
}
# endif
# endif
# endif /* __SIZEOF_DOUBLE__ == 8 */
# ifndef isinff
# ifndef isinff
static int isinff ( float x )
static int isinff ( float x )
@ -147,6 +149,10 @@ int32_t *p_root_squared = (int32_t *)&root_squared;
ZTEST ( libc_common , test_sqrt )
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 ;
int i ;
double resd , error , square , root_squared , exponent ;
double resd , error , square , root_squared , exponent ;
uint64_t max_error ;
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 " ) ;
zassert_true ( max_error < 0x04 , " huge errors in sqrt implementation " ) ;
/* print the max error */
/* print the max error */
TC_PRINT ( " test_sqrt max error %d counts \n " , ( uint32_t ) max_error ) ;
TC_PRINT ( " test_sqrt max error %d counts \n " , ( uint32_t ) max_error ) ;
# endif
}
}