diff --git a/test/test_addition.c b/test/test_addition.c index 08b668b..876c32f 100644 --- a/test/test_addition.c +++ b/test/test_addition.c @@ -316,4 +316,23 @@ void test_addition_precision_double_numbers(void) TEST_ASSERT_EQUAL_UINT64(expected[4], result[4]); } +void test_addition_exponent_double_numbers(void) +{ + unsigned long long result[5]; + numberd[0].dnum = 830046503435461000, numberd[1].dnum = -906056810308432, numberd[2].dnum = 0.5315020335035034357, numberd[3].dnum = -34, numberd[4].dnum = 94315454312021310; + unsigned long long expected[5] = { (numberd[0].lnum << 1) >> 53 , (numberd[1].lnum << 1) >> 53, (numberd[2].lnum << 1) >> 53, (numberd[3].lnum << 1) >> 53, (numberd[4].lnum << 1) >> 53}; + + result[0] = exponent_double( numberd[0].lnum ); + result[1] = exponent_double( numberd[1].lnum ); + result[2] = exponent_double( numberd[2].lnum ); + result[3] = exponent_double( numberd[3].lnum ); + result[4] = exponent_double( numberd[4].lnum ); + + TEST_ASSERT_EQUAL_UINT64(expected[0], result[0]); + TEST_ASSERT_EQUAL_UINT64(expected[1], result[1]); + TEST_ASSERT_EQUAL_UINT64(expected[2], result[2]); + TEST_ASSERT_EQUAL_UINT64(expected[3], result[3]); + TEST_ASSERT_EQUAL_UINT64(expected[4], result[4]); +} + #endif // TEST