1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 00:15:58 +01:00

Inline the isneg/ispos macros, remove promotion warnings on constants

Originated from commit c6dc96f3 but are rarely used and not in math.h
Removes float to double promotion warning and simplifies the code
'gcc -std=gnu99 -Wdouble-promotion' spits out these warnings
This commit is contained in:
jsalling
2016-12-29 20:47:03 -06:00
parent 0603c1cf1e
commit bd4ac58486
3 changed files with 16 additions and 30 deletions

View File

@@ -3274,8 +3274,9 @@ void testFloatPrinting(void)
TEST_ASSERT_EQUAL_PRINT_FLOATING("8.3099991e+09", 8309999104.0f);
TEST_ASSERT_EQUAL_PRINT_FLOATING("1.0e+10", 1.0e+10f);
TEST_ASSERT_EQUAL_PRINT_FLOATING("1.0e+10", 10000000000.0f);
TEST_ASSERT_EQUAL_PRINT_FLOATING("1.00005499e+10", 1.000055e+10f);
TEST_ASSERT_EQUAL_PRINT_FLOATING("1.10000006e+38", 1.10000005e+38f);
/* Some compilers have trouble with inexact float constants, a float cast works generally */
TEST_ASSERT_EQUAL_PRINT_FLOATING("1.00005499e+10", (float)1.000055e+10f);
TEST_ASSERT_EQUAL_PRINT_FLOATING("1.10000006e+38", (float)1.10000005e+38f);
TEST_ASSERT_EQUAL_PRINT_FLOATING("1.63529943e+10", 1.63529943e+10f);
TEST_ASSERT_EQUAL_PRINT_FLOATING("3.40282347e+38", 3.40282346638e38f);