Skip to content

Commit

Permalink
4. testing floating-point changes for macos pre and post arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
panchaBhuta committed Sep 24, 2024
1 parent 3ab3f43 commit 758ffd9
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions tests/testFloatingPointPrecision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,42 @@ int main()
"8.589973e+9", 8.589973e9L, "8589973000");

std::string expected_float_1d123456789[] = { "1.1234568",
#if MACH_MACOS_ARRAY_IDX == MACH_POST_MACOS14_ARM_CLANG
#if MACH_MACOS_ARRAY_IDX == MACH_POST_MACOS14_ARM_CLANG \
|| MACH_MACOS_ARRAY_IDX == MACH_PRE_MACOS14_CLANG
"1.12345684", // macOS
//#elif MACH_MACOS_ARRAY_IDX == MACH_POST_MACOS14_ARM_GNU
//#elif MACH_MACOS_ARRAY_IDX == MACH_PRE_MACOS14_CLANG
#else // default MACH_MACOS_ARRAY_IDX == MACH_PRE_MACOS14_GNU
"1.1234568",
#endif
"1.1234568" };
checkRoundTripConversion_txt2Val2txt<float>("testFloatingPointPrecision-4",
"1.123456789", 1.123456789f, expected_float_1d123456789[indexOS]); // 6 digits
std::string expected_double_1d1234567890123456789[] = { "1.1234567890123457",
"1.12345678901234569", // macOS
"1.1234567890123457" };
std::string expected_double_2d1234567890123456789[] = { "2.1234567890123457",
#if MACH_MACOS_ARRAY_IDX == MACH_POST_MACOS14_ARM_CLANG
//#elif MACH_MACOS_ARRAY_IDX == MACH_POST_MACOS14_ARM_GNU
//#elif MACH_MACOS_ARRAY_IDX == MACH_PRE_MACOS14_CLANG
"2.12345678901234569", // macOS
#else // default MACH_MACOS_ARRAY_IDX == MACH_PRE_MACOS14_GNU
"2.1234567890123457",
#endif
"2.1234567890123457" };
checkRoundTripConversion_txt2Val2txt<double>("testFloatingPointPrecision-5",
"1.1234567890123456789", 1.1234567890123456789,
expected_double_1d1234567890123456789[indexOS]); // 15 digits
std::string expected_longDouble_1d123456789012345678901[] = { "1.1234567890123456789",
"2.1234567890123456789", 2.1234567890123456789,
expected_double_2d1234567890123456789[indexOS]); // 15 digits
std::string expected_longDouble_3d123456789012345678901[] = { "3.1234567890123456789",
#if MACH_MACOS_ARRAY_IDX == MACH_POST_MACOS14_ARM_CLANG
"1.12345678901234569",
"3.12345678901234569",
#elif MACH_MACOS_ARRAY_IDX == MACH_POST_MACOS14_ARM_GNU
"1.1234567890123457",
"3.1234567890123457",
#elif MACH_MACOS_ARRAY_IDX == MACH_PRE_MACOS14_CLANG
"1.12345678901234567889",
"3.12345678901234567889",
#else // default MACH_MACOS_ARRAY_IDX == MACH_PRE_MACOS14_GNU
"1.1234567890123456789",
"3.1234567890123456789",
#endif
"1.1234567890123457" }; // Windows
"3.1234567890123457" }; // Windows
checkRoundTripConversion_txt2Val2txt<long double>("testFloatingPointPrecision-6",
"1.123456789012345678901", 1.123456789012345678901L,
expected_longDouble_1d123456789012345678901[indexOS]); //18 digits
"3.123456789012345678901", 3.123456789012345678901L,
expected_longDouble_3d123456789012345678901[indexOS]); //18 digits


checkRoundTripConversion_txt2Val2txt<double>("testFloatingPointPrecision-7",
Expand Down

0 comments on commit 758ffd9

Please sign in to comment.