From cb7886a4bff36585a3a89d53d1671b8acca1f0fd Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Thu, 5 Sep 2024 11:31:39 +0300 Subject: [PATCH 1/2] Avoid testing infinities in /fp:fast --- .../test.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/std/tests/VSO_0000000_vector_algorithms_floats/test.cpp b/tests/std/tests/VSO_0000000_vector_algorithms_floats/test.cpp index c43d6a2a5b1..865d1878c52 100644 --- a/tests/std/tests/VSO_0000000_vector_algorithms_floats/test.cpp +++ b/tests/std/tests/VSO_0000000_vector_algorithms_floats/test.cpp @@ -30,11 +30,19 @@ void test_min_max_element_floating_any(mt19937_64& gen) { constexpr auto input_of_input_size = dataCount / 2; vector input_of_input(input_of_input_size); - input_of_input[0] = -numeric_limits::infinity(); - input_of_input[1] = +numeric_limits::infinity(); - input_of_input[2] = -0.0; - input_of_input[3] = +0.0; - for (size_t i = 4; i < input_of_input_size; ++i) { + + input_of_input[0] = -0.0; + input_of_input[1] = +0.0; +#ifndef _M_FP_FAST + constexpr size_t special_values_count = 2; +#else // ^^^ defined(_M_FP_FAST) / !defined(_M_FP_FAST) vvv + input_of_input[2] = -numeric_limits::infinity(); + input_of_input[3] = +numeric_limits::infinity(); + + constexpr size_t special_values_count = 4; +#endif // ^^^ !defined(_M_FP_FAST) ^^^ + + for (size_t i = special_values_count; i < input_of_input_size; ++i) { input_of_input[i] = dis(gen); } From ca1371a1b6df359870edc3c58a6b3c27f1d9af4c Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Fri, 6 Sep 2024 08:12:35 +0300 Subject: [PATCH 2/2] STL comments --- .../VSO_0000000_vector_algorithms_floats/test.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/std/tests/VSO_0000000_vector_algorithms_floats/test.cpp b/tests/std/tests/VSO_0000000_vector_algorithms_floats/test.cpp index 865d1878c52..89d03bfe513 100644 --- a/tests/std/tests/VSO_0000000_vector_algorithms_floats/test.cpp +++ b/tests/std/tests/VSO_0000000_vector_algorithms_floats/test.cpp @@ -31,20 +31,16 @@ void test_min_max_element_floating_any(mt19937_64& gen) { constexpr auto input_of_input_size = dataCount / 2; vector input_of_input(input_of_input_size); + for (auto& element : input_of_input) { + element = dis(gen); + } + input_of_input[0] = -0.0; input_of_input[1] = +0.0; #ifndef _M_FP_FAST - constexpr size_t special_values_count = 2; -#else // ^^^ defined(_M_FP_FAST) / !defined(_M_FP_FAST) vvv input_of_input[2] = -numeric_limits::infinity(); input_of_input[3] = +numeric_limits::infinity(); - - constexpr size_t special_values_count = 4; -#endif // ^^^ !defined(_M_FP_FAST) ^^^ - - for (size_t i = special_values_count; i < input_of_input_size; ++i) { - input_of_input[i] = dis(gen); - } +#endif // !defined(_M_FP_FAST) test_min_max_element_floating_with_values(gen, input_of_input); }