From 1f5aa0874a7eaecd85b1d9ab4e122a65f04a738a Mon Sep 17 00:00:00 2001 From: saundersp Date: Mon, 10 Jun 2024 18:57:36 +0200 Subject: [PATCH] Removed deprecated cpp/test.cpp --- cpp/test.cpp | 62 ---------------------------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 cpp/test.cpp diff --git a/cpp/test.cpp b/cpp/test.cpp deleted file mode 100644 index 3359e88..0000000 --- a/cpp/test.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include -#include "data.hpp" -#include "toolbox.hpp" - -#define PBSTR "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" -#define PBWIDTH 60 - -void printProgress(const float64_t& percentage) noexcept { - const uint64_t val = static_cast(percentage * 100); - const int32_t lpad = static_cast(percentage * PBWIDTH); - const int32_t rpad = PBWIDTH - lpad; - fprintf(stderr, "%3lu%% [%.*s%*s]\r", val, lpad, PBSTR, rpad, ""); - fflush(stderr); -} - -void clearProgress(void) noexcept { - // Progress bar width + space before + num space + space after - fprintf(stderr, "%*c\r", PBWIDTH + 1 + 3 + 3, ' '); -} - -template -void test(const uint64_t& N) noexcept { -#if __DEBUG - printf("DETERMINISTIC for N=%s of %s sized %s\n", thousand_sep(N).c_str(), typeid(T).name(), format_byte_size(sizeof(T)).c_str()); - printf("Estimating memory footprint at : %s\n", format_byte_size(3 * N * sizeof(T)).c_str()); -#endif - - T *a = new T[N], *b = new T[N], *c = new T[N]; - - T mean = static_cast(0.0); - const size_t percent = N / 100; - for(size_t i = 0; i < N; ++i){ - if (i % percent == 0) printProgress(static_cast(i) / N); - a[i] = static_cast(i < N>>1 ? 0.1 : 1.0); - b[i] = static_cast(1.0); - c[i] = a[i] * b[i]; - mean += c[i]; - } - mean /= static_cast(N); - - clearProgress(); - std::cout << mean << std::endl; - - delete[] a, delete[] b, delete[] c; -} - -void test_float(void) noexcept { - std::cout << std::setprecision(1<<8); - const uint64_t N = static_cast(1)<<28; - test(N); - test(N); - test(N); - - //printf("%.128af\n", static_cast(1) / 3); - //std::cout << static_cast(1) / 3 << std::endl; - //std::cout << std::hexfloat << static_cast(1) / 3 << std::endl; - - //printf("%.128Lf\n", static_cast(1) / 3); - //printf("%.128lf\n", static_cast(1) / 3); - //printf("%.128f\n", static_cast(1) / 3); -}