diff --git a/elastic/decimal/api/api.cpp b/elastic/decimal/api/api.cpp index e40a50307..00c8c3cee 100644 --- a/elastic/decimal/api/api.cpp +++ b/elastic/decimal/api/api.cpp @@ -295,7 +295,24 @@ int BigNumberComputation() { return nrOfFailedTestCases; } +#include + +// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 0 +// REGRESSION_LEVEL_OVERRIDE is set by the cmake file to drive a specific regression intensity +// It is the responsibility of the regression test to organize the tests in a quartile progression. +//#undef REGRESSION_LEVEL_OVERRIDE +#ifndef REGRESSION_LEVEL_OVERRIDE +#undef REGRESSION_LEVEL_1 +#undef REGRESSION_LEVEL_2 +#undef REGRESSION_LEVEL_3 +#undef REGRESSION_LEVEL_4 +#define REGRESSION_LEVEL_1 1 +#define REGRESSION_LEVEL_2 1 +#define REGRESSION_LEVEL_3 1 +#define REGRESSION_LEVEL_4 1 +#endif + #define STRESS_TESTING 0 int main() diff --git a/elastic/decimal/api/example.cpp b/elastic/decimal/api/example.cpp new file mode 100644 index 000000000..66c09d672 --- /dev/null +++ b/elastic/decimal/api/example.cpp @@ -0,0 +1,37 @@ +#include +#include + +#include + +int main(int argc, char** argv) +try { + using namespace sw::universal; + edecimal d, e, f; + + e = 1.0f; + f = 0xFFFF'FFFF'FFFF'FFFFull; + d = e + f; + + std::cout << "one e : " << e << '\n'; + std::cout << "max unsigned long long f : " << f << '\n'; + std::cout << " d : " << d << std::endl; + + return EXIT_SUCCESS; + +} +catch (const char* msg) { + std::cerr << msg << std::endl; + return EXIT_FAILURE; +} +catch (const sw::universal::universal_arithmetic_exception& err) { + std::cerr << "Unprocessed universal arithmetic exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (const sw::universal::universal_internal_exception& err) { + std::cerr << "Unprocessed universal internal exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} diff --git a/include/universal/native/set_fields.hpp b/include/universal/native/set_fields.hpp index 7a2ae2c78..21ed9384a 100644 --- a/include/universal/native/set_fields.hpp +++ b/include/universal/native/set_fields.hpp @@ -16,7 +16,7 @@ namespace sw { namespace universal { inline BIT_CAST_CONSTEXPR void setbit(float& v, unsigned index, bool b = true) { uint32_t raw = std::bit_cast(v); - uint32_t mask = (1ull << index); // do we want to bound check? + uint32_t mask = (1u << index); // do we want to bound check? if (b) raw |= mask; else raw &= ~mask; v = std::bit_cast(raw); } diff --git a/include/universal/number/edecimal/edecimal_impl.hpp b/include/universal/number/edecimal/edecimal_impl.hpp index 5c6c8f524..7d7e2a115 100644 --- a/include/universal/number/edecimal/edecimal_impl.hpp +++ b/include/universal/number/edecimal/edecimal_impl.hpp @@ -1,7 +1,8 @@ #pragma once // edecimal_impl.hpp: definition of adaptive precision decimal integer data type // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. +// SPDX-License-Identifier: MIT // // This file is part of the universal numbers project, which is released under an MIT Open Source license. diff --git a/static/integer/decimal/api/api.cpp b/static/integer/decimal/api/api.cpp index 5b95866da..c41b1ef79 100644 --- a/static/integer/decimal/api/api.cpp +++ b/static/integer/decimal/api/api.cpp @@ -1,6 +1,7 @@ -// api.cpp: test suite runner for class interface tests of the decimal integer type +// api.cpp: test suite runner for class interface tests of the static (fixed-size) decimal integer type // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. +// SPDX-License-Identifier: MIT // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include