|
@ -361,4 +361,24 @@ void test_addition_output_double_numberwithsignexponentprecision(void) |
|
|
TEST_ASSERT_EQUAL_UINT64(expected[4], result[4]); |
|
|
TEST_ASSERT_EQUAL_UINT64(expected[4], result[4]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_addition_addition_precision_double_positivnumberlowerthan2tothepowerof53(void) |
|
|
|
|
|
{ |
|
|
|
|
|
unsigned long long result[2]; |
|
|
|
|
|
numberd[0].dnum = 0.0000434534473513646, numberd[1].dnum = 0.0000000036543515354, numberd[2].dnum = 9735105130351.113543, numberd[3].dnum = 78531.13543441354, numberd[4].dnum = numberd[0].dnum + numberd[1].dnum; numberd[5].dnum = numberd[2].dnum + numberd[3].dnum; |
|
|
|
|
|
unsigned long long expected[2] = { precision_double(numberd[4].lnum), precision_double(numberd[5].lnum) }; |
|
|
|
|
|
|
|
|
|
|
|
unsigned long long e0, e1, e2, e3, p0, p1, p2, p3; |
|
|
|
|
|
|
|
|
|
|
|
e0 = exponent_double(numberd[0].lnum), e1 = exponent_double(numberd[1].lnum), e2 = exponent_double(numberd[2].lnum), e3 = exponent_double(numberd[3].lnum); |
|
|
|
|
|
p0 = precision_double(numberd[0].lnum) | ed, p1 = precision_double(numberd[1].lnum) | ed, p2 = precision_double(numberd[2].lnum) | ed, p3 = precision_double(numberd[3].lnum) | ed; |
|
|
|
|
|
|
|
|
|
|
|
p1 >>= e0 - e1, p3 >>= e2 - e3; |
|
|
|
|
|
|
|
|
|
|
|
result[0] = addition_precision_double( p0, p1 ) ^ ed; |
|
|
|
|
|
result[1] = addition_precision_double( p2, p3 ) ^ ed; |
|
|
|
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_UINT64(expected[0], result[0]); |
|
|
|
|
|
TEST_ASSERT_EQUAL_UINT64(expected[1], result[1]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
#endif // TEST |
|
|
#endif // TEST |