diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ce3f77900..e6d9abf6c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,3 +1,3 @@ { - "image": "stillwater/universal:clang14builder" + "image": "stillwater/universal:gcc11builder" } diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2df25fcc1..399995a0a 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -2,7 +2,7 @@ name: CMake on: push: - branches: [ v3.74, dev, main ] + branches: [ v3.75, dev, main ] pull_request: branches: [ main ] diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c05aa31f..c48b2c4c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,17 +10,7 @@ include(tools/cmake/banners.cmake) print_header() #### -# Set minimum version of CMake. Since we are using the VERSION option of the -# project command, we need at least 3.0. To honor the amazing work that -# the folks at KitWare have done for the open-source community, we are -# going to specify a recent version. -# As of UNIVERSAL v3.0 December 2019 -# Ubuntu 16.04 LTS runs cmake 3.5 -# Ubuntu 18.04 LTS runs cmake 3.10 -# Ubuntu 20.04 LTS runs cmake 3.16 -# Ubuntu 22.04 LTS runs cmake 3.22 -# container runs cmake 3.7.1 -# gcc5 container runs cmake 3.0.2 +# Set minimum version of CMake. cmake_minimum_required(VERSION 3.22) #### @@ -35,7 +25,7 @@ if(NOT DEFINED UNIVERSAL_VERSION_MAJOR) set(UNIVERSAL_VERSION_MAJOR 3) endif() if(NOT DEFINED UNIVERSAL_VERSION_MINOR) - set(UNIVERSAL_VERSION_MINOR 74) + set(UNIVERSAL_VERSION_MINOR 75) endif() if(NOT DEFINED UNIVERSAL_VERSION_PATCH) set(UNIVERSAL_VERSION_PATCH 1) @@ -221,34 +211,53 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) message(STATUS "C++20 has been enabled by default") # enable the regression testing level of the build -if(BUILD_REGRESSION_SANITY OR BUILD_REGRESSION_LEVEL_1) +#debug messages to troubleshoot regression level build configuration +#message(STATUS "BUILD_REGRESSION_STRESS ${BUILD_REGRESSION_STRESS} ") +#message(STATUS "BUILD_REGRESSION_SANITY ${BUILD_REGRESSION_SANITY} ") +#message(STATUS "BUILD_REGRESSION_LEVEL_1 ${BUILD_REGRESSION_LEVEL_1} ") +#message(STATUS "BUILD_REGRESSION_LEVEL_2 ${BUILD_REGRESSION_LEVEL_2} ") +#message(STATUS "BUILD_REGRESSION_LEVEL_3 ${BUILD_REGRESSION_LEVEL_3} ") +#message(STATUS "BUILD_REGRESSION_LEVEL_4 ${BUILD_REGRESSION_LEVEL_4} ") +if(BUILD_REGRESSION_STRESS) + message(STATUS "BUILD_REGRESSION_STRESS ${BUILD_REGRESSION_STRESS}") + set(BUILD_REGRESSION_LEVEL_4 ON) + set(BUILD_REGRESSION_SANITY OFF) +elseif(BUILD_REGRESSION_SANITY) + message(STATUS "BUILD_REGRESSION_SANITY ${BUILD_REGRESSION_SANITY}") + set(BUILD_REGRESSION_LEVEL_1 ON) +endif(BUILD_REGRESSION_STRESS) + +if(BUILD_REGRESSION_LEVEL_4) + message(STATUS "BUILD_REGRESSION_LEVEL_4 ${BUILD_REGRESSION_LEVEL_4}") add_definitions(-D REGRESSION_LEVEL_OVERRIDE) add_definitions(-D REGRESSION_LEVEL_1=1) - add_definitions(-D REGRESSION_LEVEL_2=0) - add_definitions(-D REGRESSION_LEVEL_3=0) - add_definitions(-D REGRESSION_LEVEL_4=0) -endif(BUILD_REGRESSION_SANITY OR BUILD_REGRESSION_LEVEL_1) -if(BUILD_REGRESSION_LEVEL_2) + add_definitions(-D REGRESSION_LEVEL_2=1) + add_definitions(-D REGRESSION_LEVEL_3=1) + add_definitions(-D REGRESSION_LEVEL_4=1) +elseif(BUILD_REGRESSION_LEVEL_3) + message(STATUS "BUILD_REGRESSION_LEVEL_3 ${BUILD_REGRESSION_LEVEL_3}") add_definitions(-D REGRESSION_LEVEL_OVERRIDE) add_definitions(-D REGRESSION_LEVEL_1=1) add_definitions(-D REGRESSION_LEVEL_2=1) - add_definitions(-D REGRESSION_LEVEL_3=0) + add_definitions(-D REGRESSION_LEVEL_3=1) add_definitions(-D REGRESSION_LEVEL_4=0) -endif(BUILD_REGRESSION_LEVEL_2) -if(BUILD_REGRESSION_LEVEL_3) +elseif(BUILD_REGRESSION_LEVEL_2) + message(STATUS "BUILD_REGRESSION_LEVEL_2 ${BUILD_REGRESSION_LEVEL_2}") add_definitions(-D REGRESSION_LEVEL_OVERRIDE) add_definitions(-D REGRESSION_LEVEL_1=1) add_definitions(-D REGRESSION_LEVEL_2=1) - add_definitions(-D REGRESSION_LEVEL_3=1) + add_definitions(-D REGRESSION_LEVEL_3=0) add_definitions(-D REGRESSION_LEVEL_4=0) -endif(BUILD_REGRESSION_LEVEL_3) -if(BUILD_REGRESSION_STRESS OR BUILD_REGRESSION_LEVEL_4) +elseif(BUILD_REGRESSION_LEVEL_1) + message(STATUS "BUILD_REGRESSION_LEVEL_1 ${BUILD_REGRESSION_LEVEL_1}") add_definitions(-D REGRESSION_LEVEL_OVERRIDE) - add_definitions(-D REGRESSION_LEVEL_1) - add_definitions(-D REGRESSION_LEVEL_2) - add_definitions(-D REGRESSION_LEVEL_3) - add_definitions(-D REGRESSION_LEVEL_4) -endif(BUILD_REGRESSION_STRESS OR BUILD_REGRESSION_LEVEL_4) + add_definitions(-D REGRESSION_LEVEL_1=1) + add_definitions(-D REGRESSION_LEVEL_2=0) + add_definitions(-D REGRESSION_LEVEL_3=0) + add_definitions(-D REGRESSION_LEVEL_4=0) +else(BUILD_REGRESSION_LEVEL_4) + message(STATUS "Nothing has been set") +endif(BUILD_REGRESSION_LEVEL_4) # Compiler specific environments if(CMAKE_COMPILER_IS_GNUCXX OR MINGW OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") @@ -890,28 +899,34 @@ endif(BUILD_PLAYGROUND) # application examples if(BUILD_APPLICATIONS) -add_subdirectory("applications/approximation") -add_subdirectory("applications/blas") -add_subdirectory("applications/chaos") -add_subdirectory("applications/chebyshev") -add_subdirectory("applications/complex") -add_subdirectory("applications/constants") -add_subdirectory("applications/cryptography") -add_subdirectory("applications/dnn") -add_subdirectory("applications/dsp") -add_subdirectory("applications/engineering") -add_subdirectory("applications/floating-point") -add_subdirectory("applications/math") -add_subdirectory("applications/numeric") -add_subdirectory("applications/ode") -add_subdirectory("applications/optimization") -add_subdirectory("applications/pde") -add_subdirectory("applications/roots") -add_subdirectory("applications/science") -add_subdirectory("applications/sequences") +add_subdirectory("applications/accuracy/engineering") +add_subdirectory("applications/accuracy/ode") +add_subdirectory("applications/accuracy/optimization") +add_subdirectory("applications/accuracy/pde") +add_subdirectory("applications/accuracy/roots") +add_subdirectory("applications/accuracy/science") + +add_subdirectory("applications/approximation/taylor") +add_subdirectory("applications/approximation/chebyshev") + +add_subdirectory("applications/mixed-precision/dnn") +add_subdirectory("applications/mixed-precision/dsp") + +add_subdirectory("applications/performance/chaos") +add_subdirectory("applications/performance/complex") +add_subdirectory("applications/performance/stream") +add_subdirectory("applications/performance/weather") + +add_subdirectory("applications/precision/constants") +add_subdirectory("applications/precision/floating-point") +add_subdirectory("applications/precision/math") +add_subdirectory("applications/precision/numeric") + +add_subdirectory("applications/reproducibility/blas") +add_subdirectory("applications/reproducibility/cryptography") +add_subdirectory("applications/reproducibility/sequences") + add_subdirectory("applications/stl") -add_subdirectory("applications/stream") -add_subdirectory("applications/weather") endif(BUILD_APPLICATIONS) ################################################################## diff --git a/Dockerfile b/Dockerfile index 0a9d77ab2..fdfbe7dd1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -69,5 +69,5 @@ WORKDIR /home/stillwater/universal/build # the command 'make test' is run as part of the CI test pipeline of this release container -ENV CONTAINER_ID "Universal Numbers Library Container" +ENV CONTAINER_ID "Universal Number Systems Container" CMD ["/usr/bin/env", "bash"] diff --git a/applications/accuracy/engineering/CMakeLists.txt b/applications/accuracy/engineering/CMakeLists.txt new file mode 100644 index 000000000..720f7a169 --- /dev/null +++ b/applications/accuracy/engineering/CMakeLists.txt @@ -0,0 +1,3 @@ +file (GLOB SOURCES "./*.cpp") + +compile_all("true" "engineering" "Applications/Accuracy/Engineering" "${SOURCES}") diff --git a/applications/engineering/chem_equilibrium.cpp b/applications/accuracy/engineering/chem_equilibrium.cpp similarity index 100% rename from applications/engineering/chem_equilibrium.cpp rename to applications/accuracy/engineering/chem_equilibrium.cpp diff --git a/applications/engineering/water.cpp b/applications/accuracy/engineering/water.cpp similarity index 100% rename from applications/engineering/water.cpp rename to applications/accuracy/engineering/water.cpp diff --git a/applications/ode/CMakeLists.txt b/applications/accuracy/ode/CMakeLists.txt similarity index 100% rename from applications/ode/CMakeLists.txt rename to applications/accuracy/ode/CMakeLists.txt diff --git a/applications/ode/convergence.cpp b/applications/accuracy/ode/convergence.cpp similarity index 100% rename from applications/ode/convergence.cpp rename to applications/accuracy/ode/convergence.cpp diff --git a/applications/ode/first_order_ode.cpp b/applications/accuracy/ode/first_order_ode.cpp similarity index 100% rename from applications/ode/first_order_ode.cpp rename to applications/accuracy/ode/first_order_ode.cpp diff --git a/applications/ode/general_runge_kutta.cpp b/applications/accuracy/ode/general_runge_kutta.cpp similarity index 100% rename from applications/ode/general_runge_kutta.cpp rename to applications/accuracy/ode/general_runge_kutta.cpp diff --git a/applications/ode/runge_kutta4.cpp b/applications/accuracy/ode/runge_kutta4.cpp similarity index 100% rename from applications/ode/runge_kutta4.cpp rename to applications/accuracy/ode/runge_kutta4.cpp diff --git a/applications/optimization/CMakeLists.txt b/applications/accuracy/optimization/CMakeLists.txt similarity index 100% rename from applications/optimization/CMakeLists.txt rename to applications/accuracy/optimization/CMakeLists.txt diff --git a/applications/optimization/error_vs_cost.cpp b/applications/accuracy/optimization/error_vs_cost.cpp similarity index 100% rename from applications/optimization/error_vs_cost.cpp rename to applications/accuracy/optimization/error_vs_cost.cpp diff --git a/applications/pde/CMakeLists.txt b/applications/accuracy/pde/CMakeLists.txt similarity index 100% rename from applications/pde/CMakeLists.txt rename to applications/accuracy/pde/CMakeLists.txt diff --git a/applications/pde/Jacobi-and-Gauss-Seidel.pdf b/applications/accuracy/pde/Jacobi-and-Gauss-Seidel.pdf similarity index 100% rename from applications/pde/Jacobi-and-Gauss-Seidel.pdf rename to applications/accuracy/pde/Jacobi-and-Gauss-Seidel.pdf diff --git a/applications/pde/algorithms.txt b/applications/accuracy/pde/algorithms.txt similarity index 100% rename from applications/pde/algorithms.txt rename to applications/accuracy/pde/algorithms.txt diff --git a/applications/pde/cg.cpp b/applications/accuracy/pde/cg.cpp similarity index 100% rename from applications/pde/cg.cpp rename to applications/accuracy/pde/cg.cpp diff --git a/applications/pde/gauss_seidel.cpp b/applications/accuracy/pde/gauss_seidel.cpp similarity index 100% rename from applications/pde/gauss_seidel.cpp rename to applications/accuracy/pde/gauss_seidel.cpp diff --git a/applications/pde/jacobi.cpp b/applications/accuracy/pde/jacobi.cpp similarity index 100% rename from applications/pde/jacobi.cpp rename to applications/accuracy/pde/jacobi.cpp diff --git a/applications/pde/laplace.cpp b/applications/accuracy/pde/laplace.cpp similarity index 100% rename from applications/pde/laplace.cpp rename to applications/accuracy/pde/laplace.cpp diff --git a/applications/pde/sor.cpp b/applications/accuracy/pde/sor.cpp similarity index 100% rename from applications/pde/sor.cpp rename to applications/accuracy/pde/sor.cpp diff --git a/applications/roots/CMakeLists.txt b/applications/accuracy/roots/CMakeLists.txt similarity index 100% rename from applications/roots/CMakeLists.txt rename to applications/accuracy/roots/CMakeLists.txt diff --git a/applications/roots/README.md b/applications/accuracy/roots/README.md similarity index 100% rename from applications/roots/README.md rename to applications/accuracy/roots/README.md diff --git a/applications/roots/bisection.cpp b/applications/accuracy/roots/bisection.cpp similarity index 100% rename from applications/roots/bisection.cpp rename to applications/accuracy/roots/bisection.cpp diff --git a/applications/roots/rpoly_ak1.cpp b/applications/accuracy/roots/rpoly_ak1.cpp similarity index 100% rename from applications/roots/rpoly_ak1.cpp rename to applications/accuracy/roots/rpoly_ak1.cpp diff --git a/applications/roots/rpoly_ak1dat.txt b/applications/accuracy/roots/rpoly_ak1dat.txt similarity index 100% rename from applications/roots/rpoly_ak1dat.txt rename to applications/accuracy/roots/rpoly_ak1dat.txt diff --git a/applications/roots/rpoly_ak1out.txt b/applications/accuracy/roots/rpoly_ak1out.txt similarity index 100% rename from applications/roots/rpoly_ak1out.txt rename to applications/accuracy/roots/rpoly_ak1out.txt diff --git a/applications/accuracy/science/CMakeLists.txt b/applications/accuracy/science/CMakeLists.txt new file mode 100644 index 000000000..7bba17e5f --- /dev/null +++ b/applications/accuracy/science/CMakeLists.txt @@ -0,0 +1,3 @@ +file (GLOB SOURCES "./*.cpp") + +compile_all("true" "science" "Applications/Accuracy/Science" "${SOURCES}") diff --git a/applications/science/README.md b/applications/accuracy/science/README.md similarity index 100% rename from applications/science/README.md rename to applications/accuracy/science/README.md diff --git a/applications/science/iso_constants.cpp b/applications/accuracy/science/iso_constants.cpp similarity index 100% rename from applications/science/iso_constants.cpp rename to applications/accuracy/science/iso_constants.cpp diff --git a/applications/science/physics_constants.cpp b/applications/accuracy/science/physics_constants.cpp similarity index 100% rename from applications/science/physics_constants.cpp rename to applications/accuracy/science/physics_constants.cpp diff --git a/applications/approximation/CMakeLists.txt b/applications/approximation/CMakeLists.txt deleted file mode 100644 index fd54fad0c..000000000 --- a/applications/approximation/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -file (GLOB SOURCES "./*.cpp") - -compile_all("true" "approx" "Applications/Approximation" "${SOURCES}") diff --git a/applications/approximation/chebyshev/CMakeLists.txt b/applications/approximation/chebyshev/CMakeLists.txt new file mode 100644 index 000000000..e33a3cf4e --- /dev/null +++ b/applications/approximation/chebyshev/CMakeLists.txt @@ -0,0 +1,3 @@ +file (GLOB SOURCES "./*.cpp") + +compile_all("true" "cheby" "Applications/Approximation/Chebyshev" "${SOURCES}") diff --git a/applications/chebyshev/Chebyshev-Low-Pass-Filtering.pdf b/applications/approximation/chebyshev/Chebyshev-Low-Pass-Filtering.pdf similarity index 100% rename from applications/chebyshev/Chebyshev-Low-Pass-Filtering.pdf rename to applications/approximation/chebyshev/Chebyshev-Low-Pass-Filtering.pdf diff --git a/applications/chebyshev/README.md b/applications/approximation/chebyshev/README.md similarity index 100% rename from applications/chebyshev/README.md rename to applications/approximation/chebyshev/README.md diff --git a/applications/chebyshev/baryweights.hpp b/applications/approximation/chebyshev/baryweights.hpp similarity index 100% rename from applications/chebyshev/baryweights.hpp rename to applications/approximation/chebyshev/baryweights.hpp diff --git a/applications/chebyshev/chebfun.hpp b/applications/approximation/chebyshev/chebfun.hpp similarity index 100% rename from applications/chebyshev/chebfun.hpp rename to applications/approximation/chebyshev/chebfun.hpp diff --git a/applications/chebyshev/chebmat.hpp b/applications/approximation/chebyshev/chebmat.hpp similarity index 100% rename from applications/chebyshev/chebmat.hpp rename to applications/approximation/chebyshev/chebmat.hpp diff --git a/applications/chebyshev/chebpoly.hpp b/applications/approximation/chebyshev/chebpoly.hpp similarity index 79% rename from applications/chebyshev/chebpoly.hpp rename to applications/approximation/chebyshev/chebpoly.hpp index f8ad657dd..2b37a76be 100644 --- a/applications/chebyshev/chebpoly.hpp +++ b/applications/approximation/chebyshev/chebpoly.hpp @@ -1,26 +1,20 @@ -// CHEBPOLY(n,kind) - returns the coefficients of Chebyshev poly of the kind. -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +#pragma once +// CHEBPOLY(n,kind) - returns the coefficients of Chebyshev polynomial +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. // // Author: James Quinlan -#pragma once - #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 -#include #include namespace chebyshev { using namespace sw::universal; + template blas::vector chebpoly(size_t n) - { - if(n<0){ - std::cerr << "Parameter must be a nonnegative integer. Provided n == " << n << '\n'; - return blas::vector(1); - } - + { blas::vectorTn(n+1); if (n==0) Tn(0) = 1; if (n==1) { Tn(0) = 0; Tn(1) = 1; } diff --git a/applications/chebyshev/chebpts.hpp b/applications/approximation/chebyshev/chebpts.hpp similarity index 100% rename from applications/chebyshev/chebpts.hpp rename to applications/approximation/chebyshev/chebpts.hpp diff --git a/applications/chebyshev/chebtests.cpp b/applications/approximation/chebyshev/chebtests.cpp similarity index 98% rename from applications/chebyshev/chebtests.cpp rename to applications/approximation/chebyshev/chebtests.cpp index a57a6253d..236dad0c5 100644 --- a/applications/chebyshev/chebtests.cpp +++ b/applications/approximation/chebyshev/chebtests.cpp @@ -1,10 +1,10 @@ // ChebyTESTS -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. // // Author: James Quinlan - +#include // Dependencies #include /* sin, cos, etc. */ diff --git a/applications/chebyshev/diff.hpp b/applications/approximation/chebyshev/diff.hpp similarity index 100% rename from applications/chebyshev/diff.hpp rename to applications/approximation/chebyshev/diff.hpp diff --git a/applications/chebyshev/lambdas.cpp b/applications/approximation/chebyshev/lambdas.cpp similarity index 100% rename from applications/chebyshev/lambdas.cpp rename to applications/approximation/chebyshev/lambdas.cpp diff --git a/applications/chebyshev/legpts.hpp b/applications/approximation/chebyshev/legpts.hpp similarity index 100% rename from applications/chebyshev/legpts.hpp rename to applications/approximation/chebyshev/legpts.hpp diff --git a/applications/chebyshev/linscale.hpp b/applications/approximation/chebyshev/linscale.hpp similarity index 100% rename from applications/chebyshev/linscale.hpp rename to applications/approximation/chebyshev/linscale.hpp diff --git a/applications/chebyshev/meandistance.hpp b/applications/approximation/chebyshev/meandistance.hpp similarity index 100% rename from applications/chebyshev/meandistance.hpp rename to applications/approximation/chebyshev/meandistance.hpp diff --git a/applications/chebyshev/nodes.cpp b/applications/approximation/chebyshev/nodes.cpp similarity index 91% rename from applications/chebyshev/nodes.cpp rename to applications/approximation/chebyshev/nodes.cpp index c6383b61c..d5c9c3f4f 100644 --- a/applications/chebyshev/nodes.cpp +++ b/applications/approximation/chebyshev/nodes.cpp @@ -1,8 +1,9 @@ // nodes.cpp: Does a posit configuration exist to produce chebyshev nodes // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. +#include // Configure the posit library with arithmetic exceptions // enable posit arithmetic exceptions @@ -31,16 +32,14 @@ log_e(10) M_LN10 2.30258509299404568402 constexpr double pi = 3.14159265358979323846; // best practice for C++ -int main(int argc, char** argv) +int main() try { using namespace sw::universal; - int nrOfFailedTestCases = 0; - // TBD std::cout << "PI = " << pi << '\n'; - return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + return EXIT_SUCCESS; } catch (char const* msg) { std::cerr << msg << std::endl; diff --git a/applications/chebyshev/ones.hpp b/applications/approximation/chebyshev/ones.hpp similarity index 100% rename from applications/chebyshev/ones.hpp rename to applications/approximation/chebyshev/ones.hpp diff --git a/applications/chebyshev/playground.cpp b/applications/approximation/chebyshev/playground.cpp similarity index 100% rename from applications/chebyshev/playground.cpp rename to applications/approximation/chebyshev/playground.cpp diff --git a/applications/chebyshev/prod.hpp b/applications/approximation/chebyshev/prod.hpp similarity index 100% rename from applications/chebyshev/prod.hpp rename to applications/approximation/chebyshev/prod.hpp diff --git a/applications/chebyshev/rpad.hpp b/applications/approximation/chebyshev/rpad.hpp similarity index 100% rename from applications/chebyshev/rpad.hpp rename to applications/approximation/chebyshev/rpad.hpp diff --git a/applications/chebyshev/rshift.hpp b/applications/approximation/chebyshev/rshift.hpp similarity index 100% rename from applications/chebyshev/rshift.hpp rename to applications/approximation/chebyshev/rshift.hpp diff --git a/applications/chebyshev/skeleton.cpp b/applications/approximation/chebyshev/skeleton.cpp similarity index 90% rename from applications/chebyshev/skeleton.cpp rename to applications/approximation/chebyshev/skeleton.cpp index e75ea5c44..b36d85b87 100644 --- a/applications/chebyshev/skeleton.cpp +++ b/applications/approximation/chebyshev/skeleton.cpp @@ -1,8 +1,9 @@ // nodes.cpp: Does a posit configuration exist to produce chebyshev nodes // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. +#include #include // Configure the posit library with arithmetic exceptions // enable posit arithmetic exceptions @@ -12,12 +13,10 @@ #include // skeleton environment to experiment with Chebyshev polynomials and approximations -int main(int argc, char** argv) +int main() try { using namespace sw::universal::blas; - int nrOfFailedTestCases = 0; - std::cout << "Chebyshev polynomial test skeleton\n"; // using Scalar = sw::universal::fixpnt<32,16, Modulo, uint32_t>; @@ -29,7 +28,7 @@ try { auto cosines = -cos(k * PI / N); std::cout << "cosines = " << cosines << '\n'; - return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + return EXIT_SUCCESS; } catch (char const* msg) { std::cerr << "Caught exception: " << msg << std::endl; diff --git a/applications/approximation/taylor/CMakeLists.txt b/applications/approximation/taylor/CMakeLists.txt new file mode 100644 index 000000000..9c228f662 --- /dev/null +++ b/applications/approximation/taylor/CMakeLists.txt @@ -0,0 +1,3 @@ +file (GLOB SOURCES "./*.cpp") + +compile_all("true" "approx" "Applications/Approximation/Taylor Series" "${SOURCES}") diff --git a/applications/approximation/taylor_series.cpp b/applications/approximation/taylor/taylor_series.cpp similarity index 83% rename from applications/approximation/taylor_series.cpp rename to applications/approximation/taylor/taylor_series.cpp index 6a66552a2..63549cb2d 100644 --- a/applications/approximation/taylor_series.cpp +++ b/applications/approximation/taylor/taylor_series.cpp @@ -1,8 +1,9 @@ // taylor_series.cpp: experiments with number systems approximating the Reals approximating functions // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the UNIVERSAL project, which is released under an MIT Open Source license. +#include #include #include @@ -37,14 +38,22 @@ int main() try { using namespace sw::universal; - std::string test_suite = "Experiments with Taylor Series Expansion"; - std::string test_tag = "operator"; + std::string test_suite = "Experiments with Taylor Series Expansion"; + std::string test_tag = "taylor series expansion"; int nrOfFailedTestCases = 0; std::cout << test_suite << '\n'; + fp32 ca(SpecificValue::minpos), cb(SpecificValue::minpos); + float fa, fb; + + fa = float(ca); + fb = float(cb); + + nrOfFailedTestCases += ReportTestResult(TestCase(TestCaseOperator::DIV, fa, fb), test_tag, "div"); + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); - return EXIT_SUCCESS; + return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); } catch (char const* msg) { std::cerr << "Caught ad-hoc exception: " << msg << std::endl; diff --git a/applications/chebyshev/CMakeLists.txt b/applications/chebyshev/CMakeLists.txt deleted file mode 100644 index 547ff0d63..000000000 --- a/applications/chebyshev/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -file (GLOB SOURCES "./*.cpp") - -compile_all("true" "cheby" "Applications/Chebyshev" "${SOURCES}") diff --git a/applications/constants/CMakeLists.txt b/applications/constants/CMakeLists.txt deleted file mode 100644 index 3a54e065f..000000000 --- a/applications/constants/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -file (GLOB SOURCES "./*.cpp") - -compile_all("true" "adaptive" "Applications/Oracles/Constants" "${SOURCES}") diff --git a/applications/cryptography/large_lcm.cpp b/applications/cryptography/large_lcm.cpp deleted file mode 100644 index a0eef2e8d..000000000 --- a/applications/cryptography/large_lcm.cpp +++ /dev/null @@ -1,157 +0,0 @@ -// large_lcm.cpp: calculating a least common multiple of a very large set -// -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. -// -// This file is part of the universal numbers project, which is released under an MIT Open Source license. -#include -#include -#include -#include -#include -#include -// include the number system we want to use, and configure overflow exceptions so we can capture failures -#define INTEGER_THROW_ARITHMETIC_EXCEPTION 1 -#include - -template -void MeasureLCM(const std::vector>& v) { - std::chrono::steady_clock::time_point begin, end; - begin = std::chrono::steady_clock::now(); - using Integer = sw::universal::integer; - Integer least_common_multple = lcm(v); - end = std::chrono::steady_clock::now(); - using TimeReal = float; - std::chrono::duration time_span = std::chrono::duration_cast> (end - begin); - TimeReal elapsed = time_span.count(); - - std::cout << "In " << elapsed << " seconds calculated LCM of " << v.size() << " elements of type " << typeid(Integer).name() - << " to be\n" << least_common_multple << '\n'; -} - -#define STRESS_TESTING 0 - -// Warning C6262 Function uses '16448' bytes of stack : exceeds / analyze : stacksize '16384'.Consider moving some data to heap.crypto_large_lcm C : \Users\tomtz\Documents\dev\clones\universal\applications\cryptography\large_lcm.cpp 31 -// TODO: what gets allocated on the stack? Integer factor, but that is max 256bytes -int main() -try { - using namespace sw::universal; - - int nrOfFailedTestCases = 0; - - { - constexpr unsigned nbits = 512; - using Integer = integer; - Integer factor; - - // use random_device to generate a seed for Mersenne twister engine - std::random_device rd{}; - std::mt19937 engine{ rd() }; - std::uniform_real_distribution dist{0.0, 1000000000000.0 }; - - std::vector v; - for (int i = 0; i < 10; ++i) { - factor = dist(engine); - if (factor.iseven()) ++factor; - // cout << factor << endl; - v.push_back(factor); - } - try { - MeasureLCM(v); - } - catch (const integer_overflow& e) { - std::cerr << e.what() << '\n'; - std::cerr << typeid(Integer).name() << " has insufficient dynamic range to capture the least common multiple\n"; - std::ofstream out; - out.open("lcm_dataset_1.txt"); - for (size_t i = 0; i < v.size(); ++i) { - out << v[i] << '\n'; - } - out.close(); - } - } - - // this triggers the integer_overflow exception - { - constexpr unsigned nbits = 1024; - using Integer = integer; - Integer factor; - - std::random_device rd{}; - std::mt19937 engine{ rd() }; - std::uniform_real_distribution dist{0.0, 100000.0 }; - - std::vector v; - for (int i = 0; i < 100; ++i) { - factor = dist(engine); - if (factor.iseven()) ++factor; - v.push_back(factor); - } - try { - MeasureLCM(v); - } - catch (const integer_overflow& e) { - std::cerr << e.what() << '\n'; - std::cerr << typeid(Integer).name() << " has insufficient dynamic range to capture the least common multiple\n"; - std::ofstream out; - out.open("lcm_dataset_2.txt"); - for (size_t i = 0; i < v.size(); ++i) { - out << v[i] << '\n'; - } - out.close(); - } - } - -#if STRESS_TESTING - { - constexpr unsigned nbits = 2048; - using Integer = integer; - Integer factor; - - std::random_device rd{}; - std::mt19937 engine{ rd() }; - std::uniform_real_distribution dist{0.0, 1000.0 }; - - std::vector v; - for (int i = 0; i < 1000; ++i) { - factor = dist(engine); - if (factor.iseven()) ++factor; - v.push_back(factor); - } - try { - MeasureLCM(v); - } - catch (const integer_overflow& e) { - std::cerr << e.what() << '\n'; - std::cerr << typeid(Integer).name() << " has insufficient dynamic range to capture the least common multiple\n"; - std::ofstream out; - out.open("lcm_dataset_3.txt"); - for (size_t i = 0; i < v.size(); ++i) { - out << v[i] << '\n'; - } - out.close(); - } - } -#endif - - return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); -} -catch (char const* msg) { - std::cerr << "Caught ad-hoc exception: " << msg << std::endl; - return EXIT_FAILURE; -} -catch (const sw::universal::universal_arithmetic_exception& err) { - std::cerr << "Caught unexpected universal arithmetic exception: " << err.what() << std::endl; - return EXIT_FAILURE; -} -catch (const sw::universal::universal_internal_exception& err) { - std::cerr << "Caught unexpected universal internal exception: " << err.what() << std::endl; - return EXIT_FAILURE; -} -catch (std::runtime_error& err) { - std::cerr << "Caught unexpected runtime error: " << err.what() << std::endl; - return EXIT_FAILURE; -} -catch (...) { - std::cerr << "Caught unknown exception" << std::endl; - return EXIT_FAILURE; -} diff --git a/applications/dnn/CMakeLists.txt b/applications/dnn/CMakeLists.txt deleted file mode 100644 index b0edac833..000000000 --- a/applications/dnn/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -file (GLOB SOURCES "./*.cpp") - -compile_all("true" "dnn" "Applications/Performance/Deep Learning" "${SOURCES}") diff --git a/applications/engineering/CMakeLists.txt b/applications/engineering/CMakeLists.txt deleted file mode 100644 index c77963002..000000000 --- a/applications/engineering/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -file (GLOB SOURCES "./*.cpp") - -compile_all("true" "engineering" "Applications/Accuracy/Computational Engineering" "${SOURCES}") diff --git a/applications/mixed-precision/dnn/CMakeLists.txt b/applications/mixed-precision/dnn/CMakeLists.txt new file mode 100644 index 000000000..0a9aa8c73 --- /dev/null +++ b/applications/mixed-precision/dnn/CMakeLists.txt @@ -0,0 +1,3 @@ +file (GLOB SOURCES "./*.cpp") + +compile_all("true" "dnn" "Applications/Mixed Precision/Deep Learning" "${SOURCES}") diff --git a/applications/dnn/README.md b/applications/mixed-precision/dnn/README.md similarity index 100% rename from applications/dnn/README.md rename to applications/mixed-precision/dnn/README.md diff --git a/applications/mixed-precision/dnn/fit_sin.cpp b/applications/mixed-precision/dnn/fit_sin.cpp new file mode 100644 index 000000000..a1572ca67 --- /dev/null +++ b/applications/mixed-precision/dnn/fit_sin.cpp @@ -0,0 +1,171 @@ +// fit_sin.cpp: fit y = sin(x) with a third order polynomial using gradient descent +// +// Copyright (C) 2017 Stillwater Supercomputing, Inc. +// +// This file is part of the universal numbers project, which is released under an MIT Open Source license. +#include + +// Configure the cfloat and lns environment +#include +#include +#include +#include +#include +#include + +/* +We will use a problem of fitting the function y=sin(x) with a third order polynomial as our example. +The network will have four parameters (a, b, c, d), and will be trained with gradient descent to fit random data +by minimizing the Euclidean distance between the network output and the true output. + +In the same directory there is a graphic, sin-function-fit.png that graphs the resulting polynomial fit. + */ + +template +void SinFunctionFit() { + using namespace sw::universal; + + constexpr int nrSamples = 1024; + + using Vector = blas::vector; + + Vector x(nrSamples), y(nrSamples), y_pred(nrSamples); + // create linear samples between -pi and pi + x = blas::linspace(-m_pi, m_pi, nrSamples); // we create a vector due to m_pi and then assign to vector + y = blas::sin(x); + + // model parameters + Scalar a{ 0.123 }, b{ 0.435 }, c{ 0.586 }, d{ 0.295 }; // initialize model weights with random data + auto x1(x); + auto x2(x1); x2 *= x; + auto x3(x2); x3 *= x; + Vector av(nrSamples); + av = a; + + Scalar learning_rate = 1e-6; + int iterations = 2000; + for (int r = 0; r < iterations; ++r) { + // forward pass + // y = a + bx + cx^2 + dx^3 + auto bx(x1); bx *= b; + auto cxx(x2); cxx *= c; + auto dxxx(x3); dxxx *= d; + y_pred = av + bx + cxx + dxxx; + + // compute and print loss function + Scalar loss = (blas::square(y_pred - y)).sum(); + if (r % 100 == 99) { + std::cout << "[ " << std::setw(4) << r << "] : " << loss << '\n'; + } + + // backward pass + Vector grad_y_pred = Scalar(2.0) * (y_pred - y); + Scalar grad_a = grad_y_pred.sum(); + Vector grad_y_times(grad_y_pred); + grad_y_times *= x1; + Scalar grad_b = grad_y_times.sum(); + grad_y_times = grad_y_pred; + grad_y_times *= x2; + Scalar grad_c = grad_y_times.sum(); + grad_y_times = grad_y_pred; + grad_y_times *= x3; + Scalar grad_d = grad_y_times.sum(); + + // update weights + a -= (learning_rate * grad_a); + b -= (learning_rate * grad_b); + c -= (learning_rate * grad_c); + d -= (learning_rate * grad_d); + } + + std::cout << "Result : y = " << a << " + " << b << "x + " << c << "x^2 + " << d << "x^3\n"; +} + +// 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 + +int main() +try { + using namespace sw::universal; + + +#if MANUAL_TESTING + using bf16 = cfloat<16, 8, uint16_t, true, true, false>; + SinFunctionFit(); // Result : y = -0.2031700 + 0.800356x + -0.0207303x^2 + -0.0852961x^3: loss = 13.1245 + SinFunctionFit(); // Result : y = -0.2031700 + 0.800356x + -0.0207303x^2 + -0.0852961x^3: loss = 13.1245 + SinFunctionFit(); // Result : y = 0.0190430 + 0.396484x + -0.0191650x^2 + -0.0280762x^3: loss = 64.0000 + SinFunctionFit(); // Result : y = nan + nanx + nanx^2 + nanx^3 : loss = NaN + + // hypothesis: the c and d terms are squares and cubes and they need a lot of dynamic range + // we can pick a posit with saturating behavior and large dynamic range to check + using p16_2 = posit<16, 2>; + using p16_3 = posit<16, 3>; + using p16_4 = posit<16, 4>; + SinFunctionFit(); // Result : y = -0.2219240 + 0.743164x + -0.0205994x^2 + -0.0772095x^3: loss = 17.3125 + SinFunctionFit(); // Result : y = -0.2207030 + 0.627930x + -0.0206146x^2 + -0.0608521x^3: loss = 38.8125 + SinFunctionFit(); // Result : y = -0.1250000 + 0.500000x + -0.0204468x^2 + -0.0426636x^3: loss = 80.25 + + // logarithmic number systems also have large dynamic range + using l16_4 = lns<16, 4, uint16_t>; // large dynamic range, low precision + using l16_8 = lns<16, 8, uint16_t>; // medium dynamic range, medium precision + using l16_12 = lns<16, 12, uint16_t>; // low dynamic range, high precision + using l16_14 = lns<16, 14, uint16_t>; + SinFunctionFit(); // Result : y = 0.1250000 + 0.439063x + 0.5452540x^2 + -0.0405262x^3: loss = 1386.76 + SinFunctionFit(); // Result : y = -0.0837292 + 0.395063x + -0.0201537x^2 + -0.0280423x^3: loss = 119.299 + SinFunctionFit(); // Result : y = 0.1230070 + 0.434995x + 0.5860130x^2 + 0.2949960x^3: loss = 15.9973 + SinFunctionFit(); // Result : y = 0 + 0x + 0.585988x^2 + 0x^3 : loss = 1.99992 + +#else + +#if REGRESSION_LEVEL_1 + SinFunctionFit(); // Result : y = -0.2031700 + 0.800356x + -0.0207303x^2 + -0.0852961x^3: loss = 13.1245 +#endif + +#if REGRESSION_LEVEL_2 + +#endif + +#if REGRESSION_LEVEL_3 + +#endif + +#if REGRESSION_LEVEL_4 + +#endif + +#endif + return EXIT_SUCCESS; +} +catch (char const* msg) { + std::cerr << "Caught ad-hoc exception: " << msg << std::endl; + return EXIT_FAILURE; +} +catch (const sw::universal::universal_arithmetic_exception& err) { + std::cerr << "Caught unexpected universal arithmetic exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (const sw::universal::universal_internal_exception& err) { + std::cerr << "Caught unexpected universal internal exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (std::runtime_error& err) { + std::cerr << "Caught unexpected runtime error: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} diff --git a/applications/dnn/mnist.cpp b/applications/mixed-precision/dnn/mnist.cpp similarity index 92% rename from applications/dnn/mnist.cpp rename to applications/mixed-precision/dnn/mnist.cpp index ebe6797b4..c49580062 100644 --- a/applications/dnn/mnist.cpp +++ b/applications/mixed-precision/dnn/mnist.cpp @@ -1,21 +1,19 @@ // mnist.cpp: example program showing a mixed-precision LeNet-5 DNN // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include -#include + // Configure the cfloat and lns environment #include #include #include -int main(int argc, char** argv) +int main() try { using namespace sw::universal; - print_cmd_line(argc, argv); - constexpr bool hasSubnormals = true; constexpr bool hasSupernormals = true; constexpr bool isSaturating = false; diff --git a/applications/dnn/schedules.cpp b/applications/mixed-precision/dnn/schedules.cpp similarity index 94% rename from applications/dnn/schedules.cpp rename to applications/mixed-precision/dnn/schedules.cpp index 39a34fd07..faaef3e1d 100644 --- a/applications/dnn/schedules.cpp +++ b/applications/mixed-precision/dnn/schedules.cpp @@ -1,10 +1,10 @@ // schedules.cpp: show different matmul schedules for MLIR compilers // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include -#include + // Configure the cfloat and lns environment #include #include @@ -51,12 +51,10 @@ void outer_product_method(unsigned N = 3) { -int main(int argc, char** argv) +int main() try { using namespace sw::universal; - print_cmd_line(argc, argv); - inner_product_method(); middle_product_method(); outer_product_method(); diff --git a/applications/mixed-precision/dnn/sin-function-fit.png b/applications/mixed-precision/dnn/sin-function-fit.png new file mode 100644 index 000000000..c1f42d12b Binary files /dev/null and b/applications/mixed-precision/dnn/sin-function-fit.png differ diff --git a/applications/dsp/CMakeLists.txt b/applications/mixed-precision/dsp/CMakeLists.txt similarity index 100% rename from applications/dsp/CMakeLists.txt rename to applications/mixed-precision/dsp/CMakeLists.txt diff --git a/applications/dsp/README.md b/applications/mixed-precision/dsp/README.md similarity index 100% rename from applications/dsp/README.md rename to applications/mixed-precision/dsp/README.md diff --git a/applications/dsp/adc_mapping.cpp b/applications/mixed-precision/dsp/adc_mapping.cpp similarity index 93% rename from applications/dsp/adc_mapping.cpp rename to applications/mixed-precision/dsp/adc_mapping.cpp index f10ae6f06..0308b00a9 100644 --- a/applications/dsp/adc_mapping.cpp +++ b/applications/mixed-precision/dsp/adc_mapping.cpp @@ -1,9 +1,9 @@ // adc_mapping.cpp: example program showing how to map ADC values to posit values // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. - +#include // Configure the posit library with arithmetic exceptions // enable posit arithmetic exceptions #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 @@ -44,12 +44,10 @@ void GenerateSample() { std::cout << a << " / " << b << " = " << a / b << '\n'; } -int main(int argc, char** argv) +int main() try { using namespace sw::universal; - int nrOfFailedTestCases = 0; - GenerateSample<16, 1>(); GenerateSample<32, 2>(); @@ -65,7 +63,7 @@ try { std::cout << " 0 / 8192 = 0.00000000 " << color_print(zero) << '\n'; std::cout << " -1 / 8192 = " << -a << " " << color_print(-a) << '\n'; - return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + return EXIT_SUCCESS; } catch (char const* msg) { std::cerr << "Caught ad-hoc exception: " << msg << std::endl; diff --git a/applications/dsp/common.hpp b/applications/mixed-precision/dsp/common.hpp similarity index 100% rename from applications/dsp/common.hpp rename to applications/mixed-precision/dsp/common.hpp diff --git a/applications/dsp/dsp_utils.hpp b/applications/mixed-precision/dsp/dsp_utils.hpp similarity index 100% rename from applications/dsp/dsp_utils.hpp rename to applications/mixed-precision/dsp/dsp_utils.hpp diff --git a/applications/dsp/fir_filter.cpp b/applications/mixed-precision/dsp/fir_filter.cpp similarity index 92% rename from applications/dsp/fir_filter.cpp rename to applications/mixed-precision/dsp/fir_filter.cpp index af555ffba..f6ae126b3 100644 --- a/applications/dsp/fir_filter.cpp +++ b/applications/mixed-precision/dsp/fir_filter.cpp @@ -1,9 +1,9 @@ // fir_filter.cpp example program showing a FIR filter using error-free custom posit configurations // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. - +#include // Configure the posit library with arithmetic exceptions // enable posit arithmetic exceptions #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 @@ -31,14 +31,13 @@ log_e(10) M_LN10 2.30258509299404568402 constexpr double pi = 3.14159265358979323846; // best practice for C++ -int main(int argc, char** argv) +int main() try { using namespace sw::universal; const size_t nbits = 16; const size_t es = 1; const size_t vecSize = 32; - int nrOfFailedTestCases = 0; posit two_pi = 2.0 * pi; std::vector< posit > sinusoid(vecSize), weights(vecSize); @@ -57,7 +56,7 @@ try { } std::cout << "Value is " << fir << '\n'; - return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + return EXIT_SUCCESS; } catch (char const* msg) { std::cerr << "Caught ad-hoc exception: " << msg << std::endl; diff --git a/applications/chaos/CMakeLists.txt b/applications/performance/chaos/CMakeLists.txt similarity index 100% rename from applications/chaos/CMakeLists.txt rename to applications/performance/chaos/CMakeLists.txt diff --git a/applications/chaos/README.md b/applications/performance/chaos/README.md similarity index 100% rename from applications/chaos/README.md rename to applications/performance/chaos/README.md diff --git a/applications/chaos/bakers_map.cpp b/applications/performance/chaos/bakers_map.cpp similarity index 100% rename from applications/chaos/bakers_map.cpp rename to applications/performance/chaos/bakers_map.cpp diff --git a/applications/chaos/influence-of-round-off-errors-on-the-reliability-of-numerical-simulations-of-chaotic-dynamic-systems.pdf b/applications/performance/chaos/influence-of-round-off-errors-on-the-reliability-of-numerical-simulations-of-chaotic-dynamic-systems.pdf similarity index 100% rename from applications/chaos/influence-of-round-off-errors-on-the-reliability-of-numerical-simulations-of-chaotic-dynamic-systems.pdf rename to applications/performance/chaos/influence-of-round-off-errors-on-the-reliability-of-numerical-simulations-of-chaotic-dynamic-systems.pdf diff --git a/applications/chaos/relationship-between-precision-and-the-Lyapunov-exponent-arxiv1410.4919.pdf b/applications/performance/chaos/relationship-between-precision-and-the-Lyapunov-exponent-arxiv1410.4919.pdf similarity index 100% rename from applications/chaos/relationship-between-precision-and-the-Lyapunov-exponent-arxiv1410.4919.pdf rename to applications/performance/chaos/relationship-between-precision-and-the-Lyapunov-exponent-arxiv1410.4919.pdf diff --git a/applications/chaos/time_precision_lyapunov.cpp b/applications/performance/chaos/time_precision_lyapunov.cpp similarity index 100% rename from applications/chaos/time_precision_lyapunov.cpp rename to applications/performance/chaos/time_precision_lyapunov.cpp diff --git a/applications/complex/CMakeLists.txt b/applications/performance/complex/CMakeLists.txt similarity index 100% rename from applications/complex/CMakeLists.txt rename to applications/performance/complex/CMakeLists.txt diff --git a/applications/complex/compute.cpp b/applications/performance/complex/compute.cpp similarity index 100% rename from applications/complex/compute.cpp rename to applications/performance/complex/compute.cpp diff --git a/applications/stream/CMakeLists.txt b/applications/performance/stream/CMakeLists.txt similarity index 100% rename from applications/stream/CMakeLists.txt rename to applications/performance/stream/CMakeLists.txt diff --git a/applications/stream/stream.cpp b/applications/performance/stream/stream.cpp similarity index 100% rename from applications/stream/stream.cpp rename to applications/performance/stream/stream.cpp diff --git a/applications/weather/CMakeLists.txt b/applications/performance/weather/CMakeLists.txt similarity index 100% rename from applications/weather/CMakeLists.txt rename to applications/performance/weather/CMakeLists.txt diff --git a/applications/weather/InitialErrorGrowthAndPredictability-LowDimensionalAtmosphericModel.pdf b/applications/performance/weather/InitialErrorGrowthAndPredictability-LowDimensionalAtmosphericModel.pdf similarity index 100% rename from applications/weather/InitialErrorGrowthAndPredictability-LowDimensionalAtmosphericModel.pdf rename to applications/performance/weather/InitialErrorGrowthAndPredictability-LowDimensionalAtmosphericModel.pdf diff --git a/applications/weather/README.md b/applications/performance/weather/README.md similarity index 100% rename from applications/weather/README.md rename to applications/performance/weather/README.md diff --git a/applications/weather/error_growth_atmospheric_model.cpp b/applications/performance/weather/error_growth_atmospheric_model.cpp similarity index 100% rename from applications/weather/error_growth_atmospheric_model.cpp rename to applications/performance/weather/error_growth_atmospheric_model.cpp diff --git a/applications/precision/constants/CMakeLists.txt b/applications/precision/constants/CMakeLists.txt new file mode 100644 index 000000000..4488d68d2 --- /dev/null +++ b/applications/precision/constants/CMakeLists.txt @@ -0,0 +1,3 @@ +file (GLOB SOURCES "./*.cpp") + +compile_all("true" "adaptive" "Applications/Precision/Constants" "${SOURCES}") diff --git a/applications/constants/euler.cpp b/applications/precision/constants/euler.cpp similarity index 91% rename from applications/constants/euler.cpp rename to applications/precision/constants/euler.cpp index 5f654a5f4..4d3202fe6 100644 --- a/applications/constants/euler.cpp +++ b/applications/precision/constants/euler.cpp @@ -1,8 +1,9 @@ // euler.cpp: generating a 'perfect' approximation of Euler's constant e for a given number system // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. +#include // Configure the posit library with arithmetic exceptions // enable posit arithmetic exceptions @@ -12,7 +13,7 @@ // best practice for C++ is to assign a literal // but even this literal gets rounded in an assignment to an IEEE double constexpr -double e = 2.71828182845904523536; +double e = 2.718281828459045235360287471; // e = 2.718281828459045235360287471 value of above literal // ref = 2.71828182845904523536028747135266249775724709369995 @@ -42,23 +43,21 @@ static std::string e1000 = "2.\ 76839642437814059271456354906130310720851038375051\ 01157477041718986106873969655212671546889570350354"; -int main(int argc, char** argv) +int main() try { using namespace sw::universal; - int nrOfFailedTestCases = 0; - std::cout << "Perfect approximations of Euler's constant E for different number systems\n"; std::cout << e1000 << '\n'; - std::cout << "e = " << std::setprecision(25) << e << '\n'; + std::cout << "e = " << std::setprecision(27) << e << '\n'; std::cout << "ref = " << e50 << '\n'; // 1000 digits -> 1.e1000 -> 2^3322 -> 1.051103774764883380737596422798e+1000 -> you will need 3322 bits to represent 1000 digits of phi // // TODO: we need to implement parse(string) on the Universal number systems to calculate error - return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + return EXIT_SUCCESS; } catch (char const* msg) { std::cerr << "Caught ad-hoc exception: " << msg << std::endl; diff --git a/applications/constants/phi.cpp b/applications/precision/constants/phi.cpp similarity index 95% rename from applications/constants/phi.cpp rename to applications/precision/constants/phi.cpp index 145d5723b..c9ee8e165 100644 --- a/applications/constants/phi.cpp +++ b/applications/precision/constants/phi.cpp @@ -1,6 +1,6 @@ // phi.cpp: generating a 'perfect' approximation of the Golden Ratio constant phi for a given number system // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -52,9 +52,7 @@ int main() try { using namespace sw::universal; - int nrOfFailedTestCases = 0; - - std::cout << "Perfect approximations of the Golden Ratio constant PHI for different number systems\n"; + std::cout << "Perfect approximations of the Golden Ratio constant phi for different number systems\n"; std::cout << phi1000 << '\n'; std::cout << "phi = " << std::setprecision(25) << phi_ << '\n'; @@ -83,7 +81,7 @@ try { std::cout << goldenRatio<231>() << '\n'; - return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + return EXIT_SUCCESS; } catch (char const* msg) { std::cerr << "Caught ad-hoc exception: " << msg << std::endl; diff --git a/applications/constants/pi.cpp b/applications/precision/constants/pi.cpp similarity index 92% rename from applications/constants/pi.cpp rename to applications/precision/constants/pi.cpp index 410b9ea09..03f1f5226 100644 --- a/applications/constants/pi.cpp +++ b/applications/precision/constants/pi.cpp @@ -1,9 +1,9 @@ // pi.cpp: generating a 'perfect' approximation of pi for a given number system // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. - +#include // Configure the posit library with arithmetic exceptions // enable posit arithmetic exceptions #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 @@ -104,59 +104,58 @@ static std::string pi1000 = "3.\ template Real MethodOfViete(size_t N) { using namespace sw::universal; - Real pi = Real(1); + Real pi_approx = Real(1); for (size_t i = N; i > 1; --i) { Real repeatingFactor = Real(2); for (size_t j = 1; j < i; ++j) { repeatingFactor = Real(2) + sqrt(repeatingFactor); } repeatingFactor = sqrt(repeatingFactor); - pi = pi * repeatingFactor / Real(2); + pi_approx = pi_approx * repeatingFactor / Real(2); } - pi *= sqrt(Real(2)) / Real(2); - pi = Real(2) / pi; - return pi; + pi_approx *= sqrt(Real(2)) / Real(2); + pi_approx = Real(2) / pi_approx; + return pi_approx; } + template Real MethodOfWallis(size_t N) { using namespace sw::universal; - Real pi = Real(4); + Real pi_approx = Real(4); for (size_t i = 3; i <= (N + 2); i += 2) { - pi = pi * (Real(i - 1) / Real(i)) * (Real(i + 1) / Real(i)); + pi_approx = pi_approx * (Real(i - 1) / Real(i)) * (Real(i + 1) / Real(i)); } - return pi; + return pi_approx; } template Real MethodOfMadhavaOfSangamagrama(size_t N) { using namespace sw::universal; - Real pi = Real(0); + Real pi_approx = Real(0); Real s = Real(1); // sign for the next iteration for (size_t i = 1; i <= (2 * N); i += 2) { - pi = pi + s * (Real(4) / Real(i)); + pi_approx = pi_approx + s * (Real(4) / Real(i)); s = -s; } - return pi; + return pi_approx; } template Real MethodOfNilakantha(size_t N) { using namespace sw::universal; - Real pi = Real(3); + Real pi_approx = Real(3); Real s = Real(1); // sign for the next iteration for (size_t i = 2; i <= (2 * N); i += 2) { - pi = pi + s * (Real(4) / Real(i * (i + 1) * (i + 2)) ); + pi_approx = pi_approx + s * (Real(4) / Real(i * (i + 1) * (i + 2)) ); s = -s; } - return pi; + return pi_approx; } int main() try { using namespace sw::universal; - int nrOfFailedTestCases = 0; - std::cout << "Perfect approximations of PI for different number systems\n"; std::cout << pi1000 << '\n'; @@ -197,7 +196,7 @@ try { // TODO: we need to implement parse(string) on the Universal number systems to calculate error - return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + return EXIT_SUCCESS; } catch (char const* msg) { std::cerr << "Caught ad-hoc exception: " << msg << std::endl; diff --git a/applications/floating-point/CMakeLists.txt b/applications/precision/floating-point/CMakeLists.txt similarity index 100% rename from applications/floating-point/CMakeLists.txt rename to applications/precision/floating-point/CMakeLists.txt diff --git a/applications/floating-point/catastrophic_cancellation.cpp b/applications/precision/floating-point/catastrophic_cancellation.cpp similarity index 91% rename from applications/floating-point/catastrophic_cancellation.cpp rename to applications/precision/floating-point/catastrophic_cancellation.cpp index 1fbd41a3f..c894edf1f 100644 --- a/applications/floating-point/catastrophic_cancellation.cpp +++ b/applications/precision/floating-point/catastrophic_cancellation.cpp @@ -1,8 +1,9 @@ // catastrophic_cancellation.cpp: examples of catastrophic cancellation // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the UNIVERSAL project, which is released under an MIT Open Source license. +#include #include #include // ReportTestResult #include @@ -30,15 +31,10 @@ Scalar GenerateTestCase(Scalar e, Scalar x, Scalar origin) { return result; } -int main(int argc, char** argv) +int main() try { using namespace sw::universal; - // print detailed bit-level computational intermediate results - // bool verbose = false; - - int nrOfFailedTestCases = 0; - // bool bReportIndividualTestCases = true; std::string tag = "Catastrophic Cancellation: "; // preserve the existing ostream precision @@ -48,8 +44,8 @@ try { std::cout << "Catastrophic Cancellation Experiment" << '\n'; std::cout << "IEEE Float single precision :\n" << GenerateTestCase(0.00000006f, 0.5f, 1.0f) << '\n'; - std::cout << "IEEE Float double precision :\n" << GenerateTestCase(0.00000006f, 0.5, 1.0) << '\n'; - if (sizeof(long double) == 16) { + std::cout << "IEEE Float double precision :\n" << GenerateTestCase(0.00000006, 0.5, 1.0) << '\n'; + if constexpr (sizeof(long double) == 16) { std::cout << "IEEE Float quad precision :\n" << GenerateTestCase(0.00000006l, 0.5l, 1.0l) << '\n'; } @@ -116,7 +112,7 @@ try { // restore the previous ostream precision std::cout << std::setprecision(precision); - return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + return EXIT_SUCCESS; } catch (char const* msg) { std::cerr << "Caught ad-hoc exception: " << msg << std::endl; diff --git a/applications/floating-point/contract_expand.cpp b/applications/precision/floating-point/contract_expand.cpp similarity index 100% rename from applications/floating-point/contract_expand.cpp rename to applications/precision/floating-point/contract_expand.cpp diff --git a/applications/floating-point/exponentiation.cpp b/applications/precision/floating-point/exponentiation.cpp similarity index 100% rename from applications/floating-point/exponentiation.cpp rename to applications/precision/floating-point/exponentiation.cpp diff --git a/applications/floating-point/integer_cover.cpp b/applications/precision/floating-point/integer_cover.cpp similarity index 94% rename from applications/floating-point/integer_cover.cpp rename to applications/precision/floating-point/integer_cover.cpp index d6849a4b5..be4e6fbee 100644 --- a/applications/floating-point/integer_cover.cpp +++ b/applications/precision/floating-point/integer_cover.cpp @@ -1,11 +1,11 @@ -// integer_cover.cpp: covering the integers with a posit +// integer_cover.cpp: measuring the covering of the integers with a posit // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the UNIVERSAL project, which is released under an MIT Open Source license. +#include #include #include // ReportTestResult -#include /* When interacting with integer algebras, for example, prime factorization @@ -71,29 +71,20 @@ posit<34,2>: 2^24 integer cover is : float cover = 100% double cover = 100% po // Thus mathematically the 2^(nbits-2) samples need to cover the 2^ibits values of the integer. template std::string CalculateIntegerCover() { - float fInt; - double dInt; sw::universal::posit pInt; - constexpr uint64_t nrSamples = (uint64_t)1 << ibits; - uint64_t fcover = 0, dcover = 0, pcover = 0, rounded; - for (uint64_t integer = 0; integer < nrSamples; ++integer) { + constexpr unsigned long long nrSamples = (uint64_t)1 << ibits; + unsigned long long fcover = 0, dcover = 0, pcover = 0; + for (unsigned long long integer = 0; integer < nrSamples; ++integer) { // float cover - fInt = float(integer); - rounded = uint64_t(fInt); - if (rounded == integer) { - ++fcover; - } + unsigned long long rounded = (unsigned long long)(float(integer)); + if (rounded == integer) ++fcover; // double cover - // float cover - dInt = double(integer); - rounded = uint64_t(dInt); - if (rounded == integer) { - ++dcover; - } + rounded = (unsigned long long)(double(integer)); + if (rounded == integer) ++dcover; // posit cover pInt = integer; - rounded = uint64_t(pInt); + rounded = (unsigned long long)(pInt); if (rounded == integer) { ++pcover; } @@ -109,7 +100,7 @@ std::string CalculateIntegerCover() { // set by the build process to modulate the number of test cases #define _FULL_REGRESSION -int main(int argc, char** argv) +int main() try { using namespace sw::universal; diff --git a/applications/floating-point/kahan_sum.cpp b/applications/precision/floating-point/kahan_sum.cpp similarity index 100% rename from applications/floating-point/kahan_sum.cpp rename to applications/precision/floating-point/kahan_sum.cpp diff --git a/applications/floating-point/linear_cover.cpp b/applications/precision/floating-point/linear_cover.cpp similarity index 100% rename from applications/floating-point/linear_cover.cpp rename to applications/precision/floating-point/linear_cover.cpp diff --git a/applications/floating-point/precision.cpp b/applications/precision/floating-point/precision.cpp similarity index 100% rename from applications/floating-point/precision.cpp rename to applications/precision/floating-point/precision.cpp diff --git a/applications/floating-point/printing.cpp b/applications/precision/floating-point/printing.cpp similarity index 100% rename from applications/floating-point/printing.cpp rename to applications/precision/floating-point/printing.cpp diff --git a/applications/floating-point/rounding_error_addition.cpp b/applications/precision/floating-point/rounding_error_addition.cpp similarity index 100% rename from applications/floating-point/rounding_error_addition.cpp rename to applications/precision/floating-point/rounding_error_addition.cpp diff --git a/applications/floating-point/rounding_error_multiplication.cpp b/applications/precision/floating-point/rounding_error_multiplication.cpp similarity index 100% rename from applications/floating-point/rounding_error_multiplication.cpp rename to applications/precision/floating-point/rounding_error_multiplication.cpp diff --git a/applications/floating-point/sterbenz_lemma.cpp b/applications/precision/floating-point/sterbenz_lemma.cpp similarity index 100% rename from applications/floating-point/sterbenz_lemma.cpp rename to applications/precision/floating-point/sterbenz_lemma.cpp diff --git a/applications/floating-point/sum_of_integers.cpp b/applications/precision/floating-point/sum_of_integers.cpp similarity index 100% rename from applications/floating-point/sum_of_integers.cpp rename to applications/precision/floating-point/sum_of_integers.cpp diff --git a/applications/floating-point/thin_triangle.cpp b/applications/precision/floating-point/thin_triangle.cpp similarity index 100% rename from applications/floating-point/thin_triangle.cpp rename to applications/precision/floating-point/thin_triangle.cpp diff --git a/applications/floating-point/two_sum.cpp b/applications/precision/floating-point/two_sum.cpp similarity index 100% rename from applications/floating-point/two_sum.cpp rename to applications/precision/floating-point/two_sum.cpp diff --git a/applications/floating-point/underflow.cpp b/applications/precision/floating-point/underflow.cpp similarity index 100% rename from applications/floating-point/underflow.cpp rename to applications/precision/floating-point/underflow.cpp diff --git a/applications/math/CMakeLists.txt b/applications/precision/math/CMakeLists.txt similarity index 100% rename from applications/math/CMakeLists.txt rename to applications/precision/math/CMakeLists.txt diff --git a/applications/math/decimal_lpp.cpp b/applications/precision/math/decimal_lpp.cpp similarity index 100% rename from applications/math/decimal_lpp.cpp rename to applications/precision/math/decimal_lpp.cpp diff --git a/applications/math/distinct_powers.cpp b/applications/precision/math/distinct_powers.cpp similarity index 100% rename from applications/math/distinct_powers.cpp rename to applications/precision/math/distinct_powers.cpp diff --git a/applications/math/irrational_powers.cpp b/applications/precision/math/irrational_powers.cpp similarity index 100% rename from applications/math/irrational_powers.cpp rename to applications/precision/math/irrational_powers.cpp diff --git a/applications/math/largest_palindrome_product.cpp b/applications/precision/math/largest_palindrome_product.cpp similarity index 100% rename from applications/math/largest_palindrome_product.cpp rename to applications/precision/math/largest_palindrome_product.cpp diff --git a/applications/math/numbers_irrational.cpp b/applications/precision/math/numbers_irrational.cpp similarity index 100% rename from applications/math/numbers_irrational.cpp rename to applications/precision/math/numbers_irrational.cpp diff --git a/applications/math/numbers_rational.cpp b/applications/precision/math/numbers_rational.cpp similarity index 100% rename from applications/math/numbers_rational.cpp rename to applications/precision/math/numbers_rational.cpp diff --git a/applications/math/pascals_triangle.cpp b/applications/precision/math/pascals_triangle.cpp similarity index 100% rename from applications/math/pascals_triangle.cpp rename to applications/precision/math/pascals_triangle.cpp diff --git a/applications/math/primes.cpp b/applications/precision/math/primes.cpp similarity index 100% rename from applications/math/primes.cpp rename to applications/precision/math/primes.cpp diff --git a/applications/math/sincospi.cpp b/applications/precision/math/sincospi.cpp similarity index 100% rename from applications/math/sincospi.cpp rename to applications/precision/math/sincospi.cpp diff --git a/applications/math/stirlings_approximation.cpp b/applications/precision/math/stirlings_approximation.cpp similarity index 100% rename from applications/math/stirlings_approximation.cpp rename to applications/precision/math/stirlings_approximation.cpp diff --git a/applications/numeric/CMakeLists.txt b/applications/precision/numeric/CMakeLists.txt similarity index 100% rename from applications/numeric/CMakeLists.txt rename to applications/precision/numeric/CMakeLists.txt diff --git a/applications/numeric/README.md b/applications/precision/numeric/README.md similarity index 100% rename from applications/numeric/README.md rename to applications/precision/numeric/README.md diff --git a/applications/numeric/configs.hpp b/applications/precision/numeric/configs.hpp similarity index 100% rename from applications/numeric/configs.hpp rename to applications/precision/numeric/configs.hpp diff --git a/applications/numeric/constants.cpp b/applications/precision/numeric/constants.cpp similarity index 100% rename from applications/numeric/constants.cpp rename to applications/precision/numeric/constants.cpp diff --git a/applications/numeric/doubledouble.cpp b/applications/precision/numeric/doubledouble.cpp similarity index 100% rename from applications/numeric/doubledouble.cpp rename to applications/precision/numeric/doubledouble.cpp diff --git a/applications/numeric/luir.cpp b/applications/precision/numeric/luir.cpp similarity index 100% rename from applications/numeric/luir.cpp rename to applications/precision/numeric/luir.cpp diff --git a/applications/numeric/midpoint.cpp b/applications/precision/numeric/midpoint.cpp similarity index 100% rename from applications/numeric/midpoint.cpp rename to applications/precision/numeric/midpoint.cpp diff --git a/applications/numeric/numbers.cpp b/applications/precision/numeric/numbers.cpp similarity index 100% rename from applications/numeric/numbers.cpp rename to applications/precision/numeric/numbers.cpp diff --git a/applications/numeric/posit_list.cpp b/applications/precision/numeric/posit_list.cpp similarity index 100% rename from applications/numeric/posit_list.cpp rename to applications/precision/numeric/posit_list.cpp diff --git a/applications/numeric/posit_properties.cpp b/applications/precision/numeric/posit_properties.cpp similarity index 100% rename from applications/numeric/posit_properties.cpp rename to applications/precision/numeric/posit_properties.cpp diff --git a/applications/numeric/priest.cpp b/applications/precision/numeric/priest.cpp similarity index 100% rename from applications/numeric/priest.cpp rename to applications/precision/numeric/priest.cpp diff --git a/applications/numeric/quadratic.cpp b/applications/precision/numeric/quadratic.cpp similarity index 100% rename from applications/numeric/quadratic.cpp rename to applications/precision/numeric/quadratic.cpp diff --git a/applications/numeric/residual.cpp b/applications/precision/numeric/residual.cpp similarity index 100% rename from applications/numeric/residual.cpp rename to applications/precision/numeric/residual.cpp diff --git a/applications/numeric/rump_equation.cpp b/applications/precision/numeric/rump_equation.cpp similarity index 100% rename from applications/numeric/rump_equation.cpp rename to applications/precision/numeric/rump_equation.cpp diff --git a/applications/numeric/solvetest.cpp b/applications/precision/numeric/solvetest.cpp similarity index 100% rename from applications/numeric/solvetest.cpp rename to applications/precision/numeric/solvetest.cpp diff --git a/applications/numeric/traits.cpp b/applications/precision/numeric/traits.cpp similarity index 100% rename from applications/numeric/traits.cpp rename to applications/precision/numeric/traits.cpp diff --git a/applications/numeric/ulp_math.cpp b/applications/precision/numeric/ulp_math.cpp similarity index 100% rename from applications/numeric/ulp_math.cpp rename to applications/precision/numeric/ulp_math.cpp diff --git a/applications/blas/CMakeLists.txt b/applications/reproducibility/blas/CMakeLists.txt similarity index 100% rename from applications/blas/CMakeLists.txt rename to applications/reproducibility/blas/CMakeLists.txt diff --git a/applications/blas/README.md b/applications/reproducibility/blas/README.md similarity index 100% rename from applications/blas/README.md rename to applications/reproducibility/blas/README.md diff --git a/applications/blas/common.hpp b/applications/reproducibility/blas/common.hpp similarity index 100% rename from applications/blas/common.hpp rename to applications/reproducibility/blas/common.hpp diff --git a/applications/blas/hilbert.cpp b/applications/reproducibility/blas/hilbert.cpp similarity index 100% rename from applications/blas/hilbert.cpp rename to applications/reproducibility/blas/hilbert.cpp diff --git a/applications/blas/inverse.cpp b/applications/reproducibility/blas/inverse.cpp similarity index 88% rename from applications/blas/inverse.cpp rename to applications/reproducibility/blas/inverse.cpp index 267876227..2494fb7d5 100644 --- a/applications/blas/inverse.cpp +++ b/applications/reproducibility/blas/inverse.cpp @@ -1,17 +1,12 @@ // inverse.cpp: example program comparing float vs posit using Gauss-Jordan algorithm // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the HPRBLAS project, which is released under an MIT Open Source license. -#ifdef _MSC_VER -#pragma warning(disable : 4514) // unreferenced inline function has been removed -#pragma warning(disable : 4710) // 'int sprintf_s(char *const ,const size_t,const char *const ,...)': function not inlined -#pragma warning(disable : 4820) // 'sw::universal::value<23>': '3' bytes padding added after data member 'sw::universal::value<23>::_sign' -#pragma warning(disable : 5045) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified -#endif +#include #include -// + // enable posit arithmetic exceptions #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 // enable fast posits @@ -111,7 +106,7 @@ void FiniteDifferenceTest(size_t N) { } template -void TestSingularMatrix() { +int TestSingularMatrix() { using Matrix = sw::universal::blas::matrix; std::cout << "Test Singular matrix\n"; @@ -124,8 +119,14 @@ void TestSingularMatrix() { }; std::cout << A << '\n'; Matrix B = inv(A); - // should report an error + // should report an error and return a null matrix + int nrOfFailedTests{ 0 }; + if (B.cols() != 0 && B.rows() != 0) ++nrOfFailedTests; + std::cout << "inv(A) will return a null matrix when singular\n"; + std::cout << "B.rows() : " << B.rows() << "\nB.cols() : " << B.cols() << '\n'; std::cout << "--------------------------------\n\n"; + + return nrOfFailedTests; } template @@ -163,7 +164,7 @@ void TestNearSingular() { std::cout << "--------------------------------\n\n"; } -int main(int argc, char** argv) +int main() try { using namespace sw::universal; using namespace sw::universal::blas; @@ -171,10 +172,9 @@ try { using Scalar = float; using Matrix = sw::universal::blas::matrix; - if (argc == 1) std::cout << argv[0] << '\n'; int nrOfFailedTestCases = 0; - TestSingularMatrix(); + nrOfFailedTestCases += TestSingularMatrix(); TestNearSingular(); TestNearSingular >(); diff --git a/applications/blas/l1_fused_dot.cpp b/applications/reproducibility/blas/l1_fused_dot.cpp similarity index 100% rename from applications/blas/l1_fused_dot.cpp rename to applications/reproducibility/blas/l1_fused_dot.cpp diff --git a/applications/blas/l2_fused_mv.cpp b/applications/reproducibility/blas/l2_fused_mv.cpp similarity index 100% rename from applications/blas/l2_fused_mv.cpp rename to applications/reproducibility/blas/l2_fused_mv.cpp diff --git a/applications/blas/l3_fused_mm.cpp b/applications/reproducibility/blas/l3_fused_mm.cpp similarity index 100% rename from applications/blas/l3_fused_mm.cpp rename to applications/reproducibility/blas/l3_fused_mm.cpp diff --git a/applications/blas/lu.cpp b/applications/reproducibility/blas/lu.cpp similarity index 100% rename from applications/blas/lu.cpp rename to applications/reproducibility/blas/lu.cpp diff --git a/applications/blas/norms.cpp b/applications/reproducibility/blas/norms.cpp similarity index 100% rename from applications/blas/norms.cpp rename to applications/reproducibility/blas/norms.cpp diff --git a/applications/blas/randsvd.cpp b/applications/reproducibility/blas/randsvd.cpp similarity index 100% rename from applications/blas/randsvd.cpp rename to applications/reproducibility/blas/randsvd.cpp diff --git a/applications/cryptography/CMakeLists.txt b/applications/reproducibility/cryptography/CMakeLists.txt similarity index 100% rename from applications/cryptography/CMakeLists.txt rename to applications/reproducibility/cryptography/CMakeLists.txt diff --git a/applications/cryptography/discrete-log-problem.pdf b/applications/reproducibility/cryptography/discrete-log-problem.pdf similarity index 100% rename from applications/cryptography/discrete-log-problem.pdf rename to applications/reproducibility/cryptography/discrete-log-problem.pdf diff --git a/applications/cryptography/fermat.cpp b/applications/reproducibility/cryptography/fermat.cpp similarity index 100% rename from applications/cryptography/fermat.cpp rename to applications/reproducibility/cryptography/fermat.cpp diff --git a/applications/reproducibility/cryptography/large_lcm.cpp b/applications/reproducibility/cryptography/large_lcm.cpp new file mode 100644 index 000000000..ff4a354ae --- /dev/null +++ b/applications/reproducibility/cryptography/large_lcm.cpp @@ -0,0 +1,97 @@ +// large_lcm.cpp: calculating a least common multiple of a very large set +// +// Copyright (C) 2017 Stillwater Supercomputing, Inc. +// +// This file is part of the universal numbers project, which is released under an MIT Open Source license. +#include +#include +#include +#include +#include +#include +#include +// include the number system we want to use, and configure overflow exceptions so we can capture failures +#define INTEGER_THROW_ARITHMETIC_EXCEPTION 1 +#include + +template +void MeasureLCM(const std::vector>& v) { + std::chrono::steady_clock::time_point begin, end; + begin = std::chrono::steady_clock::now(); + using Integer = sw::universal::integer; + Integer least_common_multple = lcm(v); + end = std::chrono::steady_clock::now(); + using TimeReal = float; + std::chrono::duration time_span = std::chrono::duration_cast> (end - begin); + TimeReal elapsed = time_span.count(); + + std::cout << "In " << elapsed << " seconds calculated LCM of " << v.size() << " elements of type " << typeid(Integer).name() + << " to be\n" << least_common_multple << '\n'; +} + +// calculate the Least Common Multiple of a set of N random values +template +void calculateLCM(unsigned N, const char* dumpFile = "default_dump_file.txt") // this triggers the integer_overflow exception +{ + using Integer = sw::universal::integer; + Integer factor; + + std::random_device rd{}; + std::mt19937 engine{ rd() }; + std::uniform_real_distribution dist{0.0, 10000.0 }; + + std::vector v; + for (unsigned i = 0; i < N; ++i) { + factor = dist(engine); + if (factor.iseven()) ++factor; + v.push_back(factor); + } + try { + MeasureLCM(v); + } + catch (const sw::universal::integer_overflow& e) { + std::cerr << e.what() << '\n'; + std::cerr << typeid(Integer).name() << " has insufficient dynamic range to capture the least common multiple\n"; + std::ofstream out; + out.open(dumpFile); + for (size_t i = 0; i < v.size(); ++i) { + out << v[i] << '\n'; + } + out.close(); + } +} +#define STRESS_TESTING 0 + +int main() +try { + using namespace sw::universal; + + calculateLCM<512>(10, "lcm_dataset_1.txt"); + calculateLCM<1024>(100, "lcm_dataset_2.txt"); + +#if STRESS_TESTING + calculateLCM<2048>(1000, "lcm_dataset_3.txt"); +#endif + + return EXIT_SUCCESS; +} +catch (char const* msg) { + std::cerr << "Caught ad-hoc exception: " << msg << std::endl; + return EXIT_FAILURE; +} +catch (const sw::universal::universal_arithmetic_exception& err) { + std::cerr << "Caught unexpected universal arithmetic exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (const sw::universal::universal_internal_exception& err) { + std::cerr << "Caught unexpected universal internal exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (std::runtime_error& err) { + std::cerr << "Caught unexpected runtime error: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} diff --git a/applications/cryptography/pollard_rho.cpp b/applications/reproducibility/cryptography/pollard_rho.cpp similarity index 100% rename from applications/cryptography/pollard_rho.cpp rename to applications/reproducibility/cryptography/pollard_rho.cpp diff --git a/applications/cryptography/quadratic_sieve.cpp b/applications/reproducibility/cryptography/quadratic_sieve.cpp similarity index 100% rename from applications/cryptography/quadratic_sieve.cpp rename to applications/reproducibility/cryptography/quadratic_sieve.cpp diff --git a/applications/sequences/CMakeLists.txt b/applications/reproducibility/sequences/CMakeLists.txt similarity index 100% rename from applications/sequences/CMakeLists.txt rename to applications/reproducibility/sequences/CMakeLists.txt diff --git a/applications/sequences/fibonacci.cpp b/applications/reproducibility/sequences/fibonacci.cpp similarity index 100% rename from applications/sequences/fibonacci.cpp rename to applications/reproducibility/sequences/fibonacci.cpp diff --git a/applications/sequences/tribonacci.cpp b/applications/reproducibility/sequences/tribonacci.cpp similarity index 100% rename from applications/sequences/tribonacci.cpp rename to applications/reproducibility/sequences/tribonacci.cpp diff --git a/applications/science/CMakeLists.txt b/applications/science/CMakeLists.txt deleted file mode 100644 index 5e8e07f56..000000000 --- a/applications/science/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -file (GLOB SOURCES "./*.cpp") - -compile_all("true" "science" "Applications/Accuracy/Computational Science" "${SOURCES}") diff --git a/docker/build_release_container.sh b/docker/build_release_container.sh index c6aca9f7e..f246ca285 100755 --- a/docker/build_release_container.sh +++ b/docker/build_release_container.sh @@ -5,7 +5,7 @@ # example would be to strace an executable to find its dependencies MAJOR=v3 -MINOR=74 +MINOR=75 VERSION="$MAJOR.$MINOR" if [[ $# == 0 ]]; then diff --git a/docker/build_test_container.sh b/docker/build_test_container.sh index d591d894e..c84fbe3b6 100755 --- a/docker/build_test_container.sh +++ b/docker/build_test_container.sh @@ -3,7 +3,7 @@ # script to create a test container with a specific compiler and build target # Usage: ./build_test_container.sh COMPILER TARGET # Examples: -# ./build_test_compiler.sh gcc10 will create a gcc10 dev environment with BUILD_ALL=ON +# ./build_test_container.sh gcc10 will create a gcc10 dev environment with BUILD_ALL=ON # ./build_test_container.sh clang13 BUILD_NUMBER_LNS will create a clang13 dev environment with BUILD_NUMBER_LNS=ON # To turn off security features use: @@ -11,7 +11,7 @@ # example would be to strace an executable to find its dependencies MAJOR=v3 -MINOR=74 +MINOR=75 VERSION="$MAJOR.$MINOR" if [[ $# == 0 ]]; then diff --git a/docs/regressions/stress-level-01-15-2024.txt b/docs/regressions/stress-level-01-15-2024.txt new file mode 100644 index 000000000..db2e6d49f --- /dev/null +++ b/docs/regressions/stress-level-01-15-2024.txt @@ -0,0 +1,2443 @@ +Test project /home/theo/stillwater/universal/build_gcc + Start 1: multifile + Start 2: bitblock_arithmetic + Start 3: bitblock_logic + Start 4: bitblock_multi_word + Start 5: gfp_api + Start 6: f2s_api + Start 7: value_api + Start 8: value_arithmetic_add + Start 9: value_performance + Start 10: bd_api + Start 11: bd_constexpr + Start 12: bb_api + Start 13: bb_constexpr + Start 14: bb_conversion + Start 15: bb_rounding + Start 16: bb_logic + Start 17: bb_shift_left + Start 18: bb_shift_right + Start 19: bb_addition + Start 20: bb_division + Start 21: bb_multiplication + Start 22: bb_remainder + Start 23: bb_subtraction + Start 24: bb_urmul + Start 25: bb_performance + Start 26: bf_api + Start 27: bf_conversion + Start 28: bf_multiplication + Start 29: bf_performance + Start 30: bs_api + Start 31: bs_constexpr + Start 32: bs_conversion + Start 33: bs_addition + Start 34: bs_division + Start 35: bs_multiplication + Start 36: bs_rounding + Start 37: bs_subtraction + Start 38: bs_performance + Start 39: bt_api + Start 40: bt_constexpr + Start 41: bt_logic + Start 42: bt_conversion + Start 43: bt_decimal + Start 44: bt_rounding + Start 45: bt_tables + Start 46: bt_addition + Start 47: bt_algo + Start 48: bt_division + Start 49: bt_multiplication + Start 50: bt_single_precision + Start 51: bt_performance + Start 52: native_float_bit_manipulation + Start 53: native_float_fractionviz + Start 54: native_float_ieee754 + Start 55: native_float_manipulators + Start 56: native_float_mathlib + Start 57: native_float_representable + Start 58: native_int_bit_manipulation + Start 59: eint_api + Start 60: eint_exceptions + Start 61: eint_comparison + Start 62: eint_assignment + Start 63: eint_addition + Start 64: eint_division + Start 65: eint_multiplication + Start 66: eint_subtraction + Start 67: eint_factorial + Start 68: eint_performance + Start 69: edec_api + Start 70: edec_exceptions + Start 71: edec_assignment + Start 72: edec_comparison + Start 73: edec_addition + Start 74: edec_division + Start 75: edec_multiplication + Start 76: edec_subtraction + Start 77: edec_factorial + Start 78: edec_performance + Start 79: ebinratio_api + Start 80: erat_api + Start 81: erat_exceptions + Start 82: erat_logic + Start 83: erat_addition + Start 84: erat_division + Start 85: erat_multiplication + Start 86: erat_subtraction + Start 87: erat_sqrt + Start 88: efloat_add + Start 89: eposit_add + Start 90: bint_api + Start 91: bint_exceptions + Start 92: bint_misc + Start 93: bint_conversion + Start 94: bint_bit_manipulation + Start 95: bint_logic + Start 96: bint_shift_left + Start 97: bint_shift_right + Start 98: bint_addition + Start 99: bint_division + Start 100: bint_multiplication + Start 101: bint_remainder + Start 102: bint_subtraction + Start 103: bint_gcd_lcm + Start 104: bint_sqrt + Start 105: bint_perf + Start 106: decimal_api + Start 107: fixpnt_api + Start 108: fixpnt_assignment + Start 109: fixpnt_attributes + Start 110: fixpnt_complex_api + Start 111: fixpnt_constexpr + Start 112: fixpnt_exceptions + Start 113: fixpnt_mod_conversion + Start 114: fixpnt_mod_subnormal_conversion + Start 115: fixpnt_sat_conversion + Start 116: fixpnt_sat_subnormal_conversion + Start 117: fixpnt_logic + Start 118: fixpnt_mod_addition + Start 119: fixpnt_mod_division + Start 120: fixpnt_mod_multiplication + Start 121: fixpnt_mod_subtraction + Start 122: fixpnt_sat_addition + Start 123: fixpnt_sat_division + Start 124: fixpnt_sat_multiplication + Start 125: fixpnt_sat_subtraction + Start 126: fixpnt_mod_complex_add + Start 127: fixpnt_mod_complex_mul + Start 128: fixpnt_mod_complex_sub + Start 129: fixpnt_classify + Start 130: fixpnt_complex + Start 131: fixpnt_exponent + Start 132: fixpnt_hyperbolic + Start 133: fixpnt_logarithm + Start 134: fixpnt_pow + Start 135: fixpnt_trigonometry + Start 136: fixpnt_truncate + Start 137: deci_api + Start 138: lns_api + Start 139: lns_attributes + Start 140: lns_exceptions + Start 141: lns_ulp + Start 142: lns_assignment + Start 143: lns_conversion + Start 144: lns_addition + Start 145: lns_behavior + Start 146: lns_division + Start 147: lns_multiplication + Start 148: lns_subtraction + Start 149: lns_logic + Start 150: lns_classify + Start 151: lns_exponent + Start 152: lns_fractional + Start 153: lns_hyperbolic + Start 154: lns_hypotenuse + Start 155: lns_logarithm + Start 156: lns_next + Start 157: lns_pow + Start 158: lns_trigonometry + Start 159: lns_truncate + Start 160: lns_performance + Start 161: dbns_api + Start 162: dbns_attributes + Start 163: dbns_lns_comparison + Start 164: dbns_table + Start 165: dbns_assignment + Start 166: dbns_conversion + Start 167: dbns_rounding + Start 168: dbns_addition + Start 169: dbns_behavior + Start 170: dbns_division + Start 171: dbns_multiplication + Start 172: dbns_subtraction + Start 173: sorn_api + Start 174: sorn_addition + Start 175: sorn_division + Start 176: sorn_multiplication + Start 177: sorn_subtraction + Start 178: unum1_api + Start 179: unum1_construct + Start 180: unum2_api + Start 181: unum2_construct + Start 182: posit_api + Start 183: posit_casting + Start 184: posit_constexpr_test + Start 185: posit_decode + Start 186: posit_number_traits + Start 187: posit_postfix + Start 188: posit_prefix + Start 189: posit_quire_accumulation + Start 190: posit_reciprocal_tables + Start 191: posit_serialization + Start 192: posit_ulp + Start 193: posit_assignment + Start 194: posit_conversion + Start 195: posit_logic + Start 196: posit_addition + Start 197: posit_complex_add + Start 198: posit_decrement + Start 199: posit_division + Start 200: posit_fma + Start 201: posit_increment + Start 202: posit_literals + Start 203: posit_multiplication + Start 204: posit_negation + Start 205: posit_reciprocation + Start 206: posit_sqrt + Start 207: posit_subtraction + Start 208: posit_classify + Start 209: posit_complex + Start 210: posit_exponent + Start 211: posit_hyperbolic + Start 212: posit_hypotenuse + Start 213: posit_logarithm + Start 214: posit_next + Start 215: posit_pow + Start 216: posit_trigonometry + Start 217: posit_truncate + Start 218: fast_posit_128_2 + Start 219: fast_posit_128_4 + Start 220: fast_posit_16_1 + Start 221: fast_posit_16_2 + Start 222: fast_posit_256_2 + Start 223: fast_posit_256_5 + Start 224: fast_posit_2_0 + Start 225: fast_posit_32_2 + Start 226: fast_posit_3_0 + Start 227: fast_posit_48_2 + Start 228: fast_posit_4_0 + Start 229: fast_posit_64_2 + Start 230: fast_posit_64_3 + Start 231: fast_posit_8_0 + Start 232: fast_posit_8_1 + Start 233: fast_posit_8_2 + Start 234: fast_quire_32_2 + Start 235: posit2_api + Start 236: posit2_attributes + Start 237: posit2_manipulators + Start 238: posit2_traits + Start 239: posit2_ulp + Start 240: posit2_addition + Start 241: posito_api + Start 242: posito_addition + Start 243: posito_division + Start 244: posito_multiplication + Start 245: posito_number_system + Start 246: posito_subtraction + Start 247: posito_assignment + Start 248: valid_api + Start 249: valid_exceptions + Start 250: valid_conversion + Start 251: valid_logic + Start 252: valid_addition + Start 253: valid_exponent + Start 254: areal_api + Start 255: areal_assignment + Start 256: areal_constexpr + 1/615 Test #1: multifile ................................ Passed 0.31 sec + Start 257: areal_exceptions + 2/615 Test #2: bitblock_arithmetic ...................... Passed 0.31 sec + Start 258: areal_special_cases + 3/615 Test #3: bitblock_logic ........................... Passed 0.31 sec + Start 259: areal_logic + 4/615 Test #4: bitblock_multi_word ...................... Passed 0.32 sec + Start 260: areal_double_conversion + 5/615 Test #5: gfp_api .................................. Passed 0.32 sec + Start 261: areal_float_conversion + 6/615 Test #6: f2s_api .................................. Passed 0.32 sec + Start 262: areal_sampling + 7/615 Test #7: value_api ................................ Passed 0.32 sec + Start 263: areal_addition + 8/615 Test #10: bd_api ................................... Passed 0.32 sec + Start 264: areal_double_precision + 9/615 Test #11: bd_constexpr ............................. Passed 0.32 sec + Start 265: areal_half_precision + 10/615 Test #12: bb_api ................................... Passed 0.32 sec + Start 266: areal_quad_precision + 11/615 Test #13: bb_constexpr ............................. Passed 0.32 sec + Start 267: areal_quarter_precision + 12/615 Test #14: bb_conversion ............................ Passed 0.33 sec + Start 268: areal_single_precision + 13/615 Test #15: bb_rounding .............................. Passed 0.33 sec + Start 269: bfloat16_api + 14/615 Test #16: bb_logic ................................. Passed 0.33 sec + Start 270: bfloat16_attributes + 15/615 Test #17: bb_shift_left ............................ Passed 0.33 sec + Start 271: bfloat16_traits + 16/615 Test #18: bb_shift_right ........................... Passed 0.33 sec + Start 272: bfloat16_addition + 17/615 Test #20: bb_division .............................. Passed 0.33 sec + Start 273: bfloat16_arithmetic + 18/615 Test #22: bb_remainder ............................. Passed 0.33 sec + Start 274: bfloat16_pow + 19/615 Test #23: bb_subtraction ........................... Passed 0.33 sec + Start 275: cfloat_api + 20/615 Test #24: bb_urmul ................................. Passed 0.34 sec + Start 276: cfloat_attributes + 21/615 Test #26: bf_api ................................... Passed 0.34 sec + Start 277: cfloat_constexpr + 22/615 Test #27: bf_conversion ............................ Passed 0.34 sec + Start 278: cfloat_dynamic_range + 23/615 Test #29: bf_performance ........................... Passed 0.34 sec + Start 279: cfloat_exceptions + 24/615 Test #30: bs_api ................................... Passed 0.34 sec + Start 280: cfloat_special_cases + 25/615 Test #31: bs_constexpr ............................. Passed 0.34 sec + Start 281: cfloat_subnormals + 26/615 Test #32: bs_conversion ............................ Passed 0.34 sec + Start 282: cfloat_traits + 27/615 Test #33: bs_addition .............................. Passed 0.35 sec + Start 283: cfloat_types + 28/615 Test #34: bs_division .............................. Passed 0.35 sec + Start 284: cfloat_ulp + 29/615 Test #36: bs_rounding .............................. Passed 0.35 sec + Start 285: cfloat_assignment + 30/615 Test #37: bs_subtraction ........................... Passed 0.35 sec + Start 286: cfloat_double_conversion + 31/615 Test #38: bs_performance ........................... Passed 0.35 sec + Start 287: cfloat_float_conversion + 32/615 Test #39: bt_api ................................... Passed 0.35 sec + Start 288: cfloat_ieee754_subnormals + 33/615 Test #40: bt_constexpr ............................. Passed 0.35 sec + Start 289: cfloat_normalization + 34/615 Test #41: bt_logic ................................. Passed 0.36 sec + Start 290: cfloat_decrement + 35/615 Test #42: bt_conversion ............................ Passed 0.36 sec + Start 291: cfloat_increment + 36/615 Test #43: bt_decimal ............................... Passed 0.36 sec + Start 292: cfloat_random_arithmetic + 37/615 Test #44: bt_rounding .............................. Passed 0.36 sec + Start 293: cfloat_sqrt_algorithm_reference + 38/615 Test #45: bt_tables ................................ Passed 0.36 sec + Start 294: cfloat_logic + 39/615 Test #46: bt_addition .............................. Passed 0.36 sec + Start 295: cfloat_amd_fp24 + 40/615 Test #47: bt_algo .................................. Passed 0.36 sec + Start 296: cfloat_bfloat16 + 41/615 Test #48: bt_division .............................. Passed 0.37 sec + Start 297: cfloat_pixar_pxr24 + 42/615 Test #49: bt_multiplication ........................ Passed 0.37 sec + Start 298: cfloat_tensorfloat + 43/615 Test #50: bt_single_precision ...................... Passed 0.37 sec + Start 299: cfloat_classify + 44/615 Test #52: native_float_bit_manipulation ............ Passed 0.37 sec + Start 300: cfloat_exponent + 45/615 Test #53: native_float_fractionviz ................. Passed 0.37 sec + Start 301: cfloat_fractional + 46/615 Test #54: native_float_ieee754 ..................... Passed 0.37 sec + Start 302: cfloat_hyperbolic + 47/615 Test #55: native_float_manipulators ................ Passed 0.37 sec + Start 303: cfloat_hypotenuse + 48/615 Test #56: native_float_mathlib ..................... Passed 0.37 sec + Start 304: cfloat_logarithm + 49/615 Test #57: native_float_representable ............... Passed 0.37 sec + Start 305: cfloat_next + 50/615 Test #58: native_int_bit_manipulation .............. Passed 0.37 sec + Start 306: cfloat_pow + 51/615 Test #59: eint_api ................................. Passed 0.37 sec + Start 307: cfloat_trigonometry + 52/615 Test #60: eint_exceptions .......................... Passed 0.37 sec + Start 308: cfloat_truncate + 53/615 Test #61: eint_comparison .......................... Passed 0.38 sec + Start 309: cfloat_perf + 54/615 Test #62: eint_assignment .......................... Passed 0.38 sec + Start 310: cfloat_fff_from_blocktriple + 55/615 Test #63: eint_addition ............................ Passed 0.38 sec + Start 311: cfloat_fff_to_blocktriple + 56/615 Test #65: eint_multiplication ...................... Passed 0.38 sec + Start 312: cfloat_tff_from_blocktriple + 57/615 Test #67: eint_factorial ........................... Passed 0.38 sec + Start 313: cfloat_tff_to_blocktriple + 58/615 Test #68: eint_performance ......................... Passed 0.38 sec + Start 314: cfloat_ftf_to_blocktriple + 59/615 Test #69: edec_api ................................. Passed 0.38 sec + Start 315: cfloat_ttf_from_blocktriple + 60/615 Test #70: edec_exceptions .......................... Passed 0.38 sec + Start 316: cfloat_ttf_to_blocktriple + 61/615 Test #71: edec_assignment .......................... Passed 0.38 sec + Start 317: cfloat_fff_addition + 62/615 Test #72: edec_comparison .......................... Passed 0.38 sec + Start 318: cfloat_fff_division + 63/615 Test #77: edec_factorial ........................... Passed 0.38 sec + Start 319: cfloat_fff_fma + 64/615 Test #78: edec_performance ......................... Passed 0.38 sec + Start 320: cfloat_fff_multiplication + 65/615 Test #79: ebinratio_api ............................ Passed 0.38 sec + Start 321: cfloat_fff_sqrt + 66/615 Test #80: erat_api ................................. Passed 0.38 sec + Start 322: cfloat_fff_subtraction + 67/615 Test #81: erat_exceptions .......................... Passed 0.38 sec + Start 323: cfloat_tff_addition + 68/615 Test #82: erat_logic ............................... Passed 0.38 sec + Start 324: cfloat_tff_division + 69/615 Test #83: erat_addition ............................ Passed 0.39 sec + Start 325: cfloat_tff_multiplication + 70/615 Test #84: erat_division ............................ Passed 0.39 sec + Start 326: cfloat_tff_sqrt + 71/615 Test #85: erat_multiplication ...................... Passed 0.39 sec + Start 327: cfloat_tff_subtraction + 72/615 Test #86: erat_subtraction ......................... Passed 0.39 sec + Start 328: cfloat_ftf_addition + 73/615 Test #87: erat_sqrt ................................ Passed 0.39 sec + Start 329: cfloat_ftf_division + 74/615 Test #88: efloat_add ............................... Passed 0.39 sec + Start 330: cfloat_ftf_multiplication + 75/615 Test #89: eposit_add ............................... Passed 0.39 sec + Start 331: cfloat_ftf_sqrt + 76/615 Test #90: bint_api ................................. Passed 0.39 sec + Start 332: cfloat_ftf_subtraction + 77/615 Test #91: bint_exceptions .......................... Passed 0.39 sec + Start 333: cfloat_ttf_addition + 78/615 Test #92: bint_misc ................................ Passed 0.40 sec + Start 334: cfloat_ttf_division + 79/615 Test #93: bint_conversion .......................... Passed 0.40 sec + Start 335: cfloat_ttf_multiplication + 80/615 Test #94: bint_bit_manipulation .................... Passed 0.40 sec + Start 336: cfloat_ttf_sqrt + 81/615 Test #97: bint_shift_right ......................... Passed 0.40 sec + Start 337: cfloat_ttf_subtraction + 82/615 Test #103: bint_gcd_lcm ............................. Passed 0.39 sec + Start 338: cfloat_fft_from_blocktriple + 83/615 Test #106: decimal_api .............................. Passed 0.39 sec + Start 339: cfloat_fft_to_blocktriple + 84/615 Test #107: fixpnt_api ............................... Passed 0.39 sec + Start 340: cfloat_tft_from_blocktriple + 85/615 Test #108: fixpnt_assignment ........................ Passed 0.39 sec + Start 341: cfloat_tft_to_blocktriple + 86/615 Test #109: fixpnt_attributes ........................ Passed 0.39 sec + Start 342: cfloat_ftt_to_blocktriple + 87/615 Test #110: fixpnt_complex_api ....................... Passed 0.39 sec + Start 343: cfloat_ttt_from_blocktriple + 88/615 Test #111: fixpnt_constexpr ......................... Passed 0.40 sec + Start 344: cfloat_ttt_to_blocktriple + 89/615 Test #112: fixpnt_exceptions ........................ Passed 0.40 sec + Start 345: cfloat_fft_addition + 90/615 Test #114: fixpnt_mod_subnormal_conversion .......... Passed 0.40 sec + Start 346: cfloat_fft_division + 91/615 Test #116: fixpnt_sat_subnormal_conversion .......... Passed 0.40 sec + Start 347: cfloat_fft_multiplication + 92/615 Test #123: fixpnt_sat_division ...................... Passed 0.39 sec + Start 348: cfloat_fft_subtraction + 93/615 Test #129: fixpnt_classify .......................... Passed 0.39 sec + Start 349: cfloat_tft_addition + 94/615 Test #130: fixpnt_complex ........................... Passed 0.39 sec + Start 350: cfloat_tft_division + 95/615 Test #132: fixpnt_hyperbolic ........................ Passed 0.39 sec + Start 351: cfloat_tft_multiplication + 96/615 Test #134: fixpnt_pow ............................... Passed 0.39 sec + Start 352: cfloat_tft_subtraction + 97/615 Test #135: fixpnt_trigonometry ...................... Passed 0.39 sec + Start 353: cfloat_ftt_addition + 98/615 Test #137: deci_api ................................. Passed 0.39 sec + Start 354: cfloat_ftt_division + 99/615 Test #138: lns_api .................................. Passed 0.39 sec + Start 355: cfloat_ftt_multiplication +100/615 Test #139: lns_attributes ........................... Passed 0.39 sec + Start 356: cfloat_ftt_subtraction +101/615 Test #140: lns_exceptions ........................... Passed 0.39 sec + Start 357: cfloat_ttt_addition +102/615 Test #141: lns_ulp .................................. Passed 0.39 sec + Start 358: cfloat_ttt_division +103/615 Test #142: lns_assignment ........................... Passed 0.39 sec + Start 359: cfloat_ttt_multiplication +104/615 Test #145: lns_behavior ............................. Passed 0.39 sec + Start 360: cfloat_ttt_subtraction +105/615 Test #149: lns_logic ................................ Passed 0.39 sec + Start 361: dfloat_api +106/615 Test #150: lns_classify ............................. Passed 0.39 sec + Start 362: conversions_rounding +107/615 Test #152: lns_fractional ........................... Passed 0.39 sec + Start 363: conversions_to_decimal +108/615 Test #153: lns_hyperbolic ........................... Passed 0.39 sec + Start 364: conversions_to_integer +109/615 Test #155: lns_logarithm ............................ Passed 0.39 sec + Start 365: conversions_to_posit +110/615 Test #156: lns_next ................................. Passed 0.39 sec + Start 366: conversions_to_string +111/615 Test #157: lns_pow .................................. Passed 0.40 sec + Start 367: mp_secant +112/615 Test #159: lns_truncate ............................. Passed 0.40 sec + Start 368: mp_taylor +113/615 Test #161: dbns_api ................................. Passed 0.40 sec + Start 369: mp_simpson +114/615 Test #162: dbns_attributes .......................... Passed 0.40 sec + Start 370: mp_trapezoidal +115/615 Test #163: dbns_lns_comparison ...................... Passed 0.40 sec + Start 371: mp_spline +116/615 Test #164: dbns_table ............................... Passed 0.40 sec + Start 372: optimal_secant +117/615 Test #165: dbns_assignment .......................... Passed 0.40 sec + Start 373: mp_cg +118/615 Test #166: dbns_conversion .......................... Passed 0.40 sec + Start 374: mp_cg_mvdot_cmpdot +119/615 Test #167: dbns_rounding ............................ Passed 0.40 sec + Start 375: mp_cg_mvdot_cmpfdp +120/615 Test #168: dbns_addition ............................ Passed 0.40 sec + Start 376: mp_cg_mvfdp_cmpdot +121/615 Test #169: dbns_behavior ............................ Passed 0.41 sec + Start 377: mp_cg_mvfdp_cmpfdp +122/615 Test #173: sorn_api ................................. Passed 0.40 sec + Start 378: mp_inference +123/615 Test #174: sorn_addition ............................ Passed 0.41 sec + Start 379: error_sampling +124/615 Test #175: sorn_division ............................ Passed 0.41 sec + Start 380: error_scaling +125/615 Test #176: sorn_multiplication ...................... Passed 0.41 sec + Start 381: quantization_qsnr +126/615 Test #177: sorn_subtraction ......................... Passed 0.41 sec + Start 382: error_dot +127/615 Test #178: unum1_api ................................ Passed 0.41 sec + Start 383: accuracy_dot +128/615 Test #179: unum1_construct .......................... Passed 0.41 sec + Start 384: accuracy_gemm +129/615 Test #180: unum2_api ................................ Passed 0.41 sec + Start 385: accuracy_matvec +130/615 Test #181: unum2_construct .......................... Passed 0.41 sec + Start 386: accuracy_mpdot +131/615 Test #182: posit_api ................................ Passed 0.42 sec + Start 387: accuracy_mpfma +132/615 Test #183: posit_casting ............................ Passed 0.42 sec + Start 388: range_dot +133/615 Test #184: posit_constexpr_test ..................... Passed 0.42 sec + Start 389: range_gemm +134/615 Test #185: posit_decode ............................. Passed 0.42 sec + Start 390: range_matvec +135/615 Test #186: posit_number_traits ...................... Passed 0.42 sec + Start 391: range_floating-point +136/615 Test #187: posit_postfix ............................ Passed 0.42 sec + Start 392: reproducibility_dot +137/615 Test #188: posit_prefix ............................. Passed 0.42 sec + Start 393: reproducibility_gemm +138/615 Test #189: posit_quire_accumulation ................. Passed 0.42 sec + Start 394: reproducibility_matvec +139/615 Test #190: posit_reciprocal_tables .................. Passed 0.42 sec + Start 395: performance_dot +140/615 Test #191: posit_serialization ...................... Passed 0.42 sec + Start 396: performance_gemm +141/615 Test #192: posit_ulp ................................ Passed 0.42 sec + Start 397: performance_matvec +142/615 Test #193: posit_assignment ......................... Passed 0.43 sec + Start 398: benchmark_areal_performance +143/615 Test #200: posit_fma ................................ Passed 0.42 sec + Start 399: benchmark_cfloat_performance +144/615 Test #208: posit_classify ........................... Passed 0.41 sec + Start 400: benchmark_compare_performance +145/615 Test #209: posit_complex ............................ Passed 0.41 sec + Start 401: benchmark_decimal_performance +146/615 Test #212: posit_hypotenuse ......................... Passed 0.41 sec + Start 402: benchmark_fixpnt_performance +147/615 Test #213: posit_logarithm .......................... Passed 0.41 sec + Start 403: benchmark_integer_performance +148/615 Test #214: posit_next ............................... Passed 0.41 sec + Start 404: benchmark_lns_performance +149/615 Test #217: posit_truncate ........................... Passed 0.41 sec + Start 405: benchmark_native_performance +150/615 Test #224: fast_posit_2_0 ........................... Passed 0.41 sec + Start 406: benchmark_posit_10b_posit +151/615 Test #226: fast_posit_3_0 ........................... Passed 0.41 sec + Start 407: benchmark_posit_12b_posit +152/615 Test #228: fast_posit_4_0 ........................... Passed 0.41 sec + Start 408: benchmark_posit_14b_posit +153/615 Test #233: fast_posit_8_2 ........................... Passed 0.40 sec + Start 409: benchmark_posit_16b_posit +154/615 Test #235: posit2_api ............................... Passed 0.40 sec + Start 410: benchmark_posit_32b_posit +155/615 Test #236: posit2_attributes ........................ Passed 0.40 sec + Start 411: benchmark_posit_48b_posit +156/615 Test #237: posit2_manipulators ...................... Passed 0.41 sec + Start 412: benchmark_posit_4b_posit +157/615 Test #238: posit2_traits ............................ Passed 0.41 sec + Start 413: benchmark_posit_64b_posit +158/615 Test #239: posit2_ulp ............................... Passed 0.41 sec + Start 414: benchmark_posit_8b_posit +159/615 Test #241: posito_api ............................... Passed 0.41 sec + Start 415: benchmark_unum_performance +160/615 Test #248: valid_api ................................ Passed 0.40 sec + Start 416: benchmark_valid_performance +161/615 Test #249: valid_exceptions ......................... Passed 0.40 sec + Start 417: energy_dot +162/615 Test #250: valid_conversion ......................... Passed 0.40 sec + Start 418: energy_gemm +163/615 Test #251: valid_logic .............................. Passed 0.40 sec + Start 419: energy_matvec +164/615 Test #252: valid_addition ........................... Passed 0.41 sec + Start 420: areal +165/615 Test #254: areal_api ................................ Passed 0.40 sec + Start 421: cfloat8_2 +166/615 Test #64: eint_division ............................ Passed 0.64 sec + Start 422: cfloat8_3 +167/615 Test #66: eint_subtraction ......................... Passed 0.64 sec + Start 423: cfloat8_4 +168/615 Test #104: bint_sqrt ................................ Passed 0.60 sec + Start 424: double +169/615 Test #131: fixpnt_exponent .......................... Passed 0.57 sec + Start 425: fixpnt +170/615 Test #133: fixpnt_logarithm ......................... Passed 0.57 sec + Start 426: float2posit +171/615 Test #136: fixpnt_truncate .......................... Passed 0.57 sec + Start 427: half +172/615 Test #172: dbns_subtraction ......................... Passed 0.53 sec + Start 428: ieee +173/615 Test #194: posit_conversion .........................***Failed 0.50 sec + Start 429: lns +174/615 Test #195: posit_logic .............................. Passed 0.51 sec + Start 430: longdouble +175/615 Test #206: posit_sqrt ............................... Passed 0.50 sec + Start 431: plimits +176/615 Test #210: posit_exponent ........................... Passed 0.49 sec + Start 432: posit +177/615 Test #211: posit_hyperbolic ......................... Passed 0.50 sec + Start 433: propenv +178/615 Test #215: posit_pow ................................ Passed 0.49 sec + Start 434: propp +179/615 Test #216: posit_trigonometry ....................... Passed 0.49 sec + Start 435: propq +180/615 Test #218: fast_posit_128_2 ......................... Passed 0.49 sec + Start 436: quad +181/615 Test #219: fast_posit_128_4 ......................... Passed 0.49 sec + Start 437: quarter +182/615 Test #227: fast_posit_48_2 .......................... Passed 0.49 sec + Start 438: signedint +183/615 Test #229: fast_posit_64_2 .......................... Passed 0.49 sec + Start 439: single +184/615 Test #230: fast_posit_64_3 .......................... Passed 0.49 sec + Start 440: unsignedint +185/615 Test #231: fast_posit_8_0 ........................... Passed 0.49 sec + Start 441: execution_environment +186/615 Test #232: fast_posit_8_1 ........................... Passed 0.49 sec + Start 442: edu_integer_basic_operators +187/615 Test #243: posito_division .......................... Passed 0.48 sec + Start 443: edu_fixpnt_basic_operators +188/615 Test #244: posito_multiplication ....................***Failed 0.48 sec + Start 444: edu_areal_basic_operators +189/615 Test #245: posito_number_system ..................... Passed 0.48 sec + Start 445: edu_bfloat_basic_operators +190/615 Test #247: posito_assignment ........................ Passed 0.48 sec + Start 446: edu_unum_basic_operators +191/615 Test #255: areal_assignment ......................... Passed 0.47 sec + Start 447: edu_posit_basic_operators +192/615 Test #256: areal_constexpr .......................... Passed 0.47 sec + Start 448: edu_posit_components +193/615 Test #253: valid_exponent ........................... Passed 0.48 sec + Start 449: edu_posit_conversion +194/615 Test #257: areal_exceptions ......................... Passed 0.46 sec + Start 450: edu_posit_discretization_curves +195/615 Test #258: areal_special_cases ...................... Passed 0.46 sec + Start 451: edu_posit_enumeration +196/615 Test #260: areal_double_conversion .................. Passed 0.46 sec + Start 452: edu_posit_exceptions +197/615 Test #261: areal_float_conversion ................... Passed 0.46 sec + Start 453: edu_posit_exponents +198/615 Test #262: areal_sampling ........................... Passed 0.45 sec + Start 454: edu_posit_extract +199/615 Test #263: areal_addition ........................... Passed 0.45 sec + Start 455: edu_posit_fractions +200/615 Test #264: areal_double_precision ................... Passed 0.45 sec + Start 456: edu_posit_raw_bit_patterns +201/615 Test #265: areal_half_precision ..................... Passed 0.45 sec + Start 457: edu_posit_regimes +202/615 Test #266: areal_quad_precision ..................... Passed 0.45 sec + Start 458: edu_posit_serialization +203/615 Test #267: areal_quarter_precision .................. Passed 0.45 sec + Start 459: edu_posit_signalling_nar +204/615 Test #268: areal_single_precision ................... Passed 0.45 sec + Start 460: edu_posit_ulp +205/615 Test #270: bfloat16_attributes ...................... Passed 0.45 sec + Start 461: edu_posit_values +206/615 Test #271: bfloat16_traits .......................... Passed 0.45 sec + Start 462: edu_valid_intervals +207/615 Test #272: bfloat16_addition ........................ Passed 0.45 sec + Start 463: edu_lns_basic_operators +208/615 Test #273: bfloat16_arithmetic ...................... Passed 0.45 sec + Start 464: edu_tables_areals +209/615 Test #274: bfloat16_pow ............................. Passed 0.45 sec + Start 465: edu_tables_cfloats +210/615 Test #275: cfloat_api ............................... Passed 0.45 sec + Start 466: edu_tables_fixpnts +211/615 Test #276: cfloat_attributes ........................ Passed 0.45 sec + Start 467: edu_tables_lns +212/615 Test #277: cfloat_constexpr ......................... Passed 0.45 sec + Start 468: edu_tables_posits +213/615 Test #278: cfloat_dynamic_range ..................... Passed 0.45 sec + Start 469: edu_ranges_cfloat +214/615 Test #279: cfloat_exceptions ........................ Passed 0.45 sec + Start 470: edu_ranges_fixpnt +215/615 Test #280: cfloat_special_cases ..................... Passed 0.45 sec + Start 471: edu_ranges_lns +216/615 Test #282: cfloat_traits ............................ Passed 0.45 sec + Start 472: edu_ranges_posit +217/615 Test #283: cfloat_types ............................. Passed 0.45 sec + Start 473: edu_quire_quires +218/615 Test #284: cfloat_ulp ............................... Passed 0.45 sec + Start 474: playground_efunc_posits +219/615 Test #286: cfloat_double_conversion ................. Passed 0.44 sec + Start 475: playground_efunc_valids +220/615 Test #288: cfloat_ieee754_subnormals ................ Passed 0.44 sec + Start 476: playground_gismo_test +221/615 Test #289: cfloat_normalization ..................... Passed 0.44 sec + Start 477: playground_meta_programming +222/615 Test #290: cfloat_decrement ......................... Passed 0.44 sec + Start 478: playground_serialization +223/615 Test #291: cfloat_increment ......................... Passed 0.44 sec + Start 479: playground_skeleton +224/615 Test #292: cfloat_random_arithmetic ................. Passed 0.44 sec + Start 480: playground_type_test +225/615 Test #293: cfloat_sqrt_algorithm_reference .......... Passed 0.44 sec + Start 481: engineering_chem_equilibrium +226/615 Test #295: cfloat_amd_fp24 .......................... Passed 0.44 sec + Start 482: engineering_water +227/615 Test #296: cfloat_bfloat16 .......................... Passed 0.44 sec + Start 483: ode_convergence +228/615 Test #297: cfloat_pixar_pxr24 ....................... Passed 0.44 sec + Start 484: ode_first_order_ode +229/615 Test #298: cfloat_tensorfloat ....................... Passed 0.44 sec + Start 485: ode_general_runge_kutta +230/615 Test #299: cfloat_classify .......................... Passed 0.44 sec + Start 486: ode_runge_kutta4 +231/615 Test #300: cfloat_exponent .......................... Passed 0.44 sec + Start 487: opt_error_vs_cost +232/615 Test #301: cfloat_fractional ........................ Passed 0.44 sec + Start 488: pde_cg +233/615 Test #302: cfloat_hyperbolic ........................ Passed 0.44 sec + Start 489: pde_gauss_seidel +234/615 Test #303: cfloat_hypotenuse ........................ Passed 0.44 sec + Start 490: pde_jacobi +235/615 Test #304: cfloat_logarithm ......................... Passed 0.44 sec + Start 491: pde_laplace +236/615 Test #305: cfloat_next .............................. Passed 0.44 sec + Start 492: pde_sor +237/615 Test #306: cfloat_pow ............................... Passed 0.44 sec + Start 493: roots_bisection +238/615 Test #307: cfloat_trigonometry ...................... Passed 0.44 sec + Start 494: roots_rpoly_ak1 +239/615 Test #308: cfloat_truncate .......................... Passed 0.44 sec + Start 495: science_iso_constants +240/615 Test #310: cfloat_fff_from_blocktriple .............. Passed 0.44 sec + Start 496: science_physics_constants +241/615 Test #311: cfloat_fff_to_blocktriple ................ Passed 0.44 sec + Start 497: approx_taylor_series +242/615 Test #319: cfloat_fff_fma ........................... Passed 0.42 sec + Start 498: cheby_chebtests +243/615 Test #321: cfloat_fff_sqrt .......................... Passed 0.42 sec + Start 499: cheby_lambdas +244/615 Test #326: cfloat_tff_sqrt .......................... Passed 0.41 sec + Start 500: cheby_nodes +245/615 Test #331: cfloat_ftf_sqrt .......................... Passed 0.40 sec + Start 501: cheby_playground +246/615 Test #336: cfloat_ttf_sqrt .......................... Passed 0.39 sec + Start 502: cheby_skeleton +247/615 Test #338: cfloat_fft_from_blocktriple .............. Passed 0.39 sec + Start 503: dnn_fit_sin +248/615 Test #340: cfloat_tft_from_blocktriple .............. Passed 0.39 sec + Start 504: dnn_mnist +249/615 Test #345: cfloat_fft_addition ...................... Passed 0.38 sec + Start 505: dnn_schedules +250/615 Test #347: cfloat_fft_multiplication ................ Passed 0.38 sec + Start 506: dsp_adc_mapping +251/615 Test #349: cfloat_tft_addition ...................... Passed 0.38 sec + Start 507: dsp_fir_filter +252/615 Test #353: cfloat_ftt_addition ...................... Passed 0.37 sec + Start 508: chaos_bakers_map +253/615 Test #357: cfloat_ttt_addition ...................... Passed 0.36 sec + Start 509: chaos_time_precision_lyapunov +254/615 Test #359: cfloat_ttt_multiplication ................ Passed 0.36 sec + Start 510: complex_compute +255/615 Test #360: cfloat_ttt_subtraction ................... Passed 0.36 sec + Start 511: mem_stream +256/615 Test #361: dfloat_api ............................... Passed 0.36 sec + Start 512: weather_error_growth_atmospheric_model +257/615 Test #362: conversions_rounding ..................... Passed 0.36 sec + Start 513: adaptive_euler +258/615 Test #363: conversions_to_decimal ................... Passed 0.36 sec + Start 514: adaptive_phi +259/615 Test #364: conversions_to_integer ................... Passed 0.36 sec + Start 515: adaptive_pi +260/615 Test #365: conversions_to_posit ..................... Passed 0.36 sec + Start 516: fp_catastrophic_cancellation +261/615 Test #366: conversions_to_string .................... Passed 0.36 sec + Start 517: fp_contract_expand +262/615 Test #367: mp_secant ................................ Passed 0.36 sec + Start 518: fp_exponentiation +263/615 Test #368: mp_taylor ................................ Passed 0.36 sec + Start 519: fp_integer_cover +264/615 Test #369: mp_simpson ............................... Passed 0.36 sec + Start 520: fp_kahan_sum +265/615 Test #370: mp_trapezoidal ........................... Passed 0.36 sec + Start 521: fp_linear_cover +266/615 Test #371: mp_spline ................................ Passed 0.36 sec + Start 522: fp_precision +267/615 Test #372: optimal_secant ........................... Passed 0.36 sec + Start 523: fp_printing +268/615 Test #373: mp_cg .................................... Passed 0.36 sec + Start 524: fp_rounding_error_addition +269/615 Test #378: mp_inference ............................. Passed 0.35 sec + Start 525: fp_rounding_error_multiplication +270/615 Test #379: error_sampling ........................... Passed 0.35 sec + Start 526: fp_sterbenz_lemma +271/615 Test #380: error_scaling ............................ Passed 0.35 sec + Start 527: fp_sum_of_integers +272/615 Test #381: quantization_qsnr ........................ Passed 0.35 sec + Start 528: fp_thin_triangle +273/615 Test #383: accuracy_dot ............................. Passed 0.35 sec + Start 529: fp_two_sum +274/615 Test #384: accuracy_gemm ............................ Passed 0.35 sec + Start 530: fp_underflow +275/615 Test #385: accuracy_matvec .......................... Passed 0.35 sec + Start 531: math_decimal_lpp +276/615 Test #386: accuracy_mpdot ........................... Passed 0.35 sec + Start 532: math_distinct_powers +277/615 Test #387: accuracy_mpfma ........................... Passed 0.35 sec + Start 533: math_irrational_powers +278/615 Test #388: range_dot ................................ Passed 0.35 sec + Start 534: math_largest_palindrome_product +279/615 Test #389: range_gemm ............................... Passed 0.35 sec + Start 535: math_numbers_irrational +280/615 Test #390: range_matvec ............................. Passed 0.35 sec + Start 536: math_numbers_rational +281/615 Test #391: range_floating-point ..................... Passed 0.35 sec + Start 537: math_pascals_triangle +282/615 Test #392: reproducibility_dot ...................... Passed 0.35 sec + Start 538: math_primes +283/615 Test #393: reproducibility_gemm ..................... Passed 0.35 sec + Start 539: math_sincospi +284/615 Test #394: reproducibility_matvec ................... Passed 0.35 sec + Start 540: math_stirlings_approximation +285/615 Test #395: performance_dot .......................... Passed 0.35 sec + Start 541: numeric_constants +286/615 Test #396: performance_gemm ......................... Passed 0.35 sec + Start 542: numeric_doubledouble +287/615 Test #397: performance_matvec ....................... Passed 0.35 sec + Start 543: numeric_luir +288/615 Test #398: benchmark_areal_performance .............. Passed 0.35 sec + Start 544: numeric_midpoint +289/615 Test #401: benchmark_decimal_performance ............ Passed 0.35 sec + Start 545: numeric_numbers +290/615 Test #402: benchmark_fixpnt_performance ............. Passed 0.35 sec + Start 546: numeric_posit_list +291/615 Test #403: benchmark_integer_performance ............ Passed 0.35 sec + Start 547: numeric_posit_properties +292/615 Test #409: benchmark_posit_16b_posit ................ Passed 0.34 sec + Start 548: numeric_priest +293/615 Test #410: benchmark_posit_32b_posit ................ Passed 0.34 sec + Start 549: numeric_quadratic +294/615 Test #412: benchmark_posit_4b_posit ................. Passed 0.34 sec + Start 550: numeric_residual +295/615 Test #414: benchmark_posit_8b_posit ................. Passed 0.34 sec + Start 551: numeric_rump_equation +296/615 Test #415: benchmark_unum_performance ............... Passed 0.34 sec + Start 552: numeric_solvetest +297/615 Test #416: benchmark_valid_performance .............. Passed 0.34 sec + Start 553: numeric_traits +298/615 Test #417: energy_dot ............................... Passed 0.34 sec + Start 554: numeric_ulp_math +299/615 Test #418: energy_gemm .............................. Passed 0.34 sec + Start 555: blas_hilbert +300/615 Test #419: energy_matvec ............................ Passed 0.34 sec + Start 556: blas_inverse +301/615 Test #420: areal .................................... Passed 0.34 sec + Start 557: blas_l1_fused_dot +302/615 Test #421: cfloat8_2 ................................ Passed 0.34 sec + Start 558: blas_l2_fused_mv +303/615 Test #151: lns_exponent ............................. Passed 0.88 sec + Start 559: blas_l3_fused_mm +304/615 Test #170: dbns_division ............................ Passed 0.87 sec + Start 560: blas_lu +305/615 Test #198: posit_decrement .......................... Passed 0.84 sec + Start 561: blas_norms +306/615 Test #201: posit_increment .......................... Passed 0.83 sec + Start 562: blas_randsvd +307/615 Test #269: bfloat16_api ............................. Passed 0.72 sec + Start 563: crypto_fermat +308/615 Test #281: cfloat_subnormals ........................ Passed 0.69 sec + Start 564: crypto_large_lcm +309/615 Test #287: cfloat_float_conversion .................. Passed 0.68 sec + Start 565: crypto_pollard_rho +310/615 Test #406: benchmark_posit_10b_posit ................ Passed 0.41 sec + Start 566: crypto_quadratic_sieve +311/615 Test #407: benchmark_posit_12b_posit ................ Passed 0.41 sec + Start 567: sequences_fibonacci +312/615 Test #408: benchmark_posit_14b_posit ................ Passed 0.41 sec + Start 568: sequences_tribonacci +313/615 Test #422: cfloat8_3 ................................ Passed 0.38 sec + Start 569: stl_sequential_containers +314/615 Test #423: cfloat8_4 ................................ Passed 0.38 sec + Start 570: faithful_accurate_sum_and_dot +315/615 Test #424: double ................................... Passed 0.37 sec + Start 571: faithful_arithmetic +316/615 Test #425: fixpnt ................................... Passed 0.37 sec + Start 572: ieee754_quire_accumulation +317/615 Test #426: float2posit .............................. Passed 0.37 sec + Start 573: ieee754_quires +318/615 Test #427: half ..................................... Passed 0.37 sec + Start 574: utils_lookup_arithmetic +319/615 Test #428: ieee ..................................... Passed 0.37 sec + Start 575: utils_reverse_view +320/615 Test #429: lns ...................................... Passed 0.37 sec + Start 576: utils_sampling +321/615 Test #430: longdouble ............................... Passed 0.38 sec + Start 577: utils_scale_tracking +322/615 Test #431: plimits .................................. Passed 0.37 sec + Start 578: ns_exp_div_factorial +323/615 Test #432: posit .................................... Passed 0.37 sec + Start 579: ns_type_traits +324/615 Test #433: propenv .................................. Passed 0.37 sec + Start 580: fnctn_factorial +325/615 Test #434: propp .................................... Passed 0.38 sec + Start 581: fnctn_isrepresentable +326/615 Test #435: propq .................................... Passed 0.38 sec + Start 582: fnctn_lerp +327/615 Test #436: quad ..................................... Passed 0.38 sec + Start 583: fnctn_logistic_loss +328/615 Test #437: quarter .................................. Passed 0.38 sec + Start 584: fnctn_polynomial +329/615 Test #438: signedint ................................ Passed 0.38 sec + Start 585: fpb_end_of_error +330/615 Test #439: single ................................... Passed 0.38 sec + Start 586: fpb_hamming_1987 +331/615 Test #440: unsignedint .............................. Passed 0.38 sec + Start 587: fpb_log_exp +332/615 Test #441: execution_environment .................... Passed 0.38 sec + Start 588: hw_bfloat16 +333/615 Test #442: edu_integer_basic_operators .............. Passed 0.38 sec + Start 589: hw_cfloat +334/615 Test #443: edu_fixpnt_basic_operators ............... Passed 0.38 sec + Start 590: hw_enumerate +335/615 Test #444: edu_areal_basic_operators ................ Passed 0.38 sec + Start 591: hw_fp8_4_nosubsupsat +336/615 Test #445: edu_bfloat_basic_operators ............... Passed 0.38 sec + Start 592: hw_fp8_4_subsupnosat +337/615 Test #446: edu_unum_basic_operators ................. Passed 0.38 sec + Start 593: hw_integer +338/615 Test #447: edu_posit_basic_operators ................ Passed 0.39 sec + Start 594: hw_posit +339/615 Test #448: edu_posit_components ..................... Passed 0.39 sec + Start 595: hw_ranges +340/615 Test #449: edu_posit_conversion ..................... Passed 0.38 sec + Start 596: c_api_shim_exact_test +341/615 Test #450: edu_posit_discretization_curves .......... Passed 0.38 sec + Start 597: c_api_shim_experiment +342/615 Test #451: edu_posit_enumeration .................... Passed 0.39 sec + Start 598: c_api_shim_posit128 +343/615 Test #452: edu_posit_exceptions ..................... Passed 0.39 sec + Start 599: c_api_shim_posit16 +344/615 Test #453: edu_posit_exponents ...................... Passed 0.39 sec + Start 600: c_api_shim_posit256 +345/615 Test #454: edu_posit_extract ........................ Passed 0.39 sec + Start 601: c_api_shim_posit32 +346/615 Test #455: edu_posit_fractions ...................... Passed 0.39 sec + Start 602: c_api_shim_posit4 +347/615 Test #456: edu_posit_raw_bit_patterns ............... Passed 0.39 sec + Start 603: c_api_shim_posit64 +348/615 Test #457: edu_posit_regimes ........................ Passed 0.39 sec + Start 604: c_api_shim_posit8 +349/615 Test #458: edu_posit_serialization .................. Passed 0.39 sec + Start 605: blas_generators +350/615 Test #459: edu_posit_signalling_nar ................. Passed 0.40 sec + Start 606: blas_matrix_ops +351/615 Test #461: edu_posit_values ......................... Passed 0.40 sec + Start 607: blas_minij +352/615 Test #462: edu_valid_intervals ...................... Passed 0.40 sec + Start 608: blas_rand_spectral +353/615 Test #463: edu_lns_basic_operators .................. Passed 0.40 sec + Start 609: blas_vector_ops +354/615 Test #464: edu_tables_areals ........................ Passed 0.40 sec + Start 610: vmath_linspace +355/615 Test #465: edu_tables_cfloats ....................... Passed 0.40 sec + Start 611: vmath_trigonometry +356/615 Test #466: edu_tables_fixpnts ....................... Passed 0.40 sec + Start 612: data_prototype +357/615 Test #467: edu_tables_lns ........................... Passed 0.40 sec + Start 613: data_scaling +358/615 Test #468: edu_tables_posits ........................ Passed 0.40 sec + Start 614: data_serialization +359/615 Test #469: edu_ranges_cfloat ........................ Passed 0.40 sec + Start 615: data_summary_statistics +360/615 Test #470: edu_ranges_fixpnt ........................ Passed 0.40 sec +361/615 Test #471: edu_ranges_lns ........................... Passed 0.40 sec +362/615 Test #472: edu_ranges_posit ......................... Passed 0.39 sec +363/615 Test #473: edu_quire_quires ......................... Passed 0.39 sec +364/615 Test #474: playground_efunc_posits .................. Passed 0.39 sec +365/615 Test #475: playground_efunc_valids .................. Passed 0.39 sec +366/615 Test #476: playground_gismo_test .................... Passed 0.38 sec +367/615 Test #477: playground_meta_programming .............. Passed 0.38 sec +368/615 Test #478: playground_serialization ................. Passed 0.38 sec +369/615 Test #480: playground_type_test ..................... Passed 0.38 sec +370/615 Test #481: engineering_chem_equilibrium ............. Passed 0.37 sec +371/615 Test #482: engineering_water ........................ Passed 0.37 sec +372/615 Test #483: ode_convergence .......................... Passed 0.37 sec +373/615 Test #484: ode_first_order_ode ...................... Passed 0.37 sec +374/615 Test #485: ode_general_runge_kutta .................. Passed 0.37 sec +375/615 Test #486: ode_runge_kutta4 ......................... Passed 0.36 sec +376/615 Test #487: opt_error_vs_cost ........................ Passed 0.36 sec +377/615 Test #488: pde_cg ................................... Passed 0.36 sec +378/615 Test #489: pde_gauss_seidel ......................... Passed 0.36 sec +379/615 Test #490: pde_jacobi ............................... Passed 0.35 sec +380/615 Test #491: pde_laplace .............................. Passed 0.35 sec +381/615 Test #492: pde_sor .................................. Passed 0.35 sec +382/615 Test #493: roots_bisection .......................... Passed 0.35 sec +383/615 Test #494: roots_rpoly_ak1 .......................... Passed 0.34 sec +384/615 Test #495: science_iso_constants .................... Passed 0.34 sec +385/615 Test #496: science_physics_constants ................ Passed 0.34 sec +386/615 Test #497: approx_taylor_series ..................... Passed 0.34 sec +387/615 Test #498: cheby_chebtests .......................... Passed 0.34 sec +388/615 Test #499: cheby_lambdas ............................ Passed 0.33 sec +389/615 Test #500: cheby_nodes .............................. Passed 0.33 sec +390/615 Test #501: cheby_playground ......................... Passed 0.33 sec +391/615 Test #502: cheby_skeleton ........................... Passed 0.33 sec +392/615 Test #503: dnn_fit_sin .............................. Passed 0.32 sec +393/615 Test #504: dnn_mnist ................................ Passed 0.32 sec +394/615 Test #505: dnn_schedules ............................ Passed 0.32 sec +395/615 Test #506: dsp_adc_mapping .......................... Passed 0.32 sec +396/615 Test #507: dsp_fir_filter ........................... Passed 0.32 sec +397/615 Test #509: chaos_time_precision_lyapunov ............ Passed 0.31 sec +398/615 Test #510: complex_compute .......................... Passed 0.31 sec +399/615 Test #512: weather_error_growth_atmospheric_model ... Passed 0.31 sec +400/615 Test #513: adaptive_euler ........................... Passed 0.30 sec +401/615 Test #514: adaptive_phi ............................. Passed 0.30 sec +402/615 Test #516: fp_catastrophic_cancellation ............. Passed 0.30 sec +403/615 Test #517: fp_contract_expand ....................... Passed 0.30 sec +404/615 Test #518: fp_exponentiation ........................ Passed 0.29 sec +405/615 Test #521: fp_linear_cover .......................... Passed 0.29 sec +406/615 Test #522: fp_precision ............................. Passed 0.29 sec +407/615 Test #523: fp_printing .............................. Passed 0.28 sec +408/615 Test #524: fp_rounding_error_addition ............... Passed 0.28 sec +409/615 Test #525: fp_rounding_error_multiplication ......... Passed 0.28 sec +410/615 Test #526: fp_sterbenz_lemma ........................ Passed 0.28 sec +411/615 Test #528: fp_thin_triangle ......................... Passed 0.27 sec +412/615 Test #530: fp_underflow ............................. Passed 0.26 sec +413/615 Test #531: math_decimal_lpp ......................... Passed 0.26 sec +414/615 Test #532: math_distinct_powers ..................... Passed 0.26 sec +415/615 Test #533: math_irrational_powers ................... Passed 0.26 sec +416/615 Test #534: math_largest_palindrome_product .......... Passed 0.25 sec +417/615 Test #535: math_numbers_irrational .................. Passed 0.25 sec +418/615 Test #536: math_numbers_rational .................... Passed 0.25 sec +419/615 Test #538: math_primes .............................. Passed 0.24 sec +420/615 Test #539: math_sincospi ............................ Passed 0.24 sec +421/615 Test #540: math_stirlings_approximation ............. Passed 0.24 sec +422/615 Test #541: numeric_constants ........................ Passed 0.24 sec +423/615 Test #542: numeric_doubledouble ..................... Passed 0.23 sec +424/615 Test #543: numeric_luir ............................. Passed 0.23 sec +425/615 Test #544: numeric_midpoint ......................... Passed 0.23 sec +426/615 Test #545: numeric_numbers .......................... Passed 0.23 sec +427/615 Test #546: numeric_posit_list ....................... Passed 0.22 sec +428/615 Test #547: numeric_posit_properties ................. Passed 0.22 sec +429/615 Test #548: numeric_priest ........................... Passed 0.22 sec +430/615 Test #549: numeric_quadratic ........................ Passed 0.22 sec +431/615 Test #550: numeric_residual ......................... Passed 0.21 sec +432/615 Test #551: numeric_rump_equation .................... Passed 0.21 sec +433/615 Test #552: numeric_solvetest ........................ Passed 0.21 sec +434/615 Test #553: numeric_traits ........................... Passed 0.21 sec +435/615 Test #554: numeric_ulp_math ......................... Passed 0.20 sec +436/615 Test #557: blas_l1_fused_dot ........................ Passed 0.20 sec +437/615 Test #19: bb_addition .............................. Passed 1.21 sec +438/615 Test #21: bb_multiplication ........................ Passed 1.21 sec +439/615 Test #399: benchmark_cfloat_performance ............. Passed 0.59 sec +440/615 Test #405: benchmark_native_performance ............. Passed 0.58 sec +441/615 Test #508: chaos_bakers_map ......................... Passed 0.33 sec +442/615 Test #556: blas_inverse ............................. Passed 0.21 sec +443/615 Test #558: blas_l2_fused_mv ......................... Passed 0.20 sec +444/615 Test #519: fp_integer_cover ......................... Passed 0.31 sec +445/615 Test #555: blas_hilbert ............................. Passed 0.21 sec +446/615 Test #460: edu_posit_ulp ............................ Passed 0.45 sec +447/615 Test #515: adaptive_pi .............................. Passed 0.32 sec +448/615 Test #223: fast_posit_256_5 ......................... Passed 0.99 sec +449/615 Test #222: fast_posit_256_2 ......................... Passed 0.99 sec +450/615 Test #559: blas_l3_fused_mm ......................... Passed 0.19 sec +451/615 Test #561: blas_norms ............................... Passed 0.18 sec +452/615 Test #562: blas_randsvd ............................. Passed 0.18 sec +453/615 Test #563: crypto_fermat ............................ Passed 0.18 sec +454/615 Test #564: crypto_large_lcm ......................... Passed 0.17 sec +455/615 Test #565: crypto_pollard_rho ....................... Passed 0.17 sec +456/615 Test #566: crypto_quadratic_sieve ................... Passed 0.17 sec +457/615 Test #567: sequences_fibonacci ...................... Passed 0.17 sec +458/615 Test #568: sequences_tribonacci ..................... Passed 0.16 sec +459/615 Test #569: stl_sequential_containers ................ Passed 0.16 sec +460/615 Test #570: faithful_accurate_sum_and_dot ............ Passed 0.16 sec +461/615 Test #571: faithful_arithmetic ...................... Passed 0.16 sec +462/615 Test #572: ieee754_quire_accumulation ............... Passed 0.16 sec +463/615 Test #573: ieee754_quires ........................... Passed 0.15 sec +464/615 Test #574: utils_lookup_arithmetic .................. Passed 0.15 sec +465/615 Test #575: utils_reverse_view ....................... Passed 0.15 sec +466/615 Test #576: utils_sampling ........................... Passed 0.14 sec +467/615 Test #577: utils_scale_tracking ..................... Passed 0.14 sec +468/615 Test #578: ns_exp_div_factorial ..................... Passed 0.14 sec +469/615 Test #579: ns_type_traits ........................... Passed 0.14 sec +470/615 Test #580: fnctn_factorial .......................... Passed 0.13 sec +471/615 Test #581: fnctn_isrepresentable .................... Passed 0.13 sec +472/615 Test #582: fnctn_lerp ............................... Passed 0.13 sec +473/615 Test #583: fnctn_logistic_loss ...................... Passed 0.13 sec +474/615 Test #584: fnctn_polynomial ......................... Passed 0.12 sec +475/615 Test #585: fpb_end_of_error ......................... Passed 0.12 sec +476/615 Test #586: fpb_hamming_1987 ......................... Passed 0.12 sec +477/615 Test #587: fpb_log_exp .............................. Passed 0.12 sec +478/615 Test #588: hw_bfloat16 .............................. Passed 0.11 sec +479/615 Test #589: hw_cfloat ................................ Passed 0.11 sec +480/615 Test #590: hw_enumerate ............................. Passed 0.11 sec +481/615 Test #591: hw_fp8_4_nosubsupsat ..................... Passed 0.10 sec +482/615 Test #592: hw_fp8_4_subsupnosat ..................... Passed 0.10 sec +483/615 Test #593: hw_integer ............................... Passed 0.10 sec +484/615 Test #594: hw_posit ................................. Passed 0.10 sec +485/615 Test #595: hw_ranges ................................ Passed 0.09 sec +486/615 Test #597: c_api_shim_experiment .................... Passed 0.09 sec +487/615 Test #602: c_api_shim_posit4 ........................ Passed 0.07 sec +488/615 Test #605: blas_generators .......................... Passed 0.06 sec +489/615 Test #607: blas_minij ............................... Passed 0.05 sec +490/615 Test #608: blas_rand_spectral ....................... Passed 0.05 sec +491/615 Test #610: vmath_linspace ........................... Passed 0.05 sec +492/615 Test #611: vmath_trigonometry ....................... Passed 0.04 sec +493/615 Test #612: data_prototype ........................... Passed 0.04 sec +494/615 Test #613: data_scaling ............................. Passed 0.04 sec +495/615 Test #614: data_serialization ....................... Passed 0.04 sec +496/615 Test #154: lns_hypotenuse ...........................***Failed 1.08 sec +497/615 Test #479: playground_skeleton ...................... Passed 0.41 sec +498/615 Test #96: bint_shift_left .......................... Passed 1.17 sec +499/615 Test #609: blas_vector_ops .......................... Passed 0.08 sec +500/615 Test #520: fp_kahan_sum ............................. Passed 0.40 sec +501/615 Test #312: cfloat_tff_from_blocktriple .............. Passed 0.90 sec +502/615 Test #604: c_api_shim_posit8 ........................ Passed 0.17 sec +503/615 Test #158: lns_trigonometry ......................... Passed 1.20 sec +504/615 Test #560: blas_lu .................................. Passed 0.33 sec +505/615 Test #529: fp_two_sum ............................... Passed 0.45 sec +506/615 Test #615: data_summary_statistics .................. Passed 0.20 sec +507/615 Test #160: lns_performance .......................... Passed 1.54 sec +508/615 Test #242: posito_addition ..........................***Failed 1.47 sec +509/615 Test #207: posit_subtraction ........................***Failed 1.57 sec +510/615 Test #240: posit2_addition ..........................***Failed 1.63 sec +511/615 Test #382: error_dot ................................ Passed 1.44 sec +512/615 Test #202: posit_literals ........................... Passed 1.82 sec +513/615 Test #171: dbns_multiplication ...................... Passed 2.00 sec +514/615 Test #203: posit_multiplication .....................***Failed 2.09 sec +515/615 Test #315: cfloat_ttf_from_blocktriple .............. Passed 1.87 sec +516/615 Test #25: bb_performance ........................... Passed 2.34 sec +517/615 Test #343: cfloat_ttt_from_blocktriple .............. Passed 1.85 sec +518/615 Test #285: cfloat_assignment ........................ Passed 1.99 sec +519/615 Test #601: c_api_shim_posit32 ....................... Passed 1.21 sec +520/615 Test #8: value_arithmetic_add ..................... Passed 2.42 sec +521/615 Test #100: bint_multiplication ...................... Passed 2.52 sec +522/615 Test #599: c_api_shim_posit16 ....................... Passed 1.55 sec +523/615 Test #73: edec_addition ............................***Failed 2.68 sec +524/615 Test #76: edec_subtraction .........................***Failed 2.73 sec +525/615 Test #606: blas_matrix_ops .......................... Passed 1.71 sec +526/615 Test #377: mp_cg_mvfdp_cmpfdp ....................... Passed 2.40 sec +527/615 Test #375: mp_cg_mvdot_cmpfdp ....................... Passed 2.41 sec +528/615 Test #374: mp_cg_mvdot_cmpdot ....................... Passed 2.43 sec +529/615 Test #246: posito_subtraction .......................***Failed 2.80 sec +530/615 Test #74: edec_division ............................***Exception: Numerical 3.06 sec +531/615 Test #598: c_api_shim_posit128 ...................... Passed 2.00 sec +532/615 Test #527: fp_sum_of_integers ....................... Passed 2.43 sec +533/615 Test #600: c_api_shim_posit256 ...................... Passed 2.33 sec +534/615 Test #376: mp_cg_mvfdp_cmpdot ....................... Passed 2.94 sec +535/615 Test #596: c_api_shim_exact_test .................... Passed 2.68 sec +536/615 Test #234: fast_quire_32_2 .......................... Passed 3.66 sec +537/615 Test #411: benchmark_posit_48b_posit ................ Passed 3.36 sec +538/615 Test #99: bint_division ............................ Passed 4.18 sec +539/615 Test #603: c_api_shim_posit64 ....................... Passed 3.25 sec +540/615 Test #113: fixpnt_mod_conversion .................... Passed 4.39 sec +541/615 Test #221: fast_posit_16_2 .......................... Passed 4.32 sec +542/615 Test #115: fixpnt_sat_conversion .................... Passed 4.86 sec +543/615 Test #75: edec_multiplication ......................***Failed 5.03 sec +544/615 Test #196: posit_addition ...........................***Failed 5.06 sec +545/615 Test #143: lns_conversion ........................... Passed 5.42 sec +546/615 Test #199: posit_division ...........................***Failed 5.57 sec +547/615 Test #146: lns_division ............................. Passed 5.74 sec +548/615 Test #95: bint_logic ............................... Passed 5.87 sec +549/615 Test #413: benchmark_posit_64b_posit ................ Passed 5.50 sec +550/615 Test #205: posit_reciprocation ...................... Passed 6.31 sec +551/615 Test #204: posit_negation ........................... Passed 6.32 sec +552/615 Test #225: fast_posit_32_2 .......................... Passed 6.56 sec +553/615 Test #28: bf_multiplication ........................ Passed 7.33 sec +554/615 Test #35: bs_multiplication ........................ Passed 7.47 sec +555/615 Test #339: cfloat_fft_to_blocktriple ................ Passed 7.24 sec +556/615 Test #314: cfloat_ftf_to_blocktriple ................ Passed 9.95 sec +557/615 Test #9: value_performance ........................ Passed 10.51 sec +558/615 Test #342: cfloat_ftt_to_blocktriple ................ Passed 10.05 sec +559/615 Test #313: cfloat_tff_to_blocktriple ................ Passed 10.31 sec +560/615 Test #341: cfloat_tft_to_blocktriple ................ Passed 10.31 sec +561/615 Test #51: bt_performance ........................... Passed 11.60 sec +562/615 Test #259: areal_logic .............................. Passed 11.35 sec +563/615 Test #537: math_pascals_triangle .................... Passed 10.73 sec +564/615 Test #148: lns_subtraction .......................... Passed 11.73 sec +565/615 Test #144: lns_addition ............................. Passed 11.74 sec +566/615 Test #294: cfloat_logic ............................. Passed 12.60 sec +567/615 Test #316: cfloat_ttf_to_blocktriple ................ Passed 13.73 sec +568/615 Test #344: cfloat_ttt_to_blocktriple ................ Passed 13.70 sec +569/615 Test #404: benchmark_lns_performance ................ Passed 14.30 sec +570/615 Test #220: fast_posit_16_1 .......................... Passed 14.78 sec +571/615 Test #147: lns_multiplication ....................... Passed 15.03 sec +572/615 Test #117: fixpnt_logic ............................. Passed 20.98 sec +573/615 Test #119: fixpnt_mod_division ...................... Passed 32.73 sec +574/615 Test #101: bint_remainder ...........................***Failed 34.97 sec +575/615 Test #105: bint_perf ................................ Passed 37.93 sec +576/615 Test #511: mem_stream ............................... Passed 66.82 sec +577/615 Test #309: cfloat_perf .............................. Passed 69.02 sec +578/615 Test #400: benchmark_compare_performance ............ Passed 74.82 sec +579/615 Test #118: fixpnt_mod_addition ...................... Passed 79.79 sec +580/615 Test #122: fixpnt_sat_addition ...................... Passed 96.06 sec +581/615 Test #120: fixpnt_mod_multiplication ................ Passed 107.45 sec +582/615 Test #124: fixpnt_sat_multiplication ................ Passed 126.80 sec +583/615 Test #128: fixpnt_mod_complex_sub ................... Passed 227.80 sec +584/615 Test #126: fixpnt_mod_complex_add ................... Passed 228.08 sec +585/615 Test #102: bint_subtraction ......................... Passed 236.26 sec +586/615 Test #98: bint_addition ............................ Passed 794.86 sec +587/615 Test #121: fixpnt_mod_subtraction ................... Passed 4380.01 sec +588/615 Test #125: fixpnt_sat_subtraction ................... Passed 5267.58 sec +589/615 Test #335: cfloat_ttf_multiplication ................***Failed 5765.49 sec +590/615 Test #328: cfloat_ftf_addition ......................***Failed 6231.94 sec +591/615 Test #333: cfloat_ttf_addition ......................***Failed 6441.67 sec +592/615 Test #330: cfloat_ftf_multiplication ................***Failed 7071.34 sec +593/615 Test #355: cfloat_ftt_multiplication ................***Failed 7158.24 sec +594/615 Test #337: cfloat_ttf_subtraction ...................***Failed 7248.57 sec +595/615 Test #332: cfloat_ftf_subtraction ...................***Failed 7425.84 sec +596/615 Test #356: cfloat_ftt_subtraction ...................***Failed 7426.92 sec +597/615 Test #317: cfloat_fff_addition ...................... Passed 8141.99 sec +598/615 Test #323: cfloat_tff_addition ......................***Failed 8421.66 sec +599/615 Test #320: cfloat_fff_multiplication ................ Passed 8647.37 sec +600/615 Test #351: cfloat_tft_multiplication ................***Failed 8921.45 sec +601/615 Test #325: cfloat_tff_multiplication ................***Failed 8923.03 sec +602/615 Test #352: cfloat_tft_subtraction ...................***Failed 9431.45 sec +603/615 Test #327: cfloat_tff_subtraction ...................***Failed 9533.35 sec +604/615 Test #348: cfloat_fft_subtraction ................... Passed 10169.43 sec +605/615 Test #322: cfloat_fff_subtraction ................... Passed 10215.49 sec +Test project /home/theo/stillwater/universal/build_gcc + Start 1: multifile + Start 2: bitblock_arithmetic + Start 3: bitblock_logic + Start 4: bitblock_multi_word + Start 5: gfp_api + Start 6: f2s_api + Start 7: value_api + Start 8: value_arithmetic_add + Start 9: value_performance + Start 10: bd_api + Start 11: bd_constexpr + Start 12: bb_api + Start 13: bb_constexpr + Start 14: bb_conversion + Start 15: bb_rounding + Start 16: bb_logic + Start 17: bb_shift_left + Start 18: bb_shift_right + Start 19: bb_addition + Start 20: bb_division + Start 21: bb_multiplication + Start 22: bb_remainder + Start 23: bb_subtraction + Start 24: bb_urmul + Start 25: bb_performance + Start 26: bf_api + Start 27: bf_conversion + Start 28: bf_multiplication + Start 29: bf_performance + Start 30: bs_api + Start 31: bs_constexpr + Start 32: bs_conversion + Start 33: bs_addition + Start 34: bs_division + Start 35: bs_multiplication + Start 36: bs_rounding + Start 37: bs_subtraction + Start 38: bs_performance + Start 39: bt_api + Start 40: bt_constexpr + Start 41: bt_logic + Start 42: bt_conversion + Start 43: bt_decimal + Start 44: bt_rounding + Start 45: bt_tables + Start 46: bt_addition + Start 47: bt_algo + Start 48: bt_division + Start 49: bt_multiplication + Start 50: bt_single_precision + Start 51: bt_performance + Start 52: native_float_bit_manipulation + Start 53: native_float_fractionviz + Start 54: native_float_ieee754 + Start 55: native_float_manipulators + Start 56: native_float_mathlib + Start 57: native_float_representable + Start 58: native_int_bit_manipulation + Start 59: eint_api + Start 60: eint_exceptions + Start 61: eint_comparison + Start 62: eint_assignment + Start 63: eint_addition + Start 64: eint_division + Start 65: eint_multiplication + Start 66: eint_subtraction + Start 67: eint_factorial + Start 68: eint_performance + Start 69: edec_api + Start 70: edec_exceptions + Start 71: edec_assignment + Start 72: edec_comparison + Start 73: edec_addition + Start 74: edec_division + Start 75: edec_multiplication + Start 76: edec_subtraction + Start 77: edec_factorial + Start 78: edec_performance + Start 79: ebinratio_api + Start 80: erat_api + Start 81: erat_exceptions + Start 82: erat_logic + Start 83: erat_addition + Start 84: erat_division + Start 85: erat_multiplication + Start 86: erat_subtraction + Start 87: erat_sqrt + Start 88: efloat_add + Start 89: eposit_add + Start 90: bint_api + Start 91: bint_exceptions + Start 92: bint_misc + Start 93: bint_conversion + Start 94: bint_bit_manipulation + Start 95: bint_logic + Start 96: bint_shift_left + Start 97: bint_shift_right + Start 98: bint_addition + Start 99: bint_division + Start 100: bint_multiplication + Start 101: bint_remainder + Start 102: bint_subtraction + Start 103: bint_gcd_lcm + Start 104: bint_sqrt + Start 105: bint_perf + Start 106: decimal_api + Start 107: fixpnt_api + Start 108: fixpnt_assignment + Start 109: fixpnt_attributes + Start 110: fixpnt_complex_api + Start 111: fixpnt_constexpr + Start 112: fixpnt_exceptions + Start 113: fixpnt_mod_conversion + Start 114: fixpnt_mod_subnormal_conversion + Start 115: fixpnt_sat_conversion + Start 116: fixpnt_sat_subnormal_conversion + Start 117: fixpnt_logic + Start 118: fixpnt_mod_addition + Start 119: fixpnt_mod_division + Start 120: fixpnt_mod_multiplication + Start 121: fixpnt_mod_subtraction + Start 122: fixpnt_sat_addition + Start 123: fixpnt_sat_division + Start 124: fixpnt_sat_multiplication + Start 125: fixpnt_sat_subtraction + Start 126: fixpnt_mod_complex_add + Start 127: fixpnt_mod_complex_mul + Start 128: fixpnt_mod_complex_sub + Start 129: fixpnt_classify + Start 130: fixpnt_complex + Start 131: fixpnt_exponent + Start 132: fixpnt_hyperbolic + Start 133: fixpnt_logarithm + Start 134: fixpnt_pow + Start 135: fixpnt_trigonometry + Start 136: fixpnt_truncate + Start 137: deci_api + Start 138: lns_api + Start 139: lns_attributes + Start 140: lns_exceptions + Start 141: lns_ulp + Start 142: lns_assignment + Start 143: lns_conversion + Start 144: lns_addition + Start 145: lns_behavior + Start 146: lns_division + Start 147: lns_multiplication + Start 148: lns_subtraction + Start 149: lns_logic + Start 150: lns_classify + Start 151: lns_exponent + Start 152: lns_fractional + Start 153: lns_hyperbolic + Start 154: lns_hypotenuse + Start 155: lns_logarithm + Start 156: lns_next + Start 157: lns_pow + Start 158: lns_trigonometry + Start 159: lns_truncate + Start 160: lns_performance + Start 161: dbns_api + Start 162: dbns_attributes + Start 163: dbns_lns_comparison + Start 164: dbns_table + Start 165: dbns_assignment + Start 166: dbns_conversion + Start 167: dbns_rounding + Start 168: dbns_addition + Start 169: dbns_behavior + Start 170: dbns_division + Start 171: dbns_multiplication + Start 172: dbns_subtraction + Start 173: sorn_api + Start 174: sorn_addition + Start 175: sorn_division + Start 176: sorn_multiplication + Start 177: sorn_subtraction + Start 178: unum1_api + Start 179: unum1_construct + Start 180: unum2_api + Start 181: unum2_construct + Start 182: posit_api + Start 183: posit_casting + Start 184: posit_constexpr_test + Start 185: posit_decode + Start 186: posit_number_traits + Start 187: posit_postfix + Start 188: posit_prefix + Start 189: posit_quire_accumulation + Start 190: posit_reciprocal_tables + Start 191: posit_serialization + Start 192: posit_ulp + Start 193: posit_assignment + Start 194: posit_conversion + Start 195: posit_logic + Start 196: posit_addition + Start 197: posit_complex_add + Start 198: posit_decrement + Start 199: posit_division + Start 200: posit_fma + Start 201: posit_increment + Start 202: posit_literals + Start 203: posit_multiplication + Start 204: posit_negation + Start 205: posit_reciprocation + Start 206: posit_sqrt + Start 207: posit_subtraction + Start 208: posit_classify + Start 209: posit_complex + Start 210: posit_exponent + Start 211: posit_hyperbolic + Start 212: posit_hypotenuse + Start 213: posit_logarithm + Start 214: posit_next + Start 215: posit_pow + Start 216: posit_trigonometry + Start 217: posit_truncate + Start 218: fast_posit_128_2 + Start 219: fast_posit_128_4 + Start 220: fast_posit_16_1 + Start 221: fast_posit_16_2 + Start 222: fast_posit_256_2 + Start 223: fast_posit_256_5 + Start 224: fast_posit_2_0 + Start 225: fast_posit_32_2 + Start 226: fast_posit_3_0 + Start 227: fast_posit_48_2 + Start 228: fast_posit_4_0 + Start 229: fast_posit_64_2 + Start 230: fast_posit_64_3 + Start 231: fast_posit_8_0 + Start 232: fast_posit_8_1 + Start 233: fast_posit_8_2 + Start 234: fast_quire_32_2 + Start 235: posit2_api + Start 236: posit2_attributes + Start 237: posit2_manipulators + Start 238: posit2_traits + Start 239: posit2_ulp + Start 240: posit2_addition + Start 241: posito_api + Start 242: posito_addition + Start 243: posito_division + Start 244: posito_multiplication + Start 245: posito_number_system + Start 246: posito_subtraction + Start 247: posito_assignment + Start 248: valid_api + Start 249: valid_exceptions + Start 250: valid_conversion + Start 251: valid_logic + Start 252: valid_addition + Start 253: valid_exponent + Start 254: areal_api + Start 255: areal_assignment + Start 256: areal_constexpr + 1/615 Test #1: multifile ................................ Passed 0.31 sec + Start 257: areal_exceptions + 2/615 Test #2: bitblock_arithmetic ...................... Passed 0.31 sec + Start 258: areal_special_cases + 3/615 Test #3: bitblock_logic ........................... Passed 0.31 sec + Start 259: areal_logic + 4/615 Test #4: bitblock_multi_word ...................... Passed 0.32 sec + Start 260: areal_double_conversion + 5/615 Test #5: gfp_api .................................. Passed 0.32 sec + Start 261: areal_float_conversion + 6/615 Test #6: f2s_api .................................. Passed 0.32 sec + Start 262: areal_sampling + 7/615 Test #7: value_api ................................ Passed 0.32 sec + Start 263: areal_addition + 8/615 Test #10: bd_api ................................... Passed 0.32 sec + Start 264: areal_double_precision + 9/615 Test #11: bd_constexpr ............................. Passed 0.32 sec + Start 265: areal_half_precision + 10/615 Test #12: bb_api ................................... Passed 0.32 sec + Start 266: areal_quad_precision + 11/615 Test #13: bb_constexpr ............................. Passed 0.32 sec + Start 267: areal_quarter_precision + 12/615 Test #14: bb_conversion ............................ Passed 0.33 sec + Start 268: areal_single_precision + 13/615 Test #15: bb_rounding .............................. Passed 0.33 sec + Start 269: bfloat16_api + 14/615 Test #16: bb_logic ................................. Passed 0.33 sec + Start 270: bfloat16_attributes + 15/615 Test #17: bb_shift_left ............................ Passed 0.33 sec + Start 271: bfloat16_traits + 16/615 Test #18: bb_shift_right ........................... Passed 0.33 sec + Start 272: bfloat16_addition + 17/615 Test #20: bb_division .............................. Passed 0.33 sec + Start 273: bfloat16_arithmetic + 18/615 Test #22: bb_remainder ............................. Passed 0.33 sec + Start 274: bfloat16_pow + 19/615 Test #23: bb_subtraction ........................... Passed 0.33 sec + Start 275: cfloat_api + 20/615 Test #24: bb_urmul ................................. Passed 0.34 sec + Start 276: cfloat_attributes + 21/615 Test #26: bf_api ................................... Passed 0.34 sec + Start 277: cfloat_constexpr + 22/615 Test #27: bf_conversion ............................ Passed 0.34 sec + Start 278: cfloat_dynamic_range + 23/615 Test #29: bf_performance ........................... Passed 0.34 sec + Start 279: cfloat_exceptions + 24/615 Test #30: bs_api ................................... Passed 0.34 sec + Start 280: cfloat_special_cases + 25/615 Test #31: bs_constexpr ............................. Passed 0.34 sec + Start 281: cfloat_subnormals + 26/615 Test #32: bs_conversion ............................ Passed 0.34 sec + Start 282: cfloat_traits + 27/615 Test #33: bs_addition .............................. Passed 0.35 sec + Start 283: cfloat_types + 28/615 Test #34: bs_division .............................. Passed 0.35 sec + Start 284: cfloat_ulp + 29/615 Test #36: bs_rounding .............................. Passed 0.35 sec + Start 285: cfloat_assignment + 30/615 Test #37: bs_subtraction ........................... Passed 0.35 sec + Start 286: cfloat_double_conversion + 31/615 Test #38: bs_performance ........................... Passed 0.35 sec + Start 287: cfloat_float_conversion + 32/615 Test #39: bt_api ................................... Passed 0.35 sec + Start 288: cfloat_ieee754_subnormals + 33/615 Test #40: bt_constexpr ............................. Passed 0.35 sec + Start 289: cfloat_normalization + 34/615 Test #41: bt_logic ................................. Passed 0.36 sec + Start 290: cfloat_decrement + 35/615 Test #42: bt_conversion ............................ Passed 0.36 sec + Start 291: cfloat_increment + 36/615 Test #43: bt_decimal ............................... Passed 0.36 sec + Start 292: cfloat_random_arithmetic + 37/615 Test #44: bt_rounding .............................. Passed 0.36 sec + Start 293: cfloat_sqrt_algorithm_reference + 38/615 Test #45: bt_tables ................................ Passed 0.36 sec + Start 294: cfloat_logic + 39/615 Test #46: bt_addition .............................. Passed 0.36 sec + Start 295: cfloat_amd_fp24 + 40/615 Test #47: bt_algo .................................. Passed 0.36 sec + Start 296: cfloat_bfloat16 + 41/615 Test #48: bt_division .............................. Passed 0.37 sec + Start 297: cfloat_pixar_pxr24 + 42/615 Test #49: bt_multiplication ........................ Passed 0.37 sec + Start 298: cfloat_tensorfloat + 43/615 Test #50: bt_single_precision ...................... Passed 0.37 sec + Start 299: cfloat_classify + 44/615 Test #52: native_float_bit_manipulation ............ Passed 0.37 sec + Start 300: cfloat_exponent + 45/615 Test #53: native_float_fractionviz ................. Passed 0.37 sec + Start 301: cfloat_fractional + 46/615 Test #54: native_float_ieee754 ..................... Passed 0.37 sec + Start 302: cfloat_hyperbolic + 47/615 Test #55: native_float_manipulators ................ Passed 0.37 sec + Start 303: cfloat_hypotenuse + 48/615 Test #56: native_float_mathlib ..................... Passed 0.37 sec + Start 304: cfloat_logarithm + 49/615 Test #57: native_float_representable ............... Passed 0.37 sec + Start 305: cfloat_next + 50/615 Test #58: native_int_bit_manipulation .............. Passed 0.37 sec + Start 306: cfloat_pow + 51/615 Test #59: eint_api ................................. Passed 0.37 sec + Start 307: cfloat_trigonometry + 52/615 Test #60: eint_exceptions .......................... Passed 0.37 sec + Start 308: cfloat_truncate + 53/615 Test #61: eint_comparison .......................... Passed 0.38 sec + Start 309: cfloat_perf + 54/615 Test #62: eint_assignment .......................... Passed 0.38 sec + Start 310: cfloat_fff_from_blocktriple + 55/615 Test #63: eint_addition ............................ Passed 0.38 sec + Start 311: cfloat_fff_to_blocktriple + 56/615 Test #65: eint_multiplication ...................... Passed 0.38 sec + Start 312: cfloat_tff_from_blocktriple + 57/615 Test #67: eint_factorial ........................... Passed 0.38 sec + Start 313: cfloat_tff_to_blocktriple + 58/615 Test #68: eint_performance ......................... Passed 0.38 sec + Start 314: cfloat_ftf_to_blocktriple + 59/615 Test #69: edec_api ................................. Passed 0.38 sec + Start 315: cfloat_ttf_from_blocktriple + 60/615 Test #70: edec_exceptions .......................... Passed 0.38 sec + Start 316: cfloat_ttf_to_blocktriple + 61/615 Test #71: edec_assignment .......................... Passed 0.38 sec + Start 317: cfloat_fff_addition + 62/615 Test #72: edec_comparison .......................... Passed 0.38 sec + Start 318: cfloat_fff_division + 63/615 Test #77: edec_factorial ........................... Passed 0.38 sec + Start 319: cfloat_fff_fma + 64/615 Test #78: edec_performance ......................... Passed 0.38 sec + Start 320: cfloat_fff_multiplication + 65/615 Test #79: ebinratio_api ............................ Passed 0.38 sec + Start 321: cfloat_fff_sqrt + 66/615 Test #80: erat_api ................................. Passed 0.38 sec + Start 322: cfloat_fff_subtraction + 67/615 Test #81: erat_exceptions .......................... Passed 0.38 sec + Start 323: cfloat_tff_addition + 68/615 Test #82: erat_logic ............................... Passed 0.38 sec + Start 324: cfloat_tff_division + 69/615 Test #83: erat_addition ............................ Passed 0.39 sec + Start 325: cfloat_tff_multiplication + 70/615 Test #84: erat_division ............................ Passed 0.39 sec + Start 326: cfloat_tff_sqrt + 71/615 Test #85: erat_multiplication ...................... Passed 0.39 sec + Start 327: cfloat_tff_subtraction + 72/615 Test #86: erat_subtraction ......................... Passed 0.39 sec + Start 328: cfloat_ftf_addition + 73/615 Test #87: erat_sqrt ................................ Passed 0.39 sec + Start 329: cfloat_ftf_division + 74/615 Test #88: efloat_add ............................... Passed 0.39 sec + Start 330: cfloat_ftf_multiplication + 75/615 Test #89: eposit_add ............................... Passed 0.39 sec + Start 331: cfloat_ftf_sqrt + 76/615 Test #90: bint_api ................................. Passed 0.39 sec + Start 332: cfloat_ftf_subtraction + 77/615 Test #91: bint_exceptions .......................... Passed 0.39 sec + Start 333: cfloat_ttf_addition + 78/615 Test #92: bint_misc ................................ Passed 0.40 sec + Start 334: cfloat_ttf_division + 79/615 Test #93: bint_conversion .......................... Passed 0.40 sec + Start 335: cfloat_ttf_multiplication + 80/615 Test #94: bint_bit_manipulation .................... Passed 0.40 sec + Start 336: cfloat_ttf_sqrt + 81/615 Test #97: bint_shift_right ......................... Passed 0.40 sec + Start 337: cfloat_ttf_subtraction + 82/615 Test #103: bint_gcd_lcm ............................. Passed 0.39 sec + Start 338: cfloat_fft_from_blocktriple + 83/615 Test #106: decimal_api .............................. Passed 0.39 sec + Start 339: cfloat_fft_to_blocktriple + 84/615 Test #107: fixpnt_api ............................... Passed 0.39 sec + Start 340: cfloat_tft_from_blocktriple + 85/615 Test #108: fixpnt_assignment ........................ Passed 0.39 sec + Start 341: cfloat_tft_to_blocktriple + 86/615 Test #109: fixpnt_attributes ........................ Passed 0.39 sec + Start 342: cfloat_ftt_to_blocktriple + 87/615 Test #110: fixpnt_complex_api ....................... Passed 0.39 sec + Start 343: cfloat_ttt_from_blocktriple + 88/615 Test #111: fixpnt_constexpr ......................... Passed 0.40 sec + Start 344: cfloat_ttt_to_blocktriple + 89/615 Test #112: fixpnt_exceptions ........................ Passed 0.40 sec + Start 345: cfloat_fft_addition + 90/615 Test #114: fixpnt_mod_subnormal_conversion .......... Passed 0.40 sec + Start 346: cfloat_fft_division + 91/615 Test #116: fixpnt_sat_subnormal_conversion .......... Passed 0.40 sec + Start 347: cfloat_fft_multiplication + 92/615 Test #123: fixpnt_sat_division ...................... Passed 0.39 sec + Start 348: cfloat_fft_subtraction + 93/615 Test #129: fixpnt_classify .......................... Passed 0.39 sec + Start 349: cfloat_tft_addition + 94/615 Test #130: fixpnt_complex ........................... Passed 0.39 sec + Start 350: cfloat_tft_division + 95/615 Test #132: fixpnt_hyperbolic ........................ Passed 0.39 sec + Start 351: cfloat_tft_multiplication + 96/615 Test #134: fixpnt_pow ............................... Passed 0.39 sec + Start 352: cfloat_tft_subtraction + 97/615 Test #135: fixpnt_trigonometry ...................... Passed 0.39 sec + Start 353: cfloat_ftt_addition + 98/615 Test #137: deci_api ................................. Passed 0.39 sec + Start 354: cfloat_ftt_division + 99/615 Test #138: lns_api .................................. Passed 0.39 sec + Start 355: cfloat_ftt_multiplication +100/615 Test #139: lns_attributes ........................... Passed 0.39 sec + Start 356: cfloat_ftt_subtraction +101/615 Test #140: lns_exceptions ........................... Passed 0.39 sec + Start 357: cfloat_ttt_addition +102/615 Test #141: lns_ulp .................................. Passed 0.39 sec + Start 358: cfloat_ttt_division +103/615 Test #142: lns_assignment ........................... Passed 0.39 sec + Start 359: cfloat_ttt_multiplication +104/615 Test #145: lns_behavior ............................. Passed 0.39 sec + Start 360: cfloat_ttt_subtraction +105/615 Test #149: lns_logic ................................ Passed 0.39 sec + Start 361: dfloat_api +106/615 Test #150: lns_classify ............................. Passed 0.39 sec + Start 362: conversions_rounding +107/615 Test #152: lns_fractional ........................... Passed 0.39 sec + Start 363: conversions_to_decimal +108/615 Test #153: lns_hyperbolic ........................... Passed 0.39 sec + Start 364: conversions_to_integer +109/615 Test #155: lns_logarithm ............................ Passed 0.39 sec + Start 365: conversions_to_posit +110/615 Test #156: lns_next ................................. Passed 0.39 sec + Start 366: conversions_to_string +111/615 Test #157: lns_pow .................................. Passed 0.40 sec + Start 367: mp_secant +112/615 Test #159: lns_truncate ............................. Passed 0.40 sec + Start 368: mp_taylor +113/615 Test #161: dbns_api ................................. Passed 0.40 sec + Start 369: mp_simpson +114/615 Test #162: dbns_attributes .......................... Passed 0.40 sec + Start 370: mp_trapezoidal +115/615 Test #163: dbns_lns_comparison ...................... Passed 0.40 sec + Start 371: mp_spline +116/615 Test #164: dbns_table ............................... Passed 0.40 sec + Start 372: optimal_secant +117/615 Test #165: dbns_assignment .......................... Passed 0.40 sec + Start 373: mp_cg +118/615 Test #166: dbns_conversion .......................... Passed 0.40 sec + Start 374: mp_cg_mvdot_cmpdot +119/615 Test #167: dbns_rounding ............................ Passed 0.40 sec + Start 375: mp_cg_mvdot_cmpfdp +120/615 Test #168: dbns_addition ............................ Passed 0.40 sec + Start 376: mp_cg_mvfdp_cmpdot +121/615 Test #169: dbns_behavior ............................ Passed 0.41 sec + Start 377: mp_cg_mvfdp_cmpfdp +122/615 Test #173: sorn_api ................................. Passed 0.40 sec + Start 378: mp_inference +123/615 Test #174: sorn_addition ............................ Passed 0.41 sec + Start 379: error_sampling +124/615 Test #175: sorn_division ............................ Passed 0.41 sec + Start 380: error_scaling +125/615 Test #176: sorn_multiplication ...................... Passed 0.41 sec + Start 381: quantization_qsnr +126/615 Test #177: sorn_subtraction ......................... Passed 0.41 sec + Start 382: error_dot +127/615 Test #178: unum1_api ................................ Passed 0.41 sec + Start 383: accuracy_dot +128/615 Test #179: unum1_construct .......................... Passed 0.41 sec + Start 384: accuracy_gemm +129/615 Test #180: unum2_api ................................ Passed 0.41 sec + Start 385: accuracy_matvec +130/615 Test #181: unum2_construct .......................... Passed 0.41 sec + Start 386: accuracy_mpdot +131/615 Test #182: posit_api ................................ Passed 0.42 sec + Start 387: accuracy_mpfma +132/615 Test #183: posit_casting ............................ Passed 0.42 sec + Start 388: range_dot +133/615 Test #184: posit_constexpr_test ..................... Passed 0.42 sec + Start 389: range_gemm +134/615 Test #185: posit_decode ............................. Passed 0.42 sec + Start 390: range_matvec +135/615 Test #186: posit_number_traits ...................... Passed 0.42 sec + Start 391: range_floating-point +136/615 Test #187: posit_postfix ............................ Passed 0.42 sec + Start 392: reproducibility_dot +137/615 Test #188: posit_prefix ............................. Passed 0.42 sec + Start 393: reproducibility_gemm +138/615 Test #189: posit_quire_accumulation ................. Passed 0.42 sec + Start 394: reproducibility_matvec +139/615 Test #190: posit_reciprocal_tables .................. Passed 0.42 sec + Start 395: performance_dot +140/615 Test #191: posit_serialization ...................... Passed 0.42 sec + Start 396: performance_gemm +141/615 Test #192: posit_ulp ................................ Passed 0.42 sec + Start 397: performance_matvec +142/615 Test #193: posit_assignment ......................... Passed 0.43 sec + Start 398: benchmark_areal_performance +143/615 Test #200: posit_fma ................................ Passed 0.42 sec + Start 399: benchmark_cfloat_performance +144/615 Test #208: posit_classify ........................... Passed 0.41 sec + Start 400: benchmark_compare_performance +145/615 Test #209: posit_complex ............................ Passed 0.41 sec + Start 401: benchmark_decimal_performance +146/615 Test #212: posit_hypotenuse ......................... Passed 0.41 sec + Start 402: benchmark_fixpnt_performance +147/615 Test #213: posit_logarithm .......................... Passed 0.41 sec + Start 403: benchmark_integer_performance +148/615 Test #214: posit_next ............................... Passed 0.41 sec + Start 404: benchmark_lns_performance +149/615 Test #217: posit_truncate ........................... Passed 0.41 sec + Start 405: benchmark_native_performance +150/615 Test #224: fast_posit_2_0 ........................... Passed 0.41 sec + Start 406: benchmark_posit_10b_posit +151/615 Test #226: fast_posit_3_0 ........................... Passed 0.41 sec + Start 407: benchmark_posit_12b_posit +152/615 Test #228: fast_posit_4_0 ........................... Passed 0.41 sec + Start 408: benchmark_posit_14b_posit +153/615 Test #233: fast_posit_8_2 ........................... Passed 0.40 sec + Start 409: benchmark_posit_16b_posit +154/615 Test #235: posit2_api ............................... Passed 0.40 sec + Start 410: benchmark_posit_32b_posit +155/615 Test #236: posit2_attributes ........................ Passed 0.40 sec + Start 411: benchmark_posit_48b_posit +156/615 Test #237: posit2_manipulators ...................... Passed 0.41 sec + Start 412: benchmark_posit_4b_posit +157/615 Test #238: posit2_traits ............................ Passed 0.41 sec + Start 413: benchmark_posit_64b_posit +158/615 Test #239: posit2_ulp ............................... Passed 0.41 sec + Start 414: benchmark_posit_8b_posit +159/615 Test #241: posito_api ............................... Passed 0.41 sec + Start 415: benchmark_unum_performance +160/615 Test #248: valid_api ................................ Passed 0.40 sec + Start 416: benchmark_valid_performance +161/615 Test #249: valid_exceptions ......................... Passed 0.40 sec + Start 417: energy_dot +162/615 Test #250: valid_conversion ......................... Passed 0.40 sec + Start 418: energy_gemm +163/615 Test #251: valid_logic .............................. Passed 0.40 sec + Start 419: energy_matvec +164/615 Test #252: valid_addition ........................... Passed 0.41 sec + Start 420: areal +165/615 Test #254: areal_api ................................ Passed 0.40 sec + Start 421: cfloat8_2 +166/615 Test #64: eint_division ............................ Passed 0.64 sec + Start 422: cfloat8_3 +167/615 Test #66: eint_subtraction ......................... Passed 0.64 sec + Start 423: cfloat8_4 +168/615 Test #104: bint_sqrt ................................ Passed 0.60 sec + Start 424: double +169/615 Test #131: fixpnt_exponent .......................... Passed 0.57 sec + Start 425: fixpnt +170/615 Test #133: fixpnt_logarithm ......................... Passed 0.57 sec + Start 426: float2posit +171/615 Test #136: fixpnt_truncate .......................... Passed 0.57 sec + Start 427: half +172/615 Test #172: dbns_subtraction ......................... Passed 0.53 sec + Start 428: ieee +173/615 Test #194: posit_conversion .........................***Failed 0.50 sec + Start 429: lns +174/615 Test #195: posit_logic .............................. Passed 0.51 sec + Start 430: longdouble +175/615 Test #206: posit_sqrt ............................... Passed 0.50 sec + Start 431: plimits +176/615 Test #210: posit_exponent ........................... Passed 0.49 sec + Start 432: posit +177/615 Test #211: posit_hyperbolic ......................... Passed 0.50 sec + Start 433: propenv +178/615 Test #215: posit_pow ................................ Passed 0.49 sec + Start 434: propp +179/615 Test #216: posit_trigonometry ....................... Passed 0.49 sec + Start 435: propq +180/615 Test #218: fast_posit_128_2 ......................... Passed 0.49 sec + Start 436: quad +181/615 Test #219: fast_posit_128_4 ......................... Passed 0.49 sec + Start 437: quarter +182/615 Test #227: fast_posit_48_2 .......................... Passed 0.49 sec + Start 438: signedint +183/615 Test #229: fast_posit_64_2 .......................... Passed 0.49 sec + Start 439: single +184/615 Test #230: fast_posit_64_3 .......................... Passed 0.49 sec + Start 440: unsignedint +185/615 Test #231: fast_posit_8_0 ........................... Passed 0.49 sec + Start 441: execution_environment +186/615 Test #232: fast_posit_8_1 ........................... Passed 0.49 sec + Start 442: edu_integer_basic_operators +187/615 Test #243: posito_division .......................... Passed 0.48 sec + Start 443: edu_fixpnt_basic_operators +188/615 Test #244: posito_multiplication ....................***Failed 0.48 sec + Start 444: edu_areal_basic_operators +189/615 Test #245: posito_number_system ..................... Passed 0.48 sec + Start 445: edu_bfloat_basic_operators +190/615 Test #247: posito_assignment ........................ Passed 0.48 sec + Start 446: edu_unum_basic_operators +191/615 Test #255: areal_assignment ......................... Passed 0.47 sec + Start 447: edu_posit_basic_operators +192/615 Test #256: areal_constexpr .......................... Passed 0.47 sec + Start 448: edu_posit_components +193/615 Test #253: valid_exponent ........................... Passed 0.48 sec + Start 449: edu_posit_conversion +194/615 Test #257: areal_exceptions ......................... Passed 0.46 sec + Start 450: edu_posit_discretization_curves +195/615 Test #258: areal_special_cases ...................... Passed 0.46 sec + Start 451: edu_posit_enumeration +196/615 Test #260: areal_double_conversion .................. Passed 0.46 sec + Start 452: edu_posit_exceptions +197/615 Test #261: areal_float_conversion ................... Passed 0.46 sec + Start 453: edu_posit_exponents +198/615 Test #262: areal_sampling ........................... Passed 0.45 sec + Start 454: edu_posit_extract +199/615 Test #263: areal_addition ........................... Passed 0.45 sec + Start 455: edu_posit_fractions +200/615 Test #264: areal_double_precision ................... Passed 0.45 sec + Start 456: edu_posit_raw_bit_patterns +201/615 Test #265: areal_half_precision ..................... Passed 0.45 sec + Start 457: edu_posit_regimes +202/615 Test #266: areal_quad_precision ..................... Passed 0.45 sec + Start 458: edu_posit_serialization +203/615 Test #267: areal_quarter_precision .................. Passed 0.45 sec + Start 459: edu_posit_signalling_nar +204/615 Test #268: areal_single_precision ................... Passed 0.45 sec + Start 460: edu_posit_ulp +205/615 Test #270: bfloat16_attributes ...................... Passed 0.45 sec + Start 461: edu_posit_values +206/615 Test #271: bfloat16_traits .......................... Passed 0.45 sec + Start 462: edu_valid_intervals +207/615 Test #272: bfloat16_addition ........................ Passed 0.45 sec + Start 463: edu_lns_basic_operators +208/615 Test #273: bfloat16_arithmetic ...................... Passed 0.45 sec + Start 464: edu_tables_areals +209/615 Test #274: bfloat16_pow ............................. Passed 0.45 sec + Start 465: edu_tables_cfloats +210/615 Test #275: cfloat_api ............................... Passed 0.45 sec + Start 466: edu_tables_fixpnts +211/615 Test #276: cfloat_attributes ........................ Passed 0.45 sec + Start 467: edu_tables_lns +212/615 Test #277: cfloat_constexpr ......................... Passed 0.45 sec + Start 468: edu_tables_posits +213/615 Test #278: cfloat_dynamic_range ..................... Passed 0.45 sec + Start 469: edu_ranges_cfloat +214/615 Test #279: cfloat_exceptions ........................ Passed 0.45 sec + Start 470: edu_ranges_fixpnt +215/615 Test #280: cfloat_special_cases ..................... Passed 0.45 sec + Start 471: edu_ranges_lns +216/615 Test #282: cfloat_traits ............................ Passed 0.45 sec + Start 472: edu_ranges_posit +217/615 Test #283: cfloat_types ............................. Passed 0.45 sec + Start 473: edu_quire_quires +218/615 Test #284: cfloat_ulp ............................... Passed 0.45 sec + Start 474: playground_efunc_posits +219/615 Test #286: cfloat_double_conversion ................. Passed 0.44 sec + Start 475: playground_efunc_valids +220/615 Test #288: cfloat_ieee754_subnormals ................ Passed 0.44 sec + Start 476: playground_gismo_test +221/615 Test #289: cfloat_normalization ..................... Passed 0.44 sec + Start 477: playground_meta_programming +222/615 Test #290: cfloat_decrement ......................... Passed 0.44 sec + Start 478: playground_serialization +223/615 Test #291: cfloat_increment ......................... Passed 0.44 sec + Start 479: playground_skeleton +224/615 Test #292: cfloat_random_arithmetic ................. Passed 0.44 sec + Start 480: playground_type_test +225/615 Test #293: cfloat_sqrt_algorithm_reference .......... Passed 0.44 sec + Start 481: engineering_chem_equilibrium +226/615 Test #295: cfloat_amd_fp24 .......................... Passed 0.44 sec + Start 482: engineering_water +227/615 Test #296: cfloat_bfloat16 .......................... Passed 0.44 sec + Start 483: ode_convergence +228/615 Test #297: cfloat_pixar_pxr24 ....................... Passed 0.44 sec + Start 484: ode_first_order_ode +229/615 Test #298: cfloat_tensorfloat ....................... Passed 0.44 sec + Start 485: ode_general_runge_kutta +230/615 Test #299: cfloat_classify .......................... Passed 0.44 sec + Start 486: ode_runge_kutta4 +231/615 Test #300: cfloat_exponent .......................... Passed 0.44 sec + Start 487: opt_error_vs_cost +232/615 Test #301: cfloat_fractional ........................ Passed 0.44 sec + Start 488: pde_cg +233/615 Test #302: cfloat_hyperbolic ........................ Passed 0.44 sec + Start 489: pde_gauss_seidel +234/615 Test #303: cfloat_hypotenuse ........................ Passed 0.44 sec + Start 490: pde_jacobi +235/615 Test #304: cfloat_logarithm ......................... Passed 0.44 sec + Start 491: pde_laplace +236/615 Test #305: cfloat_next .............................. Passed 0.44 sec + Start 492: pde_sor +237/615 Test #306: cfloat_pow ............................... Passed 0.44 sec + Start 493: roots_bisection +238/615 Test #307: cfloat_trigonometry ...................... Passed 0.44 sec + Start 494: roots_rpoly_ak1 +239/615 Test #308: cfloat_truncate .......................... Passed 0.44 sec + Start 495: science_iso_constants +240/615 Test #310: cfloat_fff_from_blocktriple .............. Passed 0.44 sec + Start 496: science_physics_constants +241/615 Test #311: cfloat_fff_to_blocktriple ................ Passed 0.44 sec + Start 497: approx_taylor_series +242/615 Test #319: cfloat_fff_fma ........................... Passed 0.42 sec + Start 498: cheby_chebtests +243/615 Test #321: cfloat_fff_sqrt .......................... Passed 0.42 sec + Start 499: cheby_lambdas +244/615 Test #326: cfloat_tff_sqrt .......................... Passed 0.41 sec + Start 500: cheby_nodes +245/615 Test #331: cfloat_ftf_sqrt .......................... Passed 0.40 sec + Start 501: cheby_playground +246/615 Test #336: cfloat_ttf_sqrt .......................... Passed 0.39 sec + Start 502: cheby_skeleton +247/615 Test #338: cfloat_fft_from_blocktriple .............. Passed 0.39 sec + Start 503: dnn_fit_sin +248/615 Test #340: cfloat_tft_from_blocktriple .............. Passed 0.39 sec + Start 504: dnn_mnist +249/615 Test #345: cfloat_fft_addition ...................... Passed 0.38 sec + Start 505: dnn_schedules +250/615 Test #347: cfloat_fft_multiplication ................ Passed 0.38 sec + Start 506: dsp_adc_mapping +251/615 Test #349: cfloat_tft_addition ...................... Passed 0.38 sec + Start 507: dsp_fir_filter +252/615 Test #353: cfloat_ftt_addition ...................... Passed 0.37 sec + Start 508: chaos_bakers_map +253/615 Test #357: cfloat_ttt_addition ...................... Passed 0.36 sec + Start 509: chaos_time_precision_lyapunov +254/615 Test #359: cfloat_ttt_multiplication ................ Passed 0.36 sec + Start 510: complex_compute +255/615 Test #360: cfloat_ttt_subtraction ................... Passed 0.36 sec + Start 511: mem_stream +256/615 Test #361: dfloat_api ............................... Passed 0.36 sec + Start 512: weather_error_growth_atmospheric_model +257/615 Test #362: conversions_rounding ..................... Passed 0.36 sec + Start 513: adaptive_euler +258/615 Test #363: conversions_to_decimal ................... Passed 0.36 sec + Start 514: adaptive_phi +259/615 Test #364: conversions_to_integer ................... Passed 0.36 sec + Start 515: adaptive_pi +260/615 Test #365: conversions_to_posit ..................... Passed 0.36 sec + Start 516: fp_catastrophic_cancellation +261/615 Test #366: conversions_to_string .................... Passed 0.36 sec + Start 517: fp_contract_expand +262/615 Test #367: mp_secant ................................ Passed 0.36 sec + Start 518: fp_exponentiation +263/615 Test #368: mp_taylor ................................ Passed 0.36 sec + Start 519: fp_integer_cover +264/615 Test #369: mp_simpson ............................... Passed 0.36 sec + Start 520: fp_kahan_sum +265/615 Test #370: mp_trapezoidal ........................... Passed 0.36 sec + Start 521: fp_linear_cover +266/615 Test #371: mp_spline ................................ Passed 0.36 sec + Start 522: fp_precision +267/615 Test #372: optimal_secant ........................... Passed 0.36 sec + Start 523: fp_printing +268/615 Test #373: mp_cg .................................... Passed 0.36 sec + Start 524: fp_rounding_error_addition +269/615 Test #378: mp_inference ............................. Passed 0.35 sec + Start 525: fp_rounding_error_multiplication +270/615 Test #379: error_sampling ........................... Passed 0.35 sec + Start 526: fp_sterbenz_lemma +271/615 Test #380: error_scaling ............................ Passed 0.35 sec + Start 527: fp_sum_of_integers +272/615 Test #381: quantization_qsnr ........................ Passed 0.35 sec + Start 528: fp_thin_triangle +273/615 Test #383: accuracy_dot ............................. Passed 0.35 sec + Start 529: fp_two_sum +274/615 Test #384: accuracy_gemm ............................ Passed 0.35 sec + Start 530: fp_underflow +275/615 Test #385: accuracy_matvec .......................... Passed 0.35 sec + Start 531: math_decimal_lpp +276/615 Test #386: accuracy_mpdot ........................... Passed 0.35 sec + Start 532: math_distinct_powers +277/615 Test #387: accuracy_mpfma ........................... Passed 0.35 sec + Start 533: math_irrational_powers +278/615 Test #388: range_dot ................................ Passed 0.35 sec + Start 534: math_largest_palindrome_product +279/615 Test #389: range_gemm ............................... Passed 0.35 sec + Start 535: math_numbers_irrational +280/615 Test #390: range_matvec ............................. Passed 0.35 sec + Start 536: math_numbers_rational +281/615 Test #391: range_floating-point ..................... Passed 0.35 sec + Start 537: math_pascals_triangle +282/615 Test #392: reproducibility_dot ...................... Passed 0.35 sec + Start 538: math_primes +283/615 Test #393: reproducibility_gemm ..................... Passed 0.35 sec + Start 539: math_sincospi +284/615 Test #394: reproducibility_matvec ................... Passed 0.35 sec + Start 540: math_stirlings_approximation +285/615 Test #395: performance_dot .......................... Passed 0.35 sec + Start 541: numeric_constants +286/615 Test #396: performance_gemm ......................... Passed 0.35 sec + Start 542: numeric_doubledouble +287/615 Test #397: performance_matvec ....................... Passed 0.35 sec + Start 543: numeric_luir +288/615 Test #398: benchmark_areal_performance .............. Passed 0.35 sec + Start 544: numeric_midpoint +289/615 Test #401: benchmark_decimal_performance ............ Passed 0.35 sec + Start 545: numeric_numbers +290/615 Test #402: benchmark_fixpnt_performance ............. Passed 0.35 sec + Start 546: numeric_posit_list +291/615 Test #403: benchmark_integer_performance ............ Passed 0.35 sec + Start 547: numeric_posit_properties +292/615 Test #409: benchmark_posit_16b_posit ................ Passed 0.34 sec + Start 548: numeric_priest +293/615 Test #410: benchmark_posit_32b_posit ................ Passed 0.34 sec + Start 549: numeric_quadratic +294/615 Test #412: benchmark_posit_4b_posit ................. Passed 0.34 sec + Start 550: numeric_residual +295/615 Test #414: benchmark_posit_8b_posit ................. Passed 0.34 sec + Start 551: numeric_rump_equation +296/615 Test #415: benchmark_unum_performance ............... Passed 0.34 sec + Start 552: numeric_solvetest +297/615 Test #416: benchmark_valid_performance .............. Passed 0.34 sec + Start 553: numeric_traits +298/615 Test #417: energy_dot ............................... Passed 0.34 sec + Start 554: numeric_ulp_math +299/615 Test #418: energy_gemm .............................. Passed 0.34 sec + Start 555: blas_hilbert +300/615 Test #419: energy_matvec ............................ Passed 0.34 sec + Start 556: blas_inverse +301/615 Test #420: areal .................................... Passed 0.34 sec + Start 557: blas_l1_fused_dot +302/615 Test #421: cfloat8_2 ................................ Passed 0.34 sec + Start 558: blas_l2_fused_mv +303/615 Test #151: lns_exponent ............................. Passed 0.88 sec + Start 559: blas_l3_fused_mm +304/615 Test #170: dbns_division ............................ Passed 0.87 sec + Start 560: blas_lu +305/615 Test #198: posit_decrement .......................... Passed 0.84 sec + Start 561: blas_norms +306/615 Test #201: posit_increment .......................... Passed 0.83 sec + Start 562: blas_randsvd +307/615 Test #269: bfloat16_api ............................. Passed 0.72 sec + Start 563: crypto_fermat +308/615 Test #281: cfloat_subnormals ........................ Passed 0.69 sec + Start 564: crypto_large_lcm +309/615 Test #287: cfloat_float_conversion .................. Passed 0.68 sec + Start 565: crypto_pollard_rho +310/615 Test #406: benchmark_posit_10b_posit ................ Passed 0.41 sec + Start 566: crypto_quadratic_sieve +311/615 Test #407: benchmark_posit_12b_posit ................ Passed 0.41 sec + Start 567: sequences_fibonacci +312/615 Test #408: benchmark_posit_14b_posit ................ Passed 0.41 sec + Start 568: sequences_tribonacci +313/615 Test #422: cfloat8_3 ................................ Passed 0.38 sec + Start 569: stl_sequential_containers +314/615 Test #423: cfloat8_4 ................................ Passed 0.38 sec + Start 570: faithful_accurate_sum_and_dot +315/615 Test #424: double ................................... Passed 0.37 sec + Start 571: faithful_arithmetic +316/615 Test #425: fixpnt ................................... Passed 0.37 sec + Start 572: ieee754_quire_accumulation +317/615 Test #426: float2posit .............................. Passed 0.37 sec + Start 573: ieee754_quires +318/615 Test #427: half ..................................... Passed 0.37 sec + Start 574: utils_lookup_arithmetic +319/615 Test #428: ieee ..................................... Passed 0.37 sec + Start 575: utils_reverse_view +320/615 Test #429: lns ...................................... Passed 0.37 sec + Start 576: utils_sampling +321/615 Test #430: longdouble ............................... Passed 0.38 sec + Start 577: utils_scale_tracking +322/615 Test #431: plimits .................................. Passed 0.37 sec + Start 578: ns_exp_div_factorial +323/615 Test #432: posit .................................... Passed 0.37 sec + Start 579: ns_type_traits +324/615 Test #433: propenv .................................. Passed 0.37 sec + Start 580: fnctn_factorial +325/615 Test #434: propp .................................... Passed 0.38 sec + Start 581: fnctn_isrepresentable +326/615 Test #435: propq .................................... Passed 0.38 sec + Start 582: fnctn_lerp +327/615 Test #436: quad ..................................... Passed 0.38 sec + Start 583: fnctn_logistic_loss +328/615 Test #437: quarter .................................. Passed 0.38 sec + Start 584: fnctn_polynomial +329/615 Test #438: signedint ................................ Passed 0.38 sec + Start 585: fpb_end_of_error +330/615 Test #439: single ................................... Passed 0.38 sec + Start 586: fpb_hamming_1987 +331/615 Test #440: unsignedint .............................. Passed 0.38 sec + Start 587: fpb_log_exp +332/615 Test #441: execution_environment .................... Passed 0.38 sec + Start 588: hw_bfloat16 +333/615 Test #442: edu_integer_basic_operators .............. Passed 0.38 sec + Start 589: hw_cfloat +334/615 Test #443: edu_fixpnt_basic_operators ............... Passed 0.38 sec + Start 590: hw_enumerate +335/615 Test #444: edu_areal_basic_operators ................ Passed 0.38 sec + Start 591: hw_fp8_4_nosubsupsat +336/615 Test #445: edu_bfloat_basic_operators ............... Passed 0.38 sec + Start 592: hw_fp8_4_subsupnosat +337/615 Test #446: edu_unum_basic_operators ................. Passed 0.38 sec + Start 593: hw_integer +338/615 Test #447: edu_posit_basic_operators ................ Passed 0.39 sec + Start 594: hw_posit +339/615 Test #448: edu_posit_components ..................... Passed 0.39 sec + Start 595: hw_ranges +340/615 Test #449: edu_posit_conversion ..................... Passed 0.38 sec + Start 596: c_api_shim_exact_test +341/615 Test #450: edu_posit_discretization_curves .......... Passed 0.38 sec + Start 597: c_api_shim_experiment +342/615 Test #451: edu_posit_enumeration .................... Passed 0.39 sec + Start 598: c_api_shim_posit128 +343/615 Test #452: edu_posit_exceptions ..................... Passed 0.39 sec + Start 599: c_api_shim_posit16 +344/615 Test #453: edu_posit_exponents ...................... Passed 0.39 sec + Start 600: c_api_shim_posit256 +345/615 Test #454: edu_posit_extract ........................ Passed 0.39 sec + Start 601: c_api_shim_posit32 +346/615 Test #455: edu_posit_fractions ...................... Passed 0.39 sec + Start 602: c_api_shim_posit4 +347/615 Test #456: edu_posit_raw_bit_patterns ............... Passed 0.39 sec + Start 603: c_api_shim_posit64 +348/615 Test #457: edu_posit_regimes ........................ Passed 0.39 sec + Start 604: c_api_shim_posit8 +349/615 Test #458: edu_posit_serialization .................. Passed 0.39 sec + Start 605: blas_generators +350/615 Test #459: edu_posit_signalling_nar ................. Passed 0.40 sec + Start 606: blas_matrix_ops +351/615 Test #461: edu_posit_values ......................... Passed 0.40 sec + Start 607: blas_minij +352/615 Test #462: edu_valid_intervals ...................... Passed 0.40 sec + Start 608: blas_rand_spectral +353/615 Test #463: edu_lns_basic_operators .................. Passed 0.40 sec + Start 609: blas_vector_ops +354/615 Test #464: edu_tables_areals ........................ Passed 0.40 sec + Start 610: vmath_linspace +355/615 Test #465: edu_tables_cfloats ....................... Passed 0.40 sec + Start 611: vmath_trigonometry +356/615 Test #466: edu_tables_fixpnts ....................... Passed 0.40 sec + Start 612: data_prototype +357/615 Test #467: edu_tables_lns ........................... Passed 0.40 sec + Start 613: data_scaling +358/615 Test #468: edu_tables_posits ........................ Passed 0.40 sec + Start 614: data_serialization +359/615 Test #469: edu_ranges_cfloat ........................ Passed 0.40 sec + Start 615: data_summary_statistics +360/615 Test #470: edu_ranges_fixpnt ........................ Passed 0.40 sec +361/615 Test #471: edu_ranges_lns ........................... Passed 0.40 sec +362/615 Test #472: edu_ranges_posit ......................... Passed 0.39 sec +363/615 Test #473: edu_quire_quires ......................... Passed 0.39 sec +364/615 Test #474: playground_efunc_posits .................. Passed 0.39 sec +365/615 Test #475: playground_efunc_valids .................. Passed 0.39 sec +366/615 Test #476: playground_gismo_test .................... Passed 0.38 sec +367/615 Test #477: playground_meta_programming .............. Passed 0.38 sec +368/615 Test #478: playground_serialization ................. Passed 0.38 sec +369/615 Test #480: playground_type_test ..................... Passed 0.38 sec +370/615 Test #481: engineering_chem_equilibrium ............. Passed 0.37 sec +371/615 Test #482: engineering_water ........................ Passed 0.37 sec +372/615 Test #483: ode_convergence .......................... Passed 0.37 sec +373/615 Test #484: ode_first_order_ode ...................... Passed 0.37 sec +374/615 Test #485: ode_general_runge_kutta .................. Passed 0.37 sec +375/615 Test #486: ode_runge_kutta4 ......................... Passed 0.36 sec +376/615 Test #487: opt_error_vs_cost ........................ Passed 0.36 sec +377/615 Test #488: pde_cg ................................... Passed 0.36 sec +378/615 Test #489: pde_gauss_seidel ......................... Passed 0.36 sec +379/615 Test #490: pde_jacobi ............................... Passed 0.35 sec +380/615 Test #491: pde_laplace .............................. Passed 0.35 sec +381/615 Test #492: pde_sor .................................. Passed 0.35 sec +382/615 Test #493: roots_bisection .......................... Passed 0.35 sec +383/615 Test #494: roots_rpoly_ak1 .......................... Passed 0.34 sec +384/615 Test #495: science_iso_constants .................... Passed 0.34 sec +385/615 Test #496: science_physics_constants ................ Passed 0.34 sec +386/615 Test #497: approx_taylor_series ..................... Passed 0.34 sec +387/615 Test #498: cheby_chebtests .......................... Passed 0.34 sec +388/615 Test #499: cheby_lambdas ............................ Passed 0.33 sec +389/615 Test #500: cheby_nodes .............................. Passed 0.33 sec +390/615 Test #501: cheby_playground ......................... Passed 0.33 sec +391/615 Test #502: cheby_skeleton ........................... Passed 0.33 sec +392/615 Test #503: dnn_fit_sin .............................. Passed 0.32 sec +393/615 Test #504: dnn_mnist ................................ Passed 0.32 sec +394/615 Test #505: dnn_schedules ............................ Passed 0.32 sec +395/615 Test #506: dsp_adc_mapping .......................... Passed 0.32 sec +396/615 Test #507: dsp_fir_filter ........................... Passed 0.32 sec +397/615 Test #509: chaos_time_precision_lyapunov ............ Passed 0.31 sec +398/615 Test #510: complex_compute .......................... Passed 0.31 sec +399/615 Test #512: weather_error_growth_atmospheric_model ... Passed 0.31 sec +400/615 Test #513: adaptive_euler ........................... Passed 0.30 sec +401/615 Test #514: adaptive_phi ............................. Passed 0.30 sec +402/615 Test #516: fp_catastrophic_cancellation ............. Passed 0.30 sec +403/615 Test #517: fp_contract_expand ....................... Passed 0.30 sec +404/615 Test #518: fp_exponentiation ........................ Passed 0.29 sec +405/615 Test #521: fp_linear_cover .......................... Passed 0.29 sec +406/615 Test #522: fp_precision ............................. Passed 0.29 sec +407/615 Test #523: fp_printing .............................. Passed 0.28 sec +408/615 Test #524: fp_rounding_error_addition ............... Passed 0.28 sec +409/615 Test #525: fp_rounding_error_multiplication ......... Passed 0.28 sec +410/615 Test #526: fp_sterbenz_lemma ........................ Passed 0.28 sec +411/615 Test #528: fp_thin_triangle ......................... Passed 0.27 sec +412/615 Test #530: fp_underflow ............................. Passed 0.26 sec +413/615 Test #531: math_decimal_lpp ......................... Passed 0.26 sec +414/615 Test #532: math_distinct_powers ..................... Passed 0.26 sec +415/615 Test #533: math_irrational_powers ................... Passed 0.26 sec +416/615 Test #534: math_largest_palindrome_product .......... Passed 0.25 sec +417/615 Test #535: math_numbers_irrational .................. Passed 0.25 sec +418/615 Test #536: math_numbers_rational .................... Passed 0.25 sec +419/615 Test #538: math_primes .............................. Passed 0.24 sec +420/615 Test #539: math_sincospi ............................ Passed 0.24 sec +421/615 Test #540: math_stirlings_approximation ............. Passed 0.24 sec +422/615 Test #541: numeric_constants ........................ Passed 0.24 sec +423/615 Test #542: numeric_doubledouble ..................... Passed 0.23 sec +424/615 Test #543: numeric_luir ............................. Passed 0.23 sec +425/615 Test #544: numeric_midpoint ......................... Passed 0.23 sec +426/615 Test #545: numeric_numbers .......................... Passed 0.23 sec +427/615 Test #546: numeric_posit_list ....................... Passed 0.22 sec +428/615 Test #547: numeric_posit_properties ................. Passed 0.22 sec +429/615 Test #548: numeric_priest ........................... Passed 0.22 sec +430/615 Test #549: numeric_quadratic ........................ Passed 0.22 sec +431/615 Test #550: numeric_residual ......................... Passed 0.21 sec +432/615 Test #551: numeric_rump_equation .................... Passed 0.21 sec +433/615 Test #552: numeric_solvetest ........................ Passed 0.21 sec +434/615 Test #553: numeric_traits ........................... Passed 0.21 sec +435/615 Test #554: numeric_ulp_math ......................... Passed 0.20 sec +436/615 Test #557: blas_l1_fused_dot ........................ Passed 0.20 sec +437/615 Test #19: bb_addition .............................. Passed 1.21 sec +438/615 Test #21: bb_multiplication ........................ Passed 1.21 sec +439/615 Test #399: benchmark_cfloat_performance ............. Passed 0.59 sec +440/615 Test #405: benchmark_native_performance ............. Passed 0.58 sec +441/615 Test #508: chaos_bakers_map ......................... Passed 0.33 sec +442/615 Test #556: blas_inverse ............................. Passed 0.21 sec +443/615 Test #558: blas_l2_fused_mv ......................... Passed 0.20 sec +444/615 Test #519: fp_integer_cover ......................... Passed 0.31 sec +445/615 Test #555: blas_hilbert ............................. Passed 0.21 sec +446/615 Test #460: edu_posit_ulp ............................ Passed 0.45 sec +447/615 Test #515: adaptive_pi .............................. Passed 0.32 sec +448/615 Test #223: fast_posit_256_5 ......................... Passed 0.99 sec +449/615 Test #222: fast_posit_256_2 ......................... Passed 0.99 sec +450/615 Test #559: blas_l3_fused_mm ......................... Passed 0.19 sec +451/615 Test #561: blas_norms ............................... Passed 0.18 sec +452/615 Test #562: blas_randsvd ............................. Passed 0.18 sec +453/615 Test #563: crypto_fermat ............................ Passed 0.18 sec +454/615 Test #564: crypto_large_lcm ......................... Passed 0.17 sec +455/615 Test #565: crypto_pollard_rho ....................... Passed 0.17 sec +456/615 Test #566: crypto_quadratic_sieve ................... Passed 0.17 sec +457/615 Test #567: sequences_fibonacci ...................... Passed 0.17 sec +458/615 Test #568: sequences_tribonacci ..................... Passed 0.16 sec +459/615 Test #569: stl_sequential_containers ................ Passed 0.16 sec +460/615 Test #570: faithful_accurate_sum_and_dot ............ Passed 0.16 sec +461/615 Test #571: faithful_arithmetic ...................... Passed 0.16 sec +462/615 Test #572: ieee754_quire_accumulation ............... Passed 0.16 sec +463/615 Test #573: ieee754_quires ........................... Passed 0.15 sec +464/615 Test #574: utils_lookup_arithmetic .................. Passed 0.15 sec +465/615 Test #575: utils_reverse_view ....................... Passed 0.15 sec +466/615 Test #576: utils_sampling ........................... Passed 0.14 sec +467/615 Test #577: utils_scale_tracking ..................... Passed 0.14 sec +468/615 Test #578: ns_exp_div_factorial ..................... Passed 0.14 sec +469/615 Test #579: ns_type_traits ........................... Passed 0.14 sec +470/615 Test #580: fnctn_factorial .......................... Passed 0.13 sec +471/615 Test #581: fnctn_isrepresentable .................... Passed 0.13 sec +472/615 Test #582: fnctn_lerp ............................... Passed 0.13 sec +473/615 Test #583: fnctn_logistic_loss ...................... Passed 0.13 sec +474/615 Test #584: fnctn_polynomial ......................... Passed 0.12 sec +475/615 Test #585: fpb_end_of_error ......................... Passed 0.12 sec +476/615 Test #586: fpb_hamming_1987 ......................... Passed 0.12 sec +477/615 Test #587: fpb_log_exp .............................. Passed 0.12 sec +478/615 Test #588: hw_bfloat16 .............................. Passed 0.11 sec +479/615 Test #589: hw_cfloat ................................ Passed 0.11 sec +480/615 Test #590: hw_enumerate ............................. Passed 0.11 sec +481/615 Test #591: hw_fp8_4_nosubsupsat ..................... Passed 0.10 sec +482/615 Test #592: hw_fp8_4_subsupnosat ..................... Passed 0.10 sec +483/615 Test #593: hw_integer ............................... Passed 0.10 sec +484/615 Test #594: hw_posit ................................. Passed 0.10 sec +485/615 Test #595: hw_ranges ................................ Passed 0.09 sec +486/615 Test #597: c_api_shim_experiment .................... Passed 0.09 sec +487/615 Test #602: c_api_shim_posit4 ........................ Passed 0.07 sec +488/615 Test #605: blas_generators .......................... Passed 0.06 sec +489/615 Test #607: blas_minij ............................... Passed 0.05 sec +490/615 Test #608: blas_rand_spectral ....................... Passed 0.05 sec +491/615 Test #610: vmath_linspace ........................... Passed 0.05 sec +492/615 Test #611: vmath_trigonometry ....................... Passed 0.04 sec +493/615 Test #612: data_prototype ........................... Passed 0.04 sec +494/615 Test #613: data_scaling ............................. Passed 0.04 sec +495/615 Test #614: data_serialization ....................... Passed 0.04 sec +496/615 Test #154: lns_hypotenuse ...........................***Failed 1.08 sec +497/615 Test #479: playground_skeleton ...................... Passed 0.41 sec +498/615 Test #96: bint_shift_left .......................... Passed 1.17 sec +499/615 Test #609: blas_vector_ops .......................... Passed 0.08 sec +500/615 Test #520: fp_kahan_sum ............................. Passed 0.40 sec +501/615 Test #312: cfloat_tff_from_blocktriple .............. Passed 0.90 sec +502/615 Test #604: c_api_shim_posit8 ........................ Passed 0.17 sec +503/615 Test #158: lns_trigonometry ......................... Passed 1.20 sec +504/615 Test #560: blas_lu .................................. Passed 0.33 sec +505/615 Test #529: fp_two_sum ............................... Passed 0.45 sec +506/615 Test #615: data_summary_statistics .................. Passed 0.20 sec +507/615 Test #160: lns_performance .......................... Passed 1.54 sec +508/615 Test #242: posito_addition ..........................***Failed 1.47 sec +509/615 Test #207: posit_subtraction ........................***Failed 1.57 sec +510/615 Test #240: posit2_addition ..........................***Failed 1.63 sec +511/615 Test #382: error_dot ................................ Passed 1.44 sec +512/615 Test #202: posit_literals ........................... Passed 1.82 sec +513/615 Test #171: dbns_multiplication ...................... Passed 2.00 sec +514/615 Test #203: posit_multiplication .....................***Failed 2.09 sec +515/615 Test #315: cfloat_ttf_from_blocktriple .............. Passed 1.87 sec +516/615 Test #25: bb_performance ........................... Passed 2.34 sec +517/615 Test #343: cfloat_ttt_from_blocktriple .............. Passed 1.85 sec +518/615 Test #285: cfloat_assignment ........................ Passed 1.99 sec +519/615 Test #601: c_api_shim_posit32 ....................... Passed 1.21 sec +520/615 Test #8: value_arithmetic_add ..................... Passed 2.42 sec +521/615 Test #100: bint_multiplication ...................... Passed 2.52 sec +522/615 Test #599: c_api_shim_posit16 ....................... Passed 1.55 sec +523/615 Test #73: edec_addition ............................***Failed 2.68 sec +524/615 Test #76: edec_subtraction .........................***Failed 2.73 sec +525/615 Test #606: blas_matrix_ops .......................... Passed 1.71 sec +526/615 Test #377: mp_cg_mvfdp_cmpfdp ....................... Passed 2.40 sec +527/615 Test #375: mp_cg_mvdot_cmpfdp ....................... Passed 2.41 sec +528/615 Test #374: mp_cg_mvdot_cmpdot ....................... Passed 2.43 sec +529/615 Test #246: posito_subtraction .......................***Failed 2.80 sec +530/615 Test #74: edec_division ............................***Exception: Numerical 3.06 sec +531/615 Test #598: c_api_shim_posit128 ...................... Passed 2.00 sec +532/615 Test #527: fp_sum_of_integers ....................... Passed 2.43 sec +533/615 Test #600: c_api_shim_posit256 ...................... Passed 2.33 sec +534/615 Test #376: mp_cg_mvfdp_cmpdot ....................... Passed 2.94 sec +535/615 Test #596: c_api_shim_exact_test .................... Passed 2.68 sec +536/615 Test #234: fast_quire_32_2 .......................... Passed 3.66 sec +537/615 Test #411: benchmark_posit_48b_posit ................ Passed 3.36 sec +538/615 Test #99: bint_division ............................ Passed 4.18 sec +539/615 Test #603: c_api_shim_posit64 ....................... Passed 3.25 sec +540/615 Test #113: fixpnt_mod_conversion .................... Passed 4.39 sec +541/615 Test #221: fast_posit_16_2 .......................... Passed 4.32 sec +542/615 Test #115: fixpnt_sat_conversion .................... Passed 4.86 sec +543/615 Test #75: edec_multiplication ......................***Failed 5.03 sec +544/615 Test #196: posit_addition ...........................***Failed 5.06 sec +545/615 Test #143: lns_conversion ........................... Passed 5.42 sec +546/615 Test #199: posit_division ...........................***Failed 5.57 sec +547/615 Test #146: lns_division ............................. Passed 5.74 sec +548/615 Test #95: bint_logic ............................... Passed 5.87 sec +549/615 Test #413: benchmark_posit_64b_posit ................ Passed 5.50 sec +550/615 Test #205: posit_reciprocation ...................... Passed 6.31 sec +551/615 Test #204: posit_negation ........................... Passed 6.32 sec +552/615 Test #225: fast_posit_32_2 .......................... Passed 6.56 sec +553/615 Test #28: bf_multiplication ........................ Passed 7.33 sec +554/615 Test #35: bs_multiplication ........................ Passed 7.47 sec +555/615 Test #339: cfloat_fft_to_blocktriple ................ Passed 7.24 sec +556/615 Test #314: cfloat_ftf_to_blocktriple ................ Passed 9.95 sec +557/615 Test #9: value_performance ........................ Passed 10.51 sec +558/615 Test #342: cfloat_ftt_to_blocktriple ................ Passed 10.05 sec +559/615 Test #313: cfloat_tff_to_blocktriple ................ Passed 10.31 sec +560/615 Test #341: cfloat_tft_to_blocktriple ................ Passed 10.31 sec +561/615 Test #51: bt_performance ........................... Passed 11.60 sec +562/615 Test #259: areal_logic .............................. Passed 11.35 sec +563/615 Test #537: math_pascals_triangle .................... Passed 10.73 sec +564/615 Test #148: lns_subtraction .......................... Passed 11.73 sec +565/615 Test #144: lns_addition ............................. Passed 11.74 sec +566/615 Test #294: cfloat_logic ............................. Passed 12.60 sec +567/615 Test #316: cfloat_ttf_to_blocktriple ................ Passed 13.73 sec +568/615 Test #344: cfloat_ttt_to_blocktriple ................ Passed 13.70 sec +569/615 Test #404: benchmark_lns_performance ................ Passed 14.30 sec +570/615 Test #220: fast_posit_16_1 .......................... Passed 14.78 sec +571/615 Test #147: lns_multiplication ....................... Passed 15.03 sec +572/615 Test #117: fixpnt_logic ............................. Passed 20.98 sec +573/615 Test #119: fixpnt_mod_division ...................... Passed 32.73 sec +574/615 Test #101: bint_remainder ...........................***Failed 34.97 sec +575/615 Test #105: bint_perf ................................ Passed 37.93 sec +576/615 Test #511: mem_stream ............................... Passed 66.82 sec +577/615 Test #309: cfloat_perf .............................. Passed 69.02 sec +578/615 Test #400: benchmark_compare_performance ............ Passed 74.82 sec +579/615 Test #118: fixpnt_mod_addition ...................... Passed 79.79 sec +580/615 Test #122: fixpnt_sat_addition ...................... Passed 96.06 sec +581/615 Test #120: fixpnt_mod_multiplication ................ Passed 107.45 sec +582/615 Test #124: fixpnt_sat_multiplication ................ Passed 126.80 sec +583/615 Test #128: fixpnt_mod_complex_sub ................... Passed 227.80 sec +584/615 Test #126: fixpnt_mod_complex_add ................... Passed 228.08 sec +585/615 Test #102: bint_subtraction ......................... Passed 236.26 sec +586/615 Test #98: bint_addition ............................ Passed 794.86 sec +587/615 Test #121: fixpnt_mod_subtraction ................... Passed 4380.01 sec +588/615 Test #125: fixpnt_sat_subtraction ................... Passed 5267.58 sec +589/615 Test #335: cfloat_ttf_multiplication ................***Failed 5765.49 sec +590/615 Test #328: cfloat_ftf_addition ......................***Failed 6231.94 sec +591/615 Test #333: cfloat_ttf_addition ......................***Failed 6441.67 sec +592/615 Test #330: cfloat_ftf_multiplication ................***Failed 7071.34 sec +593/615 Test #355: cfloat_ftt_multiplication ................***Failed 7158.24 sec +594/615 Test #337: cfloat_ttf_subtraction ...................***Failed 7248.57 sec +595/615 Test #332: cfloat_ftf_subtraction ...................***Failed 7425.84 sec +596/615 Test #356: cfloat_ftt_subtraction ...................***Failed 7426.92 sec +597/615 Test #317: cfloat_fff_addition ...................... Passed 8141.99 sec +598/615 Test #323: cfloat_tff_addition ......................***Failed 8421.66 sec +599/615 Test #320: cfloat_fff_multiplication ................ Passed 8647.37 sec +600/615 Test #351: cfloat_tft_multiplication ................***Failed 8921.45 sec +601/615 Test #325: cfloat_tff_multiplication ................***Failed 8923.03 sec +602/615 Test #352: cfloat_tft_subtraction ...................***Failed 9431.45 sec +603/615 Test #327: cfloat_tff_subtraction ...................***Failed 9533.35 sec +604/615 Test #348: cfloat_fft_subtraction ................... Passed 10169.43 sec +605/615 Test #322: cfloat_fff_subtraction ................... Passed 10215.49 sec +... diff --git a/elastic/decimal/arithmetic/addition.cpp b/elastic/decimal/arithmetic/addition.cpp index 399af634a..68bc429da 100644 --- a/elastic/decimal/arithmetic/addition.cpp +++ b/elastic/decimal/arithmetic/addition.cpp @@ -1,6 +1,6 @@ // addition.cpp: test suite runner for addition on adaptive precision decimal integers // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -138,7 +138,7 @@ try { #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyEdecimalAddition<64>(reportTestCases), "decimal addition nbits=64", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyEdecimalAddition<63>(reportTestCases), "decimal addition nbits=63", test_tag); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/elastic/decimal/arithmetic/division.cpp b/elastic/decimal/arithmetic/division.cpp index 486c0da75..2f9457261 100644 --- a/elastic/decimal/arithmetic/division.cpp +++ b/elastic/decimal/arithmetic/division.cpp @@ -1,6 +1,6 @@ // division.cpp: test suite runner for division on adaptive precision decimal integers // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -160,7 +160,7 @@ try { #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyEdecimalDivision<64>(reportTestCases), "decimal division nbits=64", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyEdecimalDivision<63>(reportTestCases), "decimal division nbits=63", test_tag); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/elastic/decimal/arithmetic/multiplication.cpp b/elastic/decimal/arithmetic/multiplication.cpp index 792090f4a..1ac4f1d8d 100644 --- a/elastic/decimal/arithmetic/multiplication.cpp +++ b/elastic/decimal/arithmetic/multiplication.cpp @@ -1,6 +1,6 @@ // multiplication.cpp: test suite runner for multiplicationon adaptive precision decimal integers // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -140,7 +140,8 @@ try { #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyEdecimalMultiplication<64>(reportTestCases), "decimal multiplication nbits=64", test_tag); + // TODO: multiplication of integers > 32bits need an Oracle to verify + /* nrOfFailedTestCases += */ ReportTestResult(VerifyEdecimalMultiplication<63>(reportTestCases), "decimal multiplication nbits=63", test_tag); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/elastic/decimal/arithmetic/subtraction.cpp b/elastic/decimal/arithmetic/subtraction.cpp index 440386d36..f92e0cc7e 100644 --- a/elastic/decimal/arithmetic/subtraction.cpp +++ b/elastic/decimal/arithmetic/subtraction.cpp @@ -1,6 +1,6 @@ // subtraction.cpp: test suite runner for subtractionon adaptive precision decimal integers // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -140,7 +140,7 @@ try { #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyEdecimalSubtraction<64>(reportTestCases), "decimal subtraction nbits=64", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyEdecimalSubtraction<63>(reportTestCases), "decimal subtraction nbits=63", test_tag); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/elastic/einteger/arithmetic/addition.cpp b/elastic/einteger/arithmetic/addition.cpp index 4e8798254..109cdda54 100644 --- a/elastic/einteger/arithmetic/addition.cpp +++ b/elastic/einteger/arithmetic/addition.cpp @@ -1,6 +1,6 @@ // addition.cpp: test suite runner for addition on elastic precision binary integers // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include diff --git a/elastic/einteger/arithmetic/division.cpp b/elastic/einteger/arithmetic/division.cpp index 800608e62..793f1cb6d 100644 --- a/elastic/einteger/arithmetic/division.cpp +++ b/elastic/einteger/arithmetic/division.cpp @@ -1,6 +1,6 @@ // division.cpp: test suite runner for division on elastic precision binary integers // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -292,7 +292,7 @@ try { #if REGRESSION_LEVEL_2 nrOfFailedTestCases += ReportTestResult(VerifyElasticDivision<32, uint8_t>(reportTestCases), "einteger", test_tag); nrOfFailedTestCases += ReportTestResult(VerifyElasticDivision<32, uint16_t>(reportTestCases), "einteger", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyElasticDivision<64, uint32_t>(reportTestCases), "einteger", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyElasticDivision<32, uint32_t>(reportTestCases), "einteger", test_tag); #endif #if REGRESSION_LEVEL_3 @@ -300,7 +300,7 @@ try { #endif #if REGRESSION_LEVEL_4 - + nrOfFailedTestCases += ReportTestResult(VerifyElasticDivision<60, uint32_t>(reportTestCases), "einteger", test_tag); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/include/universal/blas/blas.hpp b/include/universal/blas/blas.hpp index 190949aaa..eccea1849 100644 --- a/include/universal/blas/blas.hpp +++ b/include/universal/blas/blas.hpp @@ -83,6 +83,8 @@ constexpr uint64_t SIZE_512G = 512 * SIZE_1G; #include // MATLAB-style elementary vector functions +#include +#include #include #include diff --git a/include/universal/blas/blas_l1.hpp b/include/universal/blas/blas_l1.hpp index d51452efd..4537bdfb8 100644 --- a/include/universal/blas/blas_l1.hpp +++ b/include/universal/blas/blas_l1.hpp @@ -1,7 +1,7 @@ #pragma once // blas_l1.hpp: BLAS Level 1 functions // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include diff --git a/include/universal/blas/generators/tridiag.hpp b/include/universal/blas/generators/tridiag.hpp index 1040b597a..905768cd0 100644 --- a/include/universal/blas/generators/tridiag.hpp +++ b/include/universal/blas/generators/tridiag.hpp @@ -1,7 +1,7 @@ #pragma once // tridiag.hpp: generate tridiagonal matrix finite difference forward-time-centered-space(FTCS) in 1D // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -10,7 +10,7 @@ namespace sw { namespace universal { namespace blas { // return a new tridiagonal matrix template -matrix tridiag(size_t N, Scalar subdiag = Scalar(-1.0), Scalar diagonal = Scalar(2.0), Scalar superdiag = Scalar(-1.0)) { +matrix tridiag(typename matrix::size_type N, Scalar subdiag = Scalar(-1.0), Scalar diagonal = Scalar(2.0), Scalar superdiag = Scalar(-1.0)) { matrix A; tridiag(A, N, subdiag, diagonal, superdiag); return A; @@ -18,10 +18,11 @@ matrix tridiag(size_t N, Scalar subdiag = Scalar(-1.0), Scalar diagonal // generate a finite difference equation matrix for 1D problems template -void tridiag(matrix& A, size_t N, Scalar subdiag = Scalar(-1.0), Scalar diagonal = Scalar(2.0), Scalar superdiag = Scalar(-1.0)) { +void tridiag(matrix& A, typename matrix::size_type N, Scalar subdiag = Scalar(-1.0), Scalar diagonal = Scalar(2.0), Scalar superdiag = Scalar(-1.0)) { + using size_type = typename matrix::size_type; A.resize(N, N); - for (size_t j = 0; j < N; ++j) { - for (size_t i = 0; i < N; ++i) { + for (size_type j = 0; j < N; ++j) { + for (size_type i = 0; i < N; ++i) { if (j == i - 1) { A(i, j) = subdiag; } diff --git a/include/universal/blas/inverse.hpp b/include/universal/blas/inverse.hpp index c40acf759..980510807 100644 --- a/include/universal/blas/inverse.hpp +++ b/include/universal/blas/inverse.hpp @@ -1,7 +1,7 @@ #pragma once // inverse.hpp: Gauss-Jordan algorithm to generate matrix inverse // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -28,27 +28,26 @@ namespace sw { namespace universal { namespace blas { // this would make the pivoting dependent on scaling // implicit pivoting: pre-scale all equations so that their largest coefficient is unity -// full pivoting Gauss-Jordan inverse without implicit pivoting +// full pivoting Gauss-Jordan inverse without implicit pivoting, returns a null matrix when A is singular template matrix inv(const matrix& A) { - using namespace std; - using namespace sw::universal; using std::fabs; - const size_t N = num_rows(A); + using size_type = typename matrix::size_type; + size_type N = num_rows(A); if (N != num_cols(A)) { std::cerr << "inv matrix argument is not square: (" << num_rows(A) << " x " << num_cols(A) << ")\n"; return matrix{}; } matrix B(A); vector indxc(N), indxr(N), indxp(N); - size_t irow = 0, icol = 0; - for (size_t i = 0; i < N; ++i) { + size_type irow = 0, icol = 0; + for (size_type i = 0; i < N; ++i) { // find largest absolute value to select as pivot // scan across all NxN indices but skip the row/column that we have already processed (indxp == 1) Scalar pivot = 0; - for (size_t j = 0; j < N; ++j) { + for (size_type j = 0; j < N; ++j) { if (indxp[j] != 1) { // skip the row/column if already processed - for (size_t k = 0; k < N; ++k) { + for (size_type k = 0; k < N; ++k) { // std::cout << "iteration (" << j << "," << k << ")\n"; if (indxp[k] == 0) { Scalar e = fabs(B(j,k)); @@ -78,7 +77,7 @@ matrix inv(const matrix& A) { // put the pivot on the diagonal if (irow != icol) { - for (size_t l = 0; l < N; ++l) std::swap(B(irow, l), B(icol, l)); + for (size_type l = 0; l < N; ++l) std::swap(B(irow, l), B(icol, l)); } // std::cout << "matrix B\n" << B << std::endl; indxr[i] = irow; @@ -89,21 +88,21 @@ matrix inv(const matrix& A) { } auto normalizer = Scalar(1.0) / B(icol, icol); B(icol, icol) = Scalar(1.0); - for (size_t l = 0; l < N; ++l) B(icol, l) *= normalizer; + for (size_type l = 0; l < N; ++l) B(icol, l) *= normalizer; // std::cout << "matrix B\n" << B << std::endl; - for (size_t ll = 0; ll < N; ++ll) { // reduce the rows + for (size_type ll = 0; ll < N; ++ll) { // reduce the rows if (ll != icol) { // skip the row with the pivot auto dum = B(ll, icol); B(ll, icol) = Scalar(0); - for (size_t l = 0; l < N; ++l) B(ll, l) -= B(icol, l) * dum; + for (size_type l = 0; l < N; ++l) B(ll, l) -= B(icol, l) * dum; } } // std::cout << "matrix B\n" << B << std::endl; } // unscramble the solution by interchanging pairs of columns in the reverse order that the permutation was constructed - for (size_t l = N; l > 0; --l) { + for (size_type l = N; l > 0; --l) { if (indxr[l-1] != indxc[l-1]) { - for (size_t k = 0; k < N; ++k) std::swap(B(k, indxr[l-1]), B(k, indxc[l-1])); + for (size_type k = 0; k < N; ++k) std::swap(B(k, indxr[l-1]), B(k, indxc[l-1])); } } return B; @@ -112,22 +111,23 @@ matrix inv(const matrix& A) { // non-pivoting Gauss-Jordan inverse template matrix invfast(const matrix& A) { - const size_t N = num_rows(A); + using size_type = typename matrix::size_type; + size_type N = num_rows(A); matrix B(A); matrix Ainv(num_rows(A), num_cols(A)); Ainv = 1; - for (size_t j = 0; j < N; ++j) { // for each column - for (size_t i = 0; i < N; ++i) { // normalize each row + for (size_type j = 0; j < N; ++j) { // for each column + for (size_type i = 0; i < N; ++i) { // normalize each row if (i == j) { auto normalizer = Scalar(1.0) / B[j][j]; - for (size_t k = 0; k < N; ++k) { + for (size_type k = 0; k < N; ++k) { B[i][k] = normalizer * B[i][k]; Ainv[i][k] = normalizer * Ainv[i][k]; } } else { auto normalizer = B(i, j) / B(j, j); - for (size_t k = 0; k < N; ++k) { + for (size_type k = 0; k < N; ++k) { B[i][k] -= normalizer * B[j][k]; Ainv[i][k] -= normalizer * Ainv[j][k]; } diff --git a/include/universal/blas/matrix.hpp b/include/universal/blas/matrix.hpp index 77c20d4e9..cfb0a0a84 100644 --- a/include/universal/blas/matrix.hpp +++ b/include/universal/blas/matrix.hpp @@ -1,7 +1,7 @@ #pragma once // matrix.hpp: super-simple dense matrix class implementation // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -56,8 +56,9 @@ template class matrix; template class ConstRowProxy { public: + typedef typename std::vector::size_type size_type; ConstRowProxy(typename std::vector::const_iterator iter) : _iter(iter) {} - Scalar operator[](unsigned col) const { return *(_iter + int64_t(col)); } + Scalar operator[](size_type col) const { return *(_iter + static_cast(col)); } private: typename std::vector::const_iterator _iter; @@ -65,8 +66,9 @@ class ConstRowProxy { template class RowProxy { public: + typedef typename std::vector::size_type size_type; RowProxy(typename std::vector::iterator iter) : _iter(iter) {} - Scalar& operator[](unsigned col) { return *(_iter + int64_t(col)); } + Scalar& operator[](size_type col) { return *(_iter + static_cast(col)); } private: typename std::vector::iterator _iter; @@ -75,22 +77,22 @@ class RowProxy { template class matrix { public: - typedef Scalar value_type; - typedef const value_type& const_reference; - typedef value_type& reference; - typedef const value_type* const_pointer_type; - typedef typename std::vector::size_type size_type; - typedef typename std::vector::iterator iterator; - typedef typename std::vector::const_iterator const_iterator; - typedef typename std::vector::reverse_iterator reverse_iterator; + typedef Scalar value_type; + typedef const value_type& const_reference; + typedef value_type& reference; + typedef const value_type* const_pointer_type; + typedef typename std::vector::size_type size_type; + typedef typename std::vector::iterator iterator; + typedef typename std::vector::const_iterator const_iterator; + typedef typename std::vector::reverse_iterator reverse_iterator; typedef typename std::vector::const_reverse_iterator const_reverse_iterator; static constexpr unsigned AggregationType = UNIVERSAL_AGGREGATE_MATRIX; matrix() : _m{ 0 }, _n{ 0 }, data(0) {} - matrix(unsigned m, unsigned n) : _m{ m }, _n{ n }, data(m*n, Scalar(0.0)) { } + matrix(size_type m, size_type n) : _m{ m }, _n{ n }, data(m*n, Scalar(0.0)) { } matrix(std::initializer_list< std::initializer_list > values) { - unsigned nrows = static_cast(values.size()); - unsigned ncols = static_cast(values.begin()->size()); + auto nrows = values.size(); + auto ncols = values.begin()->size(); data.resize(nrows * ncols); unsigned r = 0; for (auto l : values) { @@ -112,8 +114,8 @@ class matrix { template matrix(const matrix& A) : _m{ A.rows() }, _n{A.cols() }{ data.resize(_m*_n); - for (unsigned i = 0; i < _m; ++i){ - for (unsigned j = 0; j < _n; ++j){ + for (size_type i = 0; i < _m; ++i){ + for (size_type j = 0; j < _n; ++j){ data[i*_n + j] = Scalar(A(i,j)); } } @@ -129,19 +131,19 @@ class matrix { // Identity matrix operator matrix& operator=(const Scalar& one) { setzero(); - unsigned smallestDimension = (_m < _n ? _m : _n); - for (unsigned i = 0; i < smallestDimension; ++i) data[i*_n + i] = one; + size_type smallestDimension = (_m < _n ? _m : _n); + for (size_type i = 0; i < smallestDimension; ++i) data[i*_n + i] = one; return *this; } - Scalar operator()(unsigned i, unsigned j) const { return data[i*_n + j]; } - Scalar& operator()(unsigned i, unsigned j) { return data[i*_n + j]; } - RowProxy operator[](unsigned i) { - typename std::vector::iterator it = data.begin() + int64_t(i) * int64_t(_n); + Scalar operator()(size_type i, size_type j) const { return data[i*_n + j]; } + Scalar& operator()(size_type i, size_type j) { return data[i*_n + j]; } + RowProxy operator[](size_type i) { + typename std::vector::iterator it = data.begin() + static_cast(i * _n); RowProxy proxy(it); return proxy; } - ConstRowProxy operator[](unsigned i) const { + ConstRowProxy operator[](size_type i) const { typename std::vector::const_iterator it = data.begin() + static_cast(i * _n); ConstRowProxy proxy(it); return proxy; @@ -176,7 +178,6 @@ class matrix { // multiply all matrix elements matrix& operator*=(const Scalar& a) { - using size_type = typename matrix::size_type; for (size_type e = 0; e < _m*_n; ++e) { data[e] *= a; } @@ -184,7 +185,6 @@ class matrix { } // divide all matrix elements matrix& operator/=(const Scalar& a) { - using size_type = typename matrix::size_type; for (size_type e = 0; e < _m * _n; ++e) { data[e] /= a; } @@ -194,25 +194,25 @@ class matrix { // modifiers void push_back(const Scalar& v) { data.push_back(v); } void setzero() { for (auto& elem : data) elem = Scalar(0); } - void resize(unsigned m, unsigned n) { _m = m; _n = n; data.resize(m * n); } + void resize(size_type m, size_type n) { _m = m; _n = n; data.resize(m * n); } // selectors - unsigned rows() const { return _m; } - unsigned cols() const { return _n; } + size_type rows() const { return _m; } + size_type cols() const { return _n; } // std::pair size() const { return std::make_pair(_m, _n); } unsigned size() const { return data.size(); } // in-place transpose matrix& transpose() { - unsigned size = _m * _n - 1; - std::map b; // mark visits + size_type size = _m * _n - 1; + std::map b; // mark visits b[0] = true; // A(0,0) is stationary b[size] = true; // A(m-1,n-1) is stationary - unsigned index = 1; + size_type index = 1; while (index < size) { - unsigned cycleStart = index; // holds start of cycle + size_type cycleStart = index; // holds start of cycle Scalar e = data[index]; // holds value of the element to be swapped do { - unsigned next = (index * _m) % size; // index of e + size_type next = (index * _m) % size; // index of e std::swap(data[next], e); b[index] = true; index = next; @@ -225,7 +225,7 @@ class matrix { } // Eigen operators I need to reverse engineer - matrix Zero(unsigned m, unsigned n) { + matrix Zero(size_type m, size_type n) { matrix z(m, n); return z; } @@ -264,26 +264,27 @@ class matrix { } private: - unsigned _m, _n; // m rows and n columns + size_type _m, _n; // m rows and n columns std::vector data; }; template -inline unsigned num_rows(const matrix& A) { return A.rows(); } +inline typename matrix::size_type num_rows(const matrix& A) { return A.rows(); } template -inline unsigned num_cols(const matrix& A) { return A.cols(); } +inline typename matrix::size_type num_cols(const matrix& A) { return A.cols(); } template -inline std::pair size(const matrix& A) { return std::make_pair(A.rows(), A.cols()); } +inline std::pair::size_type, typename matrix::size_type> size(const matrix& A) { return std::make_pair(A.rows(), A.cols()); } // ostream operator: no need to declare as friend as it only uses public interfaces template std::ostream& operator<<(std::ostream& ostr, const matrix& A) { + using size_type = typename matrix::size_type; auto width = ostr.width(); - unsigned m = A.rows(); - unsigned n = A.cols(); - for (unsigned i = 0; i < m; ++i) { - for (unsigned j = 0; j < n; ++j) { + size_type m = A.rows(); + size_type n = A.cols(); + for (size_type i = 0; i < m; ++i) { + for (size_type j = 0; j < n; ++j) { ostr << std::setw(width) << A(i, j) << " "; } ostr << '\n'; @@ -294,12 +295,13 @@ std::ostream& operator<<(std::ostream& ostr, const matrix& A) { // generate a posit format ASCII format nbits.esxNN...NNp template inline std::string hex_format(const matrix< sw::universal::posit >& A) { - // we need to transform the posit into a string + using Scalar = sw::universal::posit; + using size_type = typename matrix::size_type; std::stringstream ostr; - unsigned m = A.rows(); - unsigned n = A.cols(); - for (unsigned i = 0; i < m; ++i) { - for (unsigned j = 0; j < n; ++j) { + size_type m = A.rows(); + size_type n = A.cols(); + for (size_type i = 0; i < m; ++i) { + for (size_type j = 0; j < n; ++j) { ostr << hex_format(A(i,j)) << " "; } ostr << '\n'; @@ -346,10 +348,11 @@ matrix operator/(const matrix& A, const Scalar& b) { // matrix-vector multiply template vector operator*(const matrix& A, const vector& x) { + using size_type = typename matrix::size_type; vector b(A.rows()); - for (unsigned i = 0; i < A.rows(); ++i) { + for (size_type i = 0; i < A.rows(); ++i) { b[i] = Scalar(0); - for (unsigned j = 0; j < A.cols(); ++j) { + for (size_type j = 0; j < A.cols(); ++j) { b[i] += A(i, j) * x[j]; } } @@ -359,15 +362,16 @@ vector operator*(const matrix& A, const vector& x) { template matrix operator*(const matrix& A, const matrix& B) { + using size_type = typename matrix::size_type; if (A.cols() != B.rows()) throw matmul_incompatible_matrices(incompatible_matrices(A.rows(), A.cols(), B.rows(), B.cols(), "*").what()); - unsigned rows = A.rows(); - unsigned cols = B.cols(); - unsigned dots = A.cols(); + size_type rows = A.rows(); + size_type cols = B.cols(); + size_type dots = A.cols(); matrix C(rows, cols); - for (unsigned i = 0; i < rows; ++i) { - for (unsigned j = 0; j < cols; ++j) { + for (size_type i = 0; i < rows; ++i) { + for (size_type j = 0; j < cols; ++j) { Scalar e = Scalar(0); - for (unsigned k = 0; k < dots; ++k) { + for (size_type k = 0; k < dots; ++k) { e += A(i, k) * B(k, j); } C(i, j) = e; @@ -381,14 +385,14 @@ matrix operator*(const matrix& A, const matrix& B) { template matrix operator%(const matrix& A, const matrix& B) { + using size_type = typename matrix::size_type; // Hadamard Product A.*B. Element-wise multiplication. if (A.size() != B.size()) throw matmul_incompatible_matrices(incompatible_matrices(A.rows(), A.cols(), B.rows(), B.cols(), "%").what()); - unsigned rows = A.rows(); - unsigned cols = A.cols(); - + size_type rows = A.rows(); + size_type cols = A.cols(); matrix C(rows, cols); - for (unsigned i = 0; i < rows; ++i) { - for (unsigned j = 0; j < cols; ++j) { + for (size_type i = 0; i < rows; ++i) { + for (size_type j = 0; j < cols; ++j) { C(i, j) = A(i, j) * B(i, j); } } @@ -398,11 +402,12 @@ matrix operator%(const matrix& A, const matrix& B) { // matrix equivalence tests template bool operator==(const matrix& A, const matrix& B) { + using size_type = typename matrix::size_type; if (num_rows(A) != num_rows(B) || num_cols(A) != num_cols(B)) return false; bool equal = true; - for (unsigned i = 0; i < num_rows(A); ++i) { - for (unsigned j = 0; j < num_cols(A); ++j) { + for (size_type i = 0; i < num_rows(A); ++i) { + for (size_type j = 0; j < num_cols(A); ++j) { if (A(i, j) != B(i, j)) { equal = false; break; @@ -423,10 +428,10 @@ bool operator!=(const matrix& A, const matrix& B) { // Matrix > x ==> Matrix with 1/0 representing True/False template matrix operator>(const matrix& A, const Scalar& x) { + using size_type = typename matrix::size_type; matrix B(A.cols(), A.rows()); - - for (unsigned i = 0; i < num_rows(A); ++i) { - for (unsigned j = 0; j < num_cols(A); ++j) { + for (size_type i = 0; i < num_rows(A); ++i) { + for (size_type j = 0; j < num_cols(A); ++j) { B(i,j) = (A(i, j) > x) ? 1 : 0; } } @@ -437,9 +442,10 @@ matrix operator>(const matrix& A, const Scalar& x) { // maxelement (jq 2022-10-15) template Scalar maxelement(const matrix&A) { + using size_type = typename matrix::size_type; auto x = abs(A(0,0)); - for (size_t i = 0; i < num_rows(A); ++i) { - for (size_t j = 0; j < num_cols(A); ++j) { + for (size_type i = 0; i < num_rows(A); ++i) { + for (size_type j = 0; j < num_cols(A); ++j) { x = (abs(A(i, j)) > x) ? abs(A(i, j)) : x; } } @@ -449,9 +455,10 @@ Scalar maxelement(const matrix&A) { // minelement (jq 2022-10-15) template Scalar minelement(const matrix&A) { + using size_type = typename matrix::size_type; auto x = maxelement(A); - for (size_t i = 0; i < num_rows(A); ++i) { - for (size_t j = 0; j < num_cols(A); ++j) { + for (size_type i = 0; i < num_rows(A); ++i) { + for (size_type j = 0; j < num_cols(A); ++j) { x = ((abs(A(i, j)) < x) && (A(i,j)!=0)) ? abs(A(i, j)) : x; } } @@ -462,8 +469,9 @@ Scalar minelement(const matrix&A) { // Gets the ith row of matrix A template vector getRow(unsigned i, const matrix&A) { + using size_type = typename matrix::size_type; vector x(num_cols(A)); - for (size_t j = 0; j < num_cols(A); ++j) { + for (size_type j = 0; j < num_cols(A); ++j) { x(j) = A(i,j); } return x; @@ -472,8 +480,9 @@ vector getRow(unsigned i, const matrix&A) { // Gets the jth column of matrix A template vector getCol(unsigned j, const matrix&A) { + using size_type = typename matrix::size_type; vector x(num_rows(A)); - for (size_t i = 0; i < num_rows(A); ++i) { + for (size_type i = 0; i < num_rows(A); ++i) { x(i) = A(i,j); } return x; @@ -482,9 +491,10 @@ vector getCol(unsigned j, const matrix&A) { // Display Matrix template -void disp(const matrix& A, const size_t COLWIDTH = 10){ - for (size_t i = 0;i& A, const size_t COLWIDTH = 10) { + using size_type = typename matrix::size_type; + for (size_type i = 0; i < num_rows(A); ++i){ + for (size_type j = 0; j < num_cols(A); ++j){ // std::cout < > operator*(const matrix< posit >& A, const // overload for posits uses fused dot products template matrix< posit > operator*(const matrix< posit >& A, const matrix< posit >& B) { + using size_type = typename matrix< posit >::size_type; constexpr unsigned capacity = 20; // FDP for vectors < 1,048,576 elements if (A.cols() != B.rows()) throw matmul_incompatible_matrices(incompatible_matrices(A.rows(), A.cols(), B.rows(), B.cols(), "*").what()); - unsigned rows = A.rows(); - unsigned cols = B.cols(); - unsigned dots = A.cols(); + auto rows = A.rows(); + auto cols = B.cols(); + auto dots = A.cols(); matrix< posit > C(rows, cols); - for (unsigned i = 0; i < rows; ++i) { - for (unsigned j = 0; j < cols; ++j) { + for (size_type i = 0; i < rows; ++i) { + for (size_type j = 0; j < cols; ++j) { quire q; - for (unsigned k = 0; k < dots; ++k) { + for (size_type k = 0; k < dots; ++k) { q += quire_mul(A(i, k), B(k, j)); } convert(q.to_value(), C(i, j)); // one and only rounding step of the fused-dot product diff --git a/include/universal/blas/operators.hpp b/include/universal/blas/operators.hpp index a6ab320fa..431f0dc16 100644 --- a/include/universal/blas/operators.hpp +++ b/include/universal/blas/operators.hpp @@ -1,7 +1,7 @@ #pragma once // operators.hpp: matrix operators // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -11,7 +11,7 @@ namespace sw { namespace universal { namespace blas { // generate identity matrix template -matrix eye(unsigned N) { +matrix eye(typename matrix::size_type N) { matrix I(N, N); I = Scalar(1.0f); return I; @@ -51,26 +51,9 @@ matrix diag(const vector& d) { return A; } -/* -//compute minor in-place -template -matrix minor(const matrix& A, size_t x=1){ - using size_type = typename matrix::size_type; - for (size_t i = 0; i < x; i++){ - (*this)(i,i) = size_type(1.0); - } - for (size_t i = x; i < num_rows(A); ++i){ - for (size_t j = x; j < num_cols(A); ++j){ - (*this)(i,j) = A[i][j]; - } - } - return tmp; -} -*/ - //get mth row template -void row(const matrix& A, vector& v, size_t n){ +void row(const matrix& A, vector& v, unsigned n){ auto nrCols = num_cols(A); if (nrCols != size(v)) { v.clear(); @@ -82,7 +65,7 @@ void row(const matrix& A, vector& v, size_t n){ //get nth column template -void column(const matrix& A, vector& v, size_t n){ +void column(const matrix& A, vector& v, unsigned n){ auto nrRows = num_rows(A); if (nrRows != size(v)) { v.clear(); diff --git a/include/universal/blas/vector.hpp b/include/universal/blas/vector.hpp index c1573c664..ec74eb5b7 100644 --- a/include/universal/blas/vector.hpp +++ b/include/universal/blas/vector.hpp @@ -1,7 +1,7 @@ #pragma once // vector.hpp: Universal vector class that composes std::vector<> // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include diff --git a/include/universal/blas/vmath/power.hpp b/include/universal/blas/vmath/power.hpp index 1e834bb96..05374da0d 100644 --- a/include/universal/blas/vmath/power.hpp +++ b/include/universal/blas/vmath/power.hpp @@ -1,7 +1,7 @@ #pragma once // power.hpp: vectorized power function, takes a base and a vector of exponents, and returns vector of exponentiations // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include diff --git a/include/universal/blas/vmath/sqrt.hpp b/include/universal/blas/vmath/sqrt.hpp new file mode 100644 index 000000000..9baf42164 --- /dev/null +++ b/include/universal/blas/vmath/sqrt.hpp @@ -0,0 +1,23 @@ +#pragma once +// sqrt.hpp: vectorized square root function, takes a base and a vector of exponents, and returns vector of square roots +// +// Copyright (C) 2017 Stillwater Supercomputing, Inc. +// +// This file is part of the universal numbers project, which is released under an MIT Open Source license. +#include +#include + +namespace sw { namespace universal { namespace blas { + +// vector power function +template +vector sqrt(const vector& y) { + using namespace sw::universal; + vector x(y.size()); + for (size_t i = 0; i < y.size(); ++i) { + x[i] = sqrt(y[i]); + } + return x; +} + +} } } // namespace sw::universal::blas diff --git a/include/universal/blas/vmath/square.hpp b/include/universal/blas/vmath/square.hpp new file mode 100644 index 000000000..1a938a4b2 --- /dev/null +++ b/include/universal/blas/vmath/square.hpp @@ -0,0 +1,21 @@ +#pragma once +// square.hpp: vectorized square function, takes a base and a vector of exponents, and returns vector of squares +// +// Copyright (C) 2017 Stillwater Supercomputing, Inc. +// +// This file is part of the universal numbers project, which is released under an MIT Open Source license. +#include +#include + +namespace sw { namespace universal { namespace blas { + +// vector power function +template +vector square(const vector& y) { + using namespace sw::universal; + vector x(y); + x *= y; // element-wise multiplication + return x; +} + +} } } // namespace sw::universal::blas diff --git a/include/universal/blas/vmath/trigonometry.hpp b/include/universal/blas/vmath/trigonometry.hpp index fa4076522..5a9cf9fd5 100644 --- a/include/universal/blas/vmath/trigonometry.hpp +++ b/include/universal/blas/vmath/trigonometry.hpp @@ -1,7 +1,7 @@ #pragma once // trigonometry.hpp: vectorized trigonometry functions // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include diff --git a/include/universal/common/number_traits_reports.hpp b/include/universal/common/number_traits_reports.hpp index 5c14cdb1e..b9241f5c2 100644 --- a/include/universal/common/number_traits_reports.hpp +++ b/include/universal/common/number_traits_reports.hpp @@ -1,7 +1,7 @@ #pragma once // number_traits.hpp: utility functions for working with numeric_limits<> // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. diff --git a/include/universal/dnn/dnn.hpp b/include/universal/dnn/dnn.hpp index 08d22e9b5..9fc20885b 100644 --- a/include/universal/dnn/dnn.hpp +++ b/include/universal/dnn/dnn.hpp @@ -3,7 +3,7 @@ // Super-simple DNN implementation to aid the application, // numerical, and reproducibility examples. // -// Copyright (C) 2021-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2021 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #ifndef _UNIVERSAL_DNN_LIBRARY diff --git a/include/universal/internal/bitblock/bitblock.hpp b/include/universal/internal/bitblock/bitblock.hpp index 07ddb359c..9bde25e01 100644 --- a/include/universal/internal/bitblock/bitblock.hpp +++ b/include/universal/internal/bitblock/bitblock.hpp @@ -660,32 +660,36 @@ std::string to_bit_string(bitblock bits, bool separator = true) { template std::string to_hex(bitblock bits, bool nibbleMarker = false, bool hexPrefix = true) { - char str[(nbits >> 2) + 2]{ 0 }; - for (unsigned i = 0; i < (nbits >> 2) + 2; ++i) str[i] = 0; + std::string hexStr; + //const char* hexits = "0123456789ABCDEF"; const char* hexits = "0123456789abcdef"; - unsigned int maxHexDigits = (nbits >> 2) + ((nbits % 4) ? 1 : 0); - for (unsigned int i = 0; i < maxHexDigits; i++) { - unsigned int hexit; - switch (nbits) { - case 1: - hexit = bits[0]; - break; - case 2: - hexit = static_cast((bits[1] << 1u) + bits[0]); - break; - case 3: - hexit = static_cast((bits[2] << 2u) + (bits[1] << 1u) + bits[0]); - break; - default: - hexit = static_cast((bits[3] << 3u) + (bits[2] << 2u) + (bits[1] << 1u) + bits[0]); - break; + unsigned hexit; + switch (nbits) { + case 1: + hexit = bits[0]; + hexStr = hexits[hexit]; + break; + case 2: + hexit = static_cast((bits[1] << 1u) + bits[0]); + hexStr = hexits[hexit]; + break; + case 3: + hexit = static_cast((bits[2] << 2u) + (bits[1] << 1u) + bits[0]); + hexStr = hexits[hexit]; + break; + default: + { + unsigned nrHexits = (nbits >> 2) + (nbits % 4 ? 0 : 1); + for (unsigned i = 0; i < nrHexits; i++) { + hexit = static_cast((bits[3] << 3u) + (bits[2] << 2u) + (bits[1] << 1u) + bits[0]); + hexStr = hexits[hexit] + hexStr; + if (nibbleMarker && (i % 4) == 0 && i != 0) hexStr = '\'' + hexStr; + bits >>= 4; + } } - str[maxHexDigits - 1 - i] = hexits[hexit]; - bits >>= 4; } - str[maxHexDigits] = 0; // null terminated string - return (hexPrefix ? std::string("0x") : std::string("")) + std::string(str); + return (hexPrefix ? std::string("0x") : std::string("")) + hexStr; } // convert a sign/magnitude number to a string diff --git a/include/universal/internal/blocktriple/trace_constants.hpp b/include/universal/internal/blocktriple/trace_constants.hpp index c90212688..3f3e90326 100644 --- a/include/universal/internal/blocktriple/trace_constants.hpp +++ b/include/universal/internal/blocktriple/trace_constants.hpp @@ -1,7 +1,7 @@ #pragma once // trace_constants.hpp: definition of constants that direct intermediate result reporting // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. @@ -18,7 +18,7 @@ constexpr bool _trace_btriple_add = false; constexpr bool _trace_btriple_sub = false; constexpr bool _trace_btriple_mul = false; constexpr bool _trace_btriple_div = false; -constexpr bool _trace_btriple_reciprocate = false; +constexpr bool _trace_btriple_reciprocal = false; constexpr bool _trace_btriple_sqrt = false; // quire update tracing @@ -34,7 +34,7 @@ constexpr bool _trace_btriple_quire_add = false; #define BLOCKTRIPLE_TRACE_SUB #define BLOCKTRIPLE_TRACE_MUL #define BLOCKTRIPLE_TRACE_DIV -#define BLOCKTRIPLE_TRACE_RECIPROCATE +#define BLOCKTRIPLE_TRACE_RECIPROCAL #define BLOCKTRIPLE_TRACE_SQRT #endif @@ -87,10 +87,10 @@ constexpr bool _trace_btriple_div = false; constexpr bool _trace_btriple_div = true; #endif -#ifndef BLOCKTRIPLE_TRACE_RECIPROCATE -constexpr bool _trace_btriple_reciprocate = false; +#ifndef BLOCKTRIPLE_TRACE_RECIPROCAL +constexpr bool _trace_btriple_reciprocal = false; #else -constexpr bool _trace_btriple_reciprocate = true; +constexpr bool _trace_btriple_reciprocal = true; #endif #ifndef BLOCKTRIPLE_TRACE_SQRT diff --git a/include/universal/math/math_constants.hpp b/include/universal/math/math_constants.hpp index b065fd8af..997a5f178 100644 --- a/include/universal/math/math_constants.hpp +++ b/include/universal/math/math_constants.hpp @@ -1,7 +1,7 @@ #pragma once // math_constants.hpp: definition of math constants // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. diff --git a/include/universal/number/algorithm/trace_constants.hpp b/include/universal/number/algorithm/trace_constants.hpp index 2086e01d0..9627ae1d9 100644 --- a/include/universal/number/algorithm/trace_constants.hpp +++ b/include/universal/number/algorithm/trace_constants.hpp @@ -1,7 +1,7 @@ #pragma once // trace_constants.hpp: definition of constants that direct intermediate result reporting // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. @@ -18,7 +18,7 @@ constexpr bool _trace_add = false; constexpr bool _trace_sub = false; constexpr bool _trace_mul = false; constexpr bool _trace_div = false; -constexpr bool _trace_reciprocate = false; +constexpr bool _trace_reciprocal = false; constexpr bool _trace_sqrt = false; // quire update tracing @@ -34,7 +34,7 @@ constexpr bool _trace_quire_add = false; #define ALGORITHM_TRACE_SUB #define ALGORITHM_TRACE_MUL #define ALGORITHM_TRACE_DIV -#define ALGORITHM_TRACE_RECIPROCATE +#define ALGORITHM_TRACE_RECIPROCAL #define ALGORITHM_TRACE_SQRT #define VALUE_TRACE_CONVERSION @@ -98,10 +98,10 @@ constexpr bool _trace_div = false; constexpr bool _trace_div = true; #endif -#ifndef ALGORITHM_TRACE_RECIPROCATE -constexpr bool _trace_reciprocate = false; +#ifndef ALGORITHM_TRACE_RECIPROCAL +constexpr bool _trace_reciprocal = false; #else -constexpr bool _trace_reciprocate = true; +constexpr bool _trace_reciprocal = true; #endif #ifndef ALGORITHM_TRACE_SQRT diff --git a/include/universal/number/cfloat/attributes.hpp b/include/universal/number/cfloat/attributes.hpp index 5f90074c2..cbc993ae0 100644 --- a/include/universal/number/cfloat/attributes.hpp +++ b/include/universal/number/cfloat/attributes.hpp @@ -1,7 +1,7 @@ #pragma once // attributes.hpp: information functions for classic floating-point type and value attributes // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. diff --git a/include/universal/number/cfloat/cfloat.hpp b/include/universal/number/cfloat/cfloat.hpp index 5a14b1564..4286feada 100644 --- a/include/universal/number/cfloat/cfloat.hpp +++ b/include/universal/number/cfloat/cfloat.hpp @@ -1,6 +1,6 @@ // arbitrary configuration classic floating-point arithmetic standard header // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #ifndef _CFLOAT_STANDARD_HEADER_ @@ -34,6 +34,13 @@ #if !defined(CFLOAT_THROW_ARITHMETIC_EXCEPTION) // default is to use std::cerr for signalling an error #define CFLOAT_THROW_ARITHMETIC_EXCEPTION 0 +#define CFLOAT_EXCEPT noexcept +#else +#if CFLOAT_THROW_ARITHMETIC_EXCEPTION +#define CFLOAT_EXCEPT +#else +#define CFLOAT_EXCEPT noexcept +#endif #endif //////////////////////////////////////////////////////////////////////////////////////// diff --git a/include/universal/number/cfloat/cfloat_fwd.hpp b/include/universal/number/cfloat/cfloat_fwd.hpp index 2ec46a669..fe8baba0f 100644 --- a/include/universal/number/cfloat/cfloat_fwd.hpp +++ b/include/universal/number/cfloat/cfloat_fwd.hpp @@ -1,7 +1,7 @@ #pragma once // cfloat_fwd.hpp : forward declarations of the classic floating-point cfloat environment // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. diff --git a/include/universal/number/cfloat/cfloat_impl.hpp b/include/universal/number/cfloat/cfloat_impl.hpp index c19c3bd24..c06a22f85 100644 --- a/include/universal/number/cfloat/cfloat_impl.hpp +++ b/include/universal/number/cfloat/cfloat_impl.hpp @@ -12,7 +12,7 @@ // 80bit IEEE-754 extended precision floats // true 128bit quad precision floats // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. @@ -477,7 +477,7 @@ class cfloat { return tmp; } - cfloat& operator+=(const cfloat& rhs) { + cfloat& operator+=(const cfloat& rhs) CFLOAT_EXCEPT { if constexpr (_trace_add) std::cout << "---------------------- ADD -------------------" << std::endl; // special case handling of the inputs #if CFLOAT_THROW_ARITHMETIC_EXCEPTION @@ -538,20 +538,20 @@ class cfloat { return *this; } - cfloat& operator+=(double rhs) { + cfloat& operator+=(double rhs) CFLOAT_EXCEPT { return *this += cfloat(rhs); } - cfloat& operator-=(const cfloat& rhs) { + cfloat& operator-=(const cfloat& rhs) CFLOAT_EXCEPT { if constexpr (_trace_sub) std::cout << "---------------------- SUB -------------------" << std::endl; if (rhs.isnan()) return *this += rhs; else return *this += -rhs; } - cfloat& operator-=(double rhs) { + cfloat& operator-=(double rhs) CFLOAT_EXCEPT { return *this -= cfloat(rhs); } - cfloat& operator*=(const cfloat& rhs) { + cfloat& operator*=(const cfloat& rhs) CFLOAT_EXCEPT { if constexpr (_trace_mul) std::cout << "---------------------- MUL -------------------\n"; // special case handling of the inputs #if CFLOAT_THROW_ARITHMETIC_EXCEPTION @@ -614,10 +614,10 @@ class cfloat { return *this; } - cfloat& operator*=(double rhs) { + cfloat& operator*=(double rhs) CFLOAT_EXCEPT { return *this *= cfloat(rhs); } - cfloat& operator/=(const cfloat& rhs) { + cfloat& operator/=(const cfloat& rhs) CFLOAT_EXCEPT { if constexpr (_trace_div) std::cout << "---------------------- DIV -------------------" << std::endl; // special case handling of the inputs @@ -699,9 +699,13 @@ class cfloat { return *this; } - cfloat& operator/=(double rhs) { + cfloat& operator/=(double rhs) CFLOAT_EXCEPT { return *this /= cfloat(rhs); } + cfloat& reciprocal() CFLOAT_EXCEPT { + cfloat c = 1.0 / *this; + return *this = c; + } /// /// move to the next bit encoding modulo 2^nbits /// @@ -3944,4 +3948,25 @@ fma(cfloat x, return fused; } +template +cfloat& +minpos(cfloat& c) { + return c.minpos(); +} +template +cfloat& +maxpos(cfloat& c) { + return c.maxpos(); +} +template +cfloat& +minneg(cfloat& c) { + return c.minneg(); +} +template +cfloat& +maxneg(cfloat& c) { + return c.maxneg(); +} + }} // namespace sw::universal diff --git a/include/universal/number/cfloat/exceptions.hpp b/include/universal/number/cfloat/exceptions.hpp index 66980ad75..de7621136 100644 --- a/include/universal/number/cfloat/exceptions.hpp +++ b/include/universal/number/cfloat/exceptions.hpp @@ -1,7 +1,7 @@ #pragma once // exceptions.hpp: definition of arbitrary configuration cfloat exceptions // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include diff --git a/include/universal/number/cfloat/manipulators.hpp b/include/universal/number/cfloat/manipulators.hpp index fbbe0278b..dc46e50b8 100644 --- a/include/universal/number/cfloat/manipulators.hpp +++ b/include/universal/number/cfloat/manipulators.hpp @@ -1,7 +1,7 @@ #pragma once // manipulators.hpp: definitions of helper functions for classic cfloat type manipulation // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include diff --git a/include/universal/number/cfloat/mathlib.hpp b/include/universal/number/cfloat/mathlib.hpp index b057708ad..d7f9cca95 100644 --- a/include/universal/number/cfloat/mathlib.hpp +++ b/include/universal/number/cfloat/mathlib.hpp @@ -1,7 +1,7 @@ #pragma once // mathlib.hpp: definition of mathematical functions for the classic cfloats // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. diff --git a/include/universal/number/cfloat/numeric_limits.hpp b/include/universal/number/cfloat/numeric_limits.hpp index 05cf9c41f..0e44c75e4 100644 --- a/include/universal/number/cfloat/numeric_limits.hpp +++ b/include/universal/number/cfloat/numeric_limits.hpp @@ -1,7 +1,7 @@ #pragma once // numeric_limits.hpp: definition of numeric_limits for classic cfloat types // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include diff --git a/include/universal/number/posit/attributes.hpp b/include/universal/number/posit/attributes.hpp index 901d40a98..4c0e9f739 100644 --- a/include/universal/number/posit/attributes.hpp +++ b/include/universal/number/posit/attributes.hpp @@ -109,7 +109,7 @@ posit maxprecision_max() { a.clear(); a.setbit(nbits - 2, true); // set all exponent and fraction bits to 1 - for (int i = 0; i < nbits - 1 - 2; ++i) { + for (unsigned i = 0; i < nbits - 1 - 2; ++i) { a.setbit(i, true); } return a; diff --git a/include/universal/number/posit/math/sqrt.hpp b/include/universal/number/posit/math/sqrt.hpp index f078db212..2ac8813fa 100644 --- a/include/universal/number/posit/math/sqrt.hpp +++ b/include/universal/number/posit/math/sqrt.hpp @@ -131,7 +131,7 @@ namespace sw { namespace universal { template inline posit rsqrt(const posit& a) { posit v = sqrt(a); - return v.reciprocate(); + return v.reciprocal(); } /////////////////////////////////////////////////////////////////// diff --git a/include/universal/number/posit/posit_impl.hpp b/include/universal/number/posit/posit_impl.hpp index 1cb5010b4..887663cff 100644 --- a/include/universal/number/posit/posit_impl.hpp +++ b/include/universal/number/posit/posit_impl.hpp @@ -351,7 +351,6 @@ inline posit& convert_(bool _sign, int _scale, const bitblock& int nbits_plus_one = static_cast(nbits) + 1; int sign_regime_es = 2 + int(run) + static_cast(es); unsigned nf = (unsigned)std::max(0, (nbits_plus_one - sign_regime_es)); - //unsigned nf = (unsigned)std::max(0, (static_cast(nbits + 1) - (2 + run + static_cast(es)))); // TODO: what needs to be done if nf > fbits? //assert(nf <= input_fbits); // copy the most significant nf fraction bits into fraction @@ -914,8 +913,8 @@ class posit { return *this /= posit(rhs); } - posit reciprocate() const { - if (_trace_reciprocate) std::cout << "-------------------- RECIPROCATE ----------------" << std::endl; + posit reciprocal() const { + if (_trace_reciprocal) std::cout << "-------------------- RECIPROCATE ----------------" << std::endl; posit p; // special case of NaR (Not a Real) if (isnar()) { @@ -950,7 +949,7 @@ class posit { constexpr unsigned reciprocal_size = 3 * fbits + 4; internal::bitblock reciprocal; divide_with_fraction(one, frac, reciprocal); - if (_trace_reciprocate) { + if (_trace_reciprocal) { std::cout << "one " << one << std::endl; std::cout << "frac " << frac << std::endl; std::cout << "recip " << reciprocal << std::endl; @@ -958,14 +957,14 @@ class posit { // radix point falls at operand size == reciprocal_size - operand_size - 1 reciprocal <<= operand_size - 1; - if (_trace_reciprocate) std::cout << "frac " << reciprocal << std::endl; + if (_trace_reciprocal) std::cout << "frac " << reciprocal << std::endl; int new_scale = -scale(*this); int msb = findMostSignificantBit(reciprocal); if (msb > 0) { int shift = static_cast(reciprocal_size - static_cast(msb)); reciprocal <<= static_cast(shift); new_scale -= (shift-1); - if (_trace_reciprocate) std::cout << "result " << reciprocal << std::endl; + if (_trace_reciprocal) std::cout << "result " << reciprocal << std::endl; } //std::bitset tr; //truncate(reciprocal, tr); diff --git a/include/universal/number/posit/specialized/posit_16_1.hpp b/include/universal/number/posit/specialized/posit_16_1.hpp index 0f90342b7..7c5d56ac6 100644 --- a/include/universal/number/posit/specialized/posit_16_1.hpp +++ b/include/universal/number/posit/specialized/posit_16_1.hpp @@ -419,7 +419,7 @@ class posit { return tmp; } - posit reciprocate() const noexcept { + posit reciprocal() const noexcept { posit p = 1.0 / *this; return p; } diff --git a/include/universal/number/posit/specialized/posit_16_2.hpp b/include/universal/number/posit/specialized/posit_16_2.hpp index 3ca0997c6..4b96761d8 100644 --- a/include/universal/number/posit/specialized/posit_16_2.hpp +++ b/include/universal/number/posit/specialized/posit_16_2.hpp @@ -84,7 +84,7 @@ class posit { explicit constexpr posit(unsigned long initial_value) : _bits(0) { *this = initial_value; } explicit constexpr posit(unsigned long long initial_value) : _bits(0) { *this = initial_value; } explicit posit(float initial_value) : _bits(0) { *this = initial_value; } - posit(double initial_value) : _bits(0) { *this = initial_value; } + posit(double initial_value) : _bits(0) { *this = initial_value; } explicit posit(long double initial_value) : _bits(0) { *this = initial_value; } // assignment operators for native types @@ -98,9 +98,9 @@ class posit { constexpr posit& operator=(unsigned int rhs) { return integer_assign(rhs); } constexpr posit& operator=(unsigned long rhs) { return integer_assign(rhs); } constexpr posit& operator=(unsigned long long rhs) { return integer_assign(rhs); } - posit& operator=(float rhs) { return float_assign(double(rhs)); } - posit& operator=(double rhs) { return float_assign(rhs); } - posit& operator=(long double rhs) { return float_assign(double(rhs)); } + posit& operator=(float rhs) { return float_assign(double(rhs)); } + posit& operator=(double rhs) { return float_assign(rhs); } + posit& operator=(long double rhs) { return float_assign(double(rhs)); } explicit operator long double() const { return to_long_double(); } explicit operator double() const { return to_double(); } @@ -112,11 +112,13 @@ class posit { explicit operator unsigned long() const { return to_long(); } explicit operator unsigned int() const { return to_int(); } - // arithmetic assignment operators constexpr posit operator-() const { posit p; return p.setbits((~_bits) + 1ul); } + + //////////////////////////////////////////////////////////////// + // arithmetic assignment operators posit& operator+=(const posit& b) { // process special cases #if POSIT_THROW_ARITHMETIC_EXCEPTION @@ -135,10 +137,10 @@ class posit { uint16_t lhs = _bits; uint16_t rhs = b._bits; - bool sign = bool(_bits & sign_mask); + bool sign = (_bits & sign_mask) != 0; if (sign) { - lhs = -lhs & 0xFFFF; - rhs = -rhs & 0xFFFF; + lhs = -lhs & 0xFFFFu; + rhs = -rhs & 0xFFFFu; } if (lhs < rhs) std::swap(lhs, rhs); @@ -151,12 +153,12 @@ class posit { uint16_t exp = remaining >> 13; // 16 - 1(sign) - 2(exponent) // extract remaining fraction bits - uint32_t lhs_fraction = ((0x4000 | remaining << 1) & 0x7FFF) << 16; // 0x4000 is the hidden bit + uint32_t lhs_fraction = ((0x4000u | remaining << 1) & 0x7FFFu) << 16; // 0x4000 is the hidden bit int8_t shiftRight = k; // adjust shift and extract fraction bits of rhs extractAddand(rhs, shiftRight, remaining); - uint32_t rhs_fraction = ((0x4000 | remaining << 1) & 0x7FFF) << 16; // 0x4000 is the hidden bit + uint32_t rhs_fraction = ((0x4000u | remaining << 1) & 0x7FFFu) << 16; // 0x4000 is the hidden bit // This is 4kZ + expZ; (where kZ=kA-kB and expZ=expA-expB) shiftRight = (shiftRight << 2) + exp - (remaining >> 13); @@ -166,7 +168,7 @@ class posit { ++exp; if (exp > 3) { ++k; - exp &= 0x3; + exp &= 0x3u; } lhs_fraction >>= 1; } @@ -174,7 +176,7 @@ class posit { (shiftRight > 15) ? (rhs_fraction = 0) : (rhs_fraction >>= shiftRight); // frac16B >>= shiftRight lhs_fraction += rhs_fraction; - bool rcarry = (0x8000'0000 & lhs_fraction) != 0; // first left bit + bool rcarry = (0x8000'0000u & lhs_fraction) != 0; // first left bit if (rcarry) { ++exp; if (exp > 3) { @@ -186,7 +188,7 @@ class posit { } _bits = round(k, exp, lhs_fraction); - if (sign) _bits = -_bits & 0xFFFF; + if (sign) _bits = -_bits & 0xFFFFu; return *this; } posit& operator-=(const posit& b) { @@ -202,7 +204,7 @@ class posit { } #endif if (b.iszero()) return *this; - if (iszero()) { _bits = -int16_t(b._bits) & 0xFFFF; return *this; } + if (iszero()) { _bits = -int16_t(b._bits) & 0xFFFFu; return *this; } posit bComplement = b.twosComplement(); if (isneg() != b.isneg()) return *this += bComplement; @@ -210,10 +212,10 @@ class posit { uint16_t rhs = bComplement._bits; // Both operands are actually the same sign if rhs inherits sign of sub: Make both positive bool sign = bool(lhs & sign_mask); - (sign) ? (lhs = (-lhs & 0xFFFF)) : (rhs = (-rhs & 0xFFFF)); + (sign) ? (lhs = (-lhs & 0xFFFFu)) : (rhs = (-rhs & 0xFFFFu)); if (lhs == rhs) { - _bits = 0x0; + _bits = 0; return *this; } if (lhs < rhs) { @@ -229,19 +231,19 @@ class posit { // extract the exponent uint16_t exp = remaining >> 13; // 16 - 1(sign) - 2(exponent) - uint32_t lhs_fraction = ((0x4000 | remaining << 1) & 0x7FFF) << 16; // 0x4000 is the hidden bit + uint32_t lhs_fraction = ((0x4000u | remaining << 1) & 0x7FFFu) << 16; // 0x4000 is the hidden bit int8_t shiftRight = k; // adjust shift and extract fraction bits of rhs extractAddand(rhs, shiftRight, remaining); - uint32_t rhs_fraction = ((0x4000 | remaining << 1) & 0x7FFF) << 16; // 0x4000 is the hidden bit + uint32_t rhs_fraction = ((0x4000u | remaining << 1) & 0x7FFFu) << 16; // 0x4000 is the hidden bit // align the fractions for subtraction // This is 4kZ + expZ; (where kZ=kA-kB and expZ=expA-expB) shiftRight = (shiftRight << 2) + exp - (remaining >> 13); if (shiftRight > 31) { _bits = lhs; - if (sign) _bits = -_bits & 0xFFFF; + if (sign) _bits = -_bits & 0xFFFFu; return *this; } else { @@ -255,7 +257,7 @@ class posit { lhs_fraction <<= 4; } - bool ecarry = (0x4000'0000 & lhs_fraction) != 0; + bool ecarry = (0x4000'0000u & lhs_fraction) != 0; while (!ecarry) { if (exp == 0) { --k; @@ -265,11 +267,11 @@ class posit { --exp; } lhs_fraction <<= 1; - ecarry = (0x4000'0000 & lhs_fraction) != 0; + ecarry = (0x4000'0000u & lhs_fraction) != 0; } _bits = round(k, exp, lhs_fraction); - if (sign) _bits = -_bits & 0xFFFF; + if (sign) _bits = -_bits & 0xFFFFu; return *this; } posit& operator*=(const posit& b) { @@ -285,7 +287,7 @@ class posit { } #endif if (iszero() || b.iszero()) { - _bits = 0x0000; + _bits = 0; return *this; } uint16_t lhs = _bits; @@ -304,12 +306,12 @@ class posit { int16_t exp = (remaining >> 13); // 16 - 1(sign) - 2(exponent) // extract remaining fraction bits - uint16_t lhs_fraction = (0x4000 | remaining << 1) & 0x7FFF; // 0x4000 is the hidden bit + uint16_t lhs_fraction = (0x4000u | remaining << 1) & 0x7FFFu; // 0x4000 is the hidden bit // adjust shift and extract fraction bits of rhs extractMultiplicand(rhs, m, remaining); exp += (remaining >> 13); - uint16_t rhs_fraction = (0x4000 | remaining << 1) & 0x7FFF; // 0x4000 is the hidden bit + uint16_t rhs_fraction = (0x4000u | remaining << 1) & 0x7FFFu; // 0x4000 is the hidden bit uint32_t result_fraction = (uint32_t)lhs_fraction * rhs_fraction; if (exp > 3) { @@ -317,21 +319,21 @@ class posit { exp &= 0x3; } - bool rcarry = (result_fraction & 0x2000'0000) != 0; + bool rcarry = (result_fraction & 0x2000'0000u) != 0; if (rcarry) { //std::cerr << "fraction carry processing commensing\n"; //std::cerr << to_binary(*this, true) << " * " << to_binary(b, true) << '\n'; exp++; if (exp > 3) { ++m; - exp &= 0x3; + exp &= 3; } result_fraction >>= 1; } // round _bits = adjustAndRound(m, exp, result_fraction); - if (sign) _bits = -_bits & 0xFFFF; + if (sign) _bits = -_bits & 0xFFFFu; return *this; } posit& operator/=(const posit& b) { @@ -357,7 +359,7 @@ class posit { uint16_t lhs = _bits; uint16_t rhs = b._bits; if (iszero()) { - _bits = 0x0000; + _bits = 0; return *this; } @@ -378,7 +380,7 @@ class posit { //std::cout << "lhs exp : " << exp << '\n'; // extract remaining fraction bits - uint16_t lhs_fraction = (0x4000 | remaining << 1) & 0x7FFF; // 0x4000 is the hidden bit + uint16_t lhs_fraction = (0x4000u | remaining << 1) & 0x7FFFu; // 0x4000 is the hidden bit uint32_t fraction = (uint32_t) lhs_fraction << 14; //std::cout << "fraction : " << to_binary(fraction, 32, true) << '\n'; @@ -390,7 +392,7 @@ class posit { //std::cout << "rhs exp : " << rhsExp << '\n'; //std::cout << "final exp : " << exp << '\n'; - uint16_t rhs_fraction = (0x4000 | remaining << 1) & 0x7FFF; // 0x4000 is the hidden bit + uint16_t rhs_fraction = (0x4000u | remaining << 1) & 0x7FFFu; // 0x4000 is the hidden bit //std::cout << "lhs frac : " << to_binary(lhs_fraction, 16, true) << '\n'; //std::cout << "rhs frac : " << to_binary(rhs_fraction, 16, true) << '\n'; @@ -410,7 +412,7 @@ class posit { if (!rcarry) { if (exp == 0) { --m; - exp = 0x3u; + exp = 3; } else { --exp; @@ -421,7 +423,7 @@ class posit { // round _bits = divRound(m, exp, result_fraction, remainder != 0); - if (sign) _bits = -_bits & 0xFFFF; + if (sign) _bits = -_bits & 0xFFFFu; return *this; } @@ -445,7 +447,7 @@ class posit { return tmp; } - posit reciprocate() const noexcept { + posit reciprocal() const noexcept { posit p = 1.0 / *this; return p; } @@ -459,14 +461,15 @@ class posit { // Selectors bool sign() const noexcept { return (_bits & sign_mask); } bool isnar() const noexcept { return (_bits == sign_mask); } + bool isnan() const noexcept { return isnar(); } bool iszero() const noexcept { return (_bits == 0x0); } - bool isone() const noexcept { return (_bits == 0x4000); } // pattern 010000... - bool isminusone() const noexcept { return (_bits == 0xC000); } // pattern 110000... + bool isone() const noexcept { return (_bits == 0x4000u); } // pattern 010000... + bool isminusone() const noexcept { return (_bits == 0xC000u); } // pattern 110000... bool isneg() const noexcept { return (_bits & sign_mask); } bool ispos() const noexcept { return !isneg(); } - bool ispowerof2() const noexcept { return !(_bits & 0x1); } + bool ispowerof2() const noexcept { return !(_bits & 0x1u); } - int sign_value() const noexcept { return (_bits & 0x8 ? -1 : 1); } + int sign_value() const noexcept { return (_bits & sign_mask ? -1 : 1); } bitblock get() const noexcept { bitblock bb; bb = int(_bits); return bb; } uint16_t bits() const noexcept { return _bits; } @@ -481,7 +484,7 @@ class posit { return *this; } constexpr posit& setbits(uint64_t value) noexcept { - _bits = uint16_t(value & 0xffffu); + _bits = uint16_t(value & 0xFFFFu); return *this; } constexpr posit& setbit(unsigned bitIndex, bool value = true) noexcept { @@ -623,28 +626,9 @@ class posit { return s * r * e * f; } long double to_long_double() const { - if (iszero()) return 0.0; - if (isnar()) return NAN; - bool _sign; - regime _regime; - exponent _exponent; - fraction _fraction; - bitblock _raw_bits; - _raw_bits.reset(); - uint64_t mask = 1; - for (unsigned i = 0; i < nbits; i++) { - _raw_bits.set(i, (_bits & mask)); - mask <<= 1; - } - decode(_raw_bits, _sign, _regime, _exponent, _fraction); - long double s = (_sign ? -1.0 : 1.0); - long double r = _regime.value(); - long double e = _exponent.value(); - long double f = (1.0 + _fraction.value()); - return s * r * e * f; + return (long double)to_double(); } - // helper methods constexpr posit& integer_assign(long long rhs) { // special case for speed as this is a common initialization @@ -654,10 +638,10 @@ class posit { } // geometric range of the posit<16,2> - // maxpos = 72,057,594,037,927,936 0x0100'0000'0000'0000 - // maxpos / 2 = 36,028,797,018,963,968 0x0080'0000'0000'0000 - // maxpos / 3/8 = 27,021,597,764,222,976 0x0060'0000'0000'0000 - // maxpos / 4 = 18,014,398,509,481,984 0x0040'0000'0000'0000 + // maxpos = 72,057,594,037,927,936 0b0111'1111'1111'1111 + // maxpos / 2 = 36,028,797,018,963,968 0b0111'1111'1111'1110 + // maxpos / 3/8 = 27,021,597,764,222,976 0b0111'1111'1111'1101 + // maxpos / 4 = 18,014,398,509,481,984 0b0111'1111'1111'1100 bool sign = (rhs < 0); uint64_t v = sign ? -rhs : rhs; // project to positve side of the projective reals uint16_t raw = 0; @@ -694,9 +678,9 @@ class posit { //std::cout << "exp : " << to_binary(exp, 16, true) << '\n'; //std::cout << "fra : " << to_binary(fra, 16, true) << '\n'; - raw = (0x7FFF ^ (0x3FFF >> k)) | exp | (fraction_bits >> (k + 43)); + raw = (0x7FFFu ^ (0x3FFFu >> k)) | exp | (fraction_bits >> (k + 43)); - mask = 0x1000u << k; // bitNPlusOne + mask = 0x1000ul << k; // bitNPlusOne if (mask & fraction_bits) { std::cerr << "TBD: bitNPlusOne condition is triggered in posit<16,2>::integer_assign\n"; if (((mask - 1) & fraction_bits) | ((mask << 1) & fraction_bits)) raw++; // increment by 1 @@ -737,95 +721,95 @@ class posit { // identical bits in the regime, if the bits are 0s, then k = −m; // if they are 1s, then k = m − 1. void decode_regime(const uint16_t bits, int8_t& m, uint16_t& remaining) const noexcept { - remaining = (bits << 2) & 0xFFFF; // sign and first regime bit - if (bits & 0x4000) { // positive regimes + remaining = (bits << 2) & 0xFFFFu; // sign and first regime bit + if (bits & 0x4000u) { // positive regimes m = 0; while (remaining >> 15) { ++m; - remaining = (remaining << 1) & 0xFFFF; + remaining = (remaining << 1) & 0xFFFFu; } } else { // negative regimes m = -1; while (!(remaining >> 15)) { --m; - remaining = (remaining << 1) & 0xFFFF; + remaining = (remaining << 1) & 0xFFFFu; } - remaining &= 0x7FFF; + remaining &= 0x7FFFu; } } void extractAddand(const uint16_t bits, int8_t& shift, uint16_t& remaining) const noexcept { - remaining = (bits << 2) & 0xFFFF; - if (bits & 0x4000) { // positive regimes + remaining = (bits << 2) & 0xFFFFu; + if (bits & 0x4000u) { // positive regimes while (remaining >> 15) { --shift; - remaining = (remaining << 1) & 0xFFFF; + remaining = (remaining << 1) & 0xFFFFu; } } else { // negative regimes ++shift; while (!(remaining >> 15)) { ++shift; - remaining = (remaining << 1) & 0xFFFF; + remaining = (remaining << 1) & 0xFFFFu; } - remaining &= 0x7FFF; + remaining &= 0x7FFFu; } } void extractMultiplicand(const uint16_t bits, int8_t& m, uint16_t& remaining) const noexcept { - remaining = (bits << 2) & 0xFFFF; - if (bits & 0x4000) { // positive regimes + remaining = (bits << 2) & 0xFFFFu; + if (bits & 0x4000u) { // positive regimes while (remaining >> 15) { ++m; - remaining = (remaining << 1) & 0xFFFF; + remaining = (remaining << 1) & 0xFFFFu; } } else { // negative regimes --m; while (!(remaining >> 15)) { --m; - remaining = (remaining << 1) & 0xFFFF; + remaining = (remaining << 1) & 0xFFFFu; } - remaining &= 0x7FFF; + remaining &= 0x7FFFu; } } void extractDividand(const uint16_t bits, int8_t& m, uint16_t& remaining) const noexcept { - remaining = (bits << 2) & 0xFFFF; - if (bits & 0x4000) { // positive regimes + remaining = (bits << 2) & 0xFFFFu; + if (bits & 0x4000u) { // positive regimes while (remaining >> 15) { --m; - remaining = (remaining << 1) & 0xFFFF; + remaining = (remaining << 1) & 0xFFFFu; } } else { // negative regimes ++m; while (!(remaining >> 15)) { ++m; - remaining = (remaining << 1) & 0xFFFF; + remaining = (remaining << 1) & 0xFFFFu; } - remaining &= 0x7FFF; + remaining &= 0x7FFFu; } } - uint16_t round(const int8_t m, uint16_t exp, uint32_t fraction) const noexcept { + uint16_t round(const int8_t m, uint16_t exp, uint32_t frac32) const noexcept { uint16_t reglen, regime, bits; if (m < 0) { - reglen = (-m & 0xFFFF); - regime = 0x4000 >> reglen; + reglen = (-m & 0xFFFFu); + regime = 0x4000u >> reglen; } else { reglen = int16_t(m) + 1; - regime = 0x7FFF - (0x7FFF >> reglen); + regime = 0x7FFFu - (0x7FFFu >> reglen); } if (reglen > 14) { - bits = (m<0 ? 0x0001 : 0x7FFF); // minpos and maxpos. exp and frac do not matter + bits = (m<0 ? 0x0001u : 0x7FFFu); // minpos and maxpos. exp and frac do not matter } else { - fraction = (fraction & 0x3FFFFFFF) >> (reglen + 2); // remove both carry bits, 2 bits exp - uint16_t final_fbits = uint16_t(fraction >> 16); + frac32 = (frac32 & 0x3FFF'FFFFu) >> (reglen + 2); // remove both carry bits, 2 bits exp + uint16_t fraction = uint16_t(frac32 >> 16); bool bitNPlusOne = false; uint16_t moreBits = 0; if (reglen <= 12) { - bitNPlusOne = bool(0x8000 & fraction); + bitNPlusOne = (0x8000u & frac32) != 0; exp <<= (12 - reglen); } else { @@ -838,17 +822,17 @@ class posit { bitNPlusOne = bool(exp & 0x1); exp >>= 1; } - if (final_fbits > 0) { - final_fbits = 0; + if (fraction > 0) { + fraction = 0; moreBits = 1; } } - bits = uint16_t(regime) + uint16_t(exp) + uint16_t(final_fbits); + bits = regime | exp | fraction; // n+1 frac bit is 1. Need to check if another bit is 1 too if not round to even if (bitNPlusOne) { - if (0x7FFF & fraction) moreBits = 1; - bits += (bits & 0x0001) | moreBits; + if (0x7FFFu & frac32) moreBits = 1; + bits += (bits & 0x0001u) | moreBits; } } return bits; @@ -894,12 +878,12 @@ class posit { } } if (nonZeroRemainder) moreBits = 0x1; - bits = uint32_t(regime) | uint32_t(exp) | uint32_t(fraction); + bits = regime | exp | uint16_t(fraction); if (bitNPlusOne) bits += (bits & 0x1) | moreBits; } return bits; } - inline uint16_t adjustAndRound(const int8_t m, uint16_t exp, uint32_t fraction) const noexcept { + inline uint16_t adjustAndRound(const int8_t m, uint16_t exp, uint32_t frac32) const noexcept { uint16_t reglen, regime, bits; if (m < 0) { reglen = (-m & 0xFFFF); @@ -915,12 +899,12 @@ class posit { } else { // remove carry and rcarry bits and shift to correct position - fraction = (fraction & 0x0FFFFFFF) >> reglen; - uint16_t final_fbits = uint16_t(fraction >> 16); + frac32 = (frac32 & 0x0FFF'FFFFu) >> reglen; + uint16_t fraction = uint16_t(frac32 >> 16); bool bitNPlusOne = false; uint16_t moreBits = 0; if (reglen <= 12) { - bitNPlusOne = bool(0x8000 & fraction); + bitNPlusOne = bool(0x8000 & frac32); exp <<= (12 - reglen); } else { @@ -933,21 +917,22 @@ class posit { bitNPlusOne = bool(exp & 0x1); exp >>= 1; } - if (final_fbits > 0) { - final_fbits = 0; + if (fraction > 0) { + fraction = 0; moreBits = 1; } } - bits = uint16_t(regime) + uint16_t(exp) + uint16_t(final_fbits); + bits = regime | exp | fraction; // n+1 frac bit is 1. Need to check if another bit is 1 too if not round to even if (bitNPlusOne) { - if (0x7FFF & fraction) moreBits = 1; + if (0x7FFF & frac32) moreBits = 1; bits += (bits & 0x0001) | moreBits; } } return bits; } + // I/O operators friend std::ostream& operator<< (std::ostream& ostr, const posit& p); friend std::istream& operator>> (std::istream& istr, posit& p); diff --git a/include/universal/number/posit/specialized/posit_2_0.hpp b/include/universal/number/posit/specialized/posit_2_0.hpp index c344c8eb5..04c08a58b 100644 --- a/include/universal/number/posit/specialized/posit_2_0.hpp +++ b/include/universal/number/posit/specialized/posit_2_0.hpp @@ -1,7 +1,7 @@ #pragma once // posit_2_0.hpp: specialized 2-bit posit using lookup table arithmetic // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // First implementation: 2018 // // This file is part of the universal numbers project, which is released under an MIT Open Source license. @@ -236,7 +236,7 @@ class posit { operator--(); return tmp; } - posit reciprocate() const { + posit reciprocal() const { posit p; p.setbits(posit_2_0_reciprocal_lookup[_bits]); return p; diff --git a/include/universal/number/posit/specialized/posit_32_2.hpp b/include/universal/number/posit/specialized/posit_32_2.hpp index 0cef56a06..99609d3de 100644 --- a/include/universal/number/posit/specialized/posit_32_2.hpp +++ b/include/universal/number/posit/specialized/posit_32_2.hpp @@ -434,7 +434,7 @@ class posit { operator--(); return tmp; } - posit reciprocate() const { + posit reciprocal() const { posit p = 1.0 / *this; return p; } diff --git a/include/universal/number/posit/specialized/posit_3_0.hpp b/include/universal/number/posit/specialized/posit_3_0.hpp index c20d5dae5..019364010 100644 --- a/include/universal/number/posit/specialized/posit_3_0.hpp +++ b/include/universal/number/posit/specialized/posit_3_0.hpp @@ -33,7 +33,7 @@ namespace sw { namespace universal { 111 -0.5 */ constexpr float posit_3_0_values_lookup[8] = { - 0.0f, 0.5f, 1.0f, 2.0f, -INFINITY, -2.0f, -1.0f, -0.5f, + 0.0f, 0.5f, 1.0f, 2.0f, -(INFINITY), -2.0f, -1.0f, -0.5f, }; constexpr uint8_t posit_3_0_addition_lookup[64] = { @@ -144,26 +144,14 @@ class posit { } } - posit(int initial_value) { *this = (long long)initial_value; } - posit(long int initial_value) { *this = (long long)initial_value; } - posit(long long initial_value) { *this = initial_value; } - posit(float initial_value) { - *this = float_assign(initial_value); - } - posit(double initial_value) { - *this = float_assign(initial_value); - } - posit(long double initial_value) { - *this = float_assign(initial_value); - } + posit(int initial_value) { *this = initial_value; } + posit(long long initial_value) { *this = (int)initial_value; } + posit(float initial_value) { *this = float_assign(initial_value); } + posit(double initial_value) { *this = float_assign(initial_value); } + posit(long double initial_value) { *this = float_assign(initial_value); } + // assignment operators for native types - posit& operator=(int rhs) { - return operator=((long long)(rhs)); - } - posit& operator=(long int rhs) { - return operator=((long long)(rhs)); - } - posit& operator=(long long rhs) { + posit& operator=(int rhs) noexcept { // only valid integers are -2, -1, 0, 1, 2 _bits = 0x00; if (rhs <= -2) { @@ -183,25 +171,20 @@ class posit { } return *this; } - posit& operator=(const float rhs) { - return float_assign(rhs); - } - posit& operator=(const double rhs) { - return float_assign(rhs); - } - posit& operator=(const long double rhs) { - return float_assign(rhs); - } - - explicit operator long double() const { return to_long_double(); } - explicit operator double() const { return to_double(); } - explicit operator float() const { return to_float(); } - explicit operator long long() const { return to_long_long(); } - explicit operator long() const { return to_long(); } - explicit operator int() const { return to_int(); } + posit& operator=(long long rhs) noexcept { return operator=((int)rhs); } + posit& operator=(float rhs) noexcept { return float_assign(rhs); } + posit& operator=(double rhs) noexcept { return float_assign(rhs); } + posit& operator=(long double rhs) noexcept { return float_assign(rhs); } + + explicit operator long double() const { return to_long_double(); } + explicit operator double() const { return to_double(); } + explicit operator float() const { return to_float(); } + explicit operator long long() const { return to_long_long(); } + explicit operator long() const { return to_long(); } + explicit operator int() const { return to_int(); } explicit operator unsigned long long() const { return to_long_long(); } - explicit operator unsigned long() const { return to_long(); } - explicit operator unsigned int() const { return to_int(); } + explicit operator unsigned long() const { return to_long(); } + explicit operator unsigned int() const { return to_int(); } posit& setBitblock(sw::universal::bitblock& raw) { _bits = uint8_t(raw.to_ulong() & bit_mask); @@ -281,50 +264,51 @@ class posit { operator--(); return tmp; } - posit reciprocate() const { + posit reciprocal() const { posit p; p.setbits(posit_3_0_reciprocal_lookup[_bits]); return p; } + // SELECTORS - inline bool sign() const { return (_bits & 0x4u); } - inline bool isnar() const { return (_bits == nar_encoding); } - inline bool iszero() const { return (_bits == 0x0u); } - inline bool isone() const { // pattern 010.... + bool sign() const { return (_bits & 0x4u); } + bool isnar() const { return (_bits == nar_encoding); } + bool iszero() const { return (_bits == 0x0u); } + bool isone() const { // pattern 010.... return (_bits == one_encoding); } - inline bool isminusone() const { // pattern 110... + bool isminusone() const { // pattern 110... return (_bits == minus_one_encoding); } - inline bool isneg() const { return (_bits & 0x4u); } - inline bool ispos() const { return !isneg(); } - inline bool ispowerof2() const { return !(_bits & 0x1u); } + bool isneg() const { return (_bits & 0x4u); } + bool ispos() const { return !isneg(); } + bool ispowerof2() const { return !(_bits & 0x1u); } - inline int sign_value() const { return (_bits & 0x4 ? -1 : 1); } + int sign_value() const { return (_bits & 0x4 ? -1 : 1); } bitblock get() const { bitblock bb; bb = int(_bits); return bb; } unsigned int bits() const { return (unsigned int)(_bits & bit_mask); } - inline void clear() { _bits = 0x00; } - inline void setzero() { _bits = 0x00; } - inline void setnar() { _bits = nar_encoding; } - inline posit& minpos() { + void clear() { _bits = 0x00; } + void setzero() { _bits = 0x00; } + void setnar() { _bits = nar_encoding; } + posit& minpos() { clear(); return ++(*this); } - inline posit& maxpos() { + posit& maxpos() { setnar(); return --(*this); } - inline posit& zero() { + posit& zero() { clear(); return *this; } - inline posit& minneg() { + posit& minneg() { clear(); return --(*this); } - inline posit& maxneg() { + posit& maxneg() { setnar(); return ++(*this); } diff --git a/include/universal/number/posit/specialized/posit_3_1.hpp b/include/universal/number/posit/specialized/posit_3_1.hpp index 3c704796a..c6ed3b446 100644 --- a/include/universal/number/posit/specialized/posit_3_1.hpp +++ b/include/universal/number/posit/specialized/posit_3_1.hpp @@ -1,7 +1,7 @@ #pragma once // posit_3_1.hpp: specialized 3-bit posit using lookup table arithmetic // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. @@ -73,15 +73,42 @@ namespace sw { namespace universal { posit& operator=(const posit&) = default; posit& operator=(posit&&) = default; - posit(int initial_value) { _bits = uint8_t(initial_value & 0x07); } - // assignment operators for native types - posit& operator=(int rhs) { - return operator=((long long)(rhs)); - } - posit& operator=(long int rhs) { - return operator=((long long)(rhs)); + // specific value constructor + constexpr posit(const SpecificValue code) : _bits(0) { + switch (code) { + case SpecificValue::infpos: + case SpecificValue::maxpos: + maxpos(); + break; + case SpecificValue::minpos: + minpos(); + break; + case SpecificValue::zero: + default: + zero(); + break; + case SpecificValue::minneg: + minneg(); + break; + case SpecificValue::infneg: + case SpecificValue::maxneg: + maxneg(); + break; + case SpecificValue::qnan: + case SpecificValue::snan: + case SpecificValue::nar: + setnar(); + break; + } } - posit& operator=(long long rhs) { + + posit(int initial_value) { *this = initial_value; } + posit(float initial_value) { *this = float_assign(initial_value); } + posit(double initial_value) { *this = float_assign(initial_value); } + posit(long double initial_value) { *this = float_assign(initial_value); } + + // assignment operators for native types + posit& operator=(int rhs) noexcept { // only valid integers are -1, 0, 1 _bits = 0x0; if (rhs <= -1) { @@ -95,25 +122,19 @@ namespace sw { namespace universal { } return *this; } - posit& operator=(const float rhs) { - return float_assign(rhs); - } - posit& operator=(const double rhs) { - return float_assign(rhs); - } - posit& operator=(const long double rhs) { - return float_assign(rhs); - } + posit& operator=(float rhs) noexcept { return float_assign(rhs); } + posit& operator=(double rhs) noexcept { return float_assign(rhs); } + posit& operator=(long double rhs) noexcept { return float_assign(rhs); } - explicit operator long double() const { return to_long_double(); } - explicit operator double() const { return to_double(); } - explicit operator float() const { return to_float(); } - explicit operator long long() const { return to_long_long(); } - explicit operator long() const { return to_long(); } - explicit operator int() const { return to_int(); } + explicit operator long double() const { return to_long_double(); } + explicit operator double() const { return to_double(); } + explicit operator float() const { return to_float(); } + explicit operator long long() const { return to_long_long(); } + explicit operator long() const { return to_long(); } + explicit operator int() const { return to_int(); } explicit operator unsigned long long() const { return to_long_long(); } - explicit operator unsigned long() const { return to_long(); } - explicit operator unsigned int() const { return to_int(); } + explicit operator unsigned long() const { return to_long(); } + explicit operator unsigned int() const { return to_int(); } posit& setBitblock(sw::universal::bitblock& raw) { _bits = uint8_t(raw.to_ulong()); @@ -171,33 +192,54 @@ namespace sw { namespace universal { operator--(); return tmp; } - posit reciprocate() const { + posit reciprocal() const { posit p; p.setbits(posit_3_1_reciprocal_lookup[_bits & 0x07]); return p; } + // SELECTORS - inline bool sign() const { return (_bits & 0x4u); } - inline bool isnar() const { return (_bits == 0x4u); } - inline bool iszero() const { return (_bits == 0); } - inline bool isone() const { // pattern 010.... + bool sign() const { return (_bits & 0x4u); } + bool isnar() const { return (_bits == 0x4u); } + bool iszero() const { return (_bits == 0); } + bool isone() const { // pattern 010.... return (_bits == 0x2u); } - inline bool isminusone() const { // pattern 110... + bool isminusone() const { // pattern 110... return (_bits == 0x6u); } - inline bool isneg() const { return (_bits & 0x4u); } - inline bool ispos() const { return !isneg(); } - inline bool ispowerof2() const { return !(_bits & 0x1u); } + bool isneg() const { return (_bits & 0x4u); } + bool ispos() const { return !isneg(); } + bool ispowerof2() const { return !(_bits & 0x1u); } - inline int sign_value() const { return (_bits & 0x4u ? -1 : 1); } + int sign_value() const { return (_bits & 0x4u ? -1 : 1); } bitblock get() const { bitblock bb; bb = int(_bits); return bb; } unsigned int bits() const { return (unsigned int)(_bits & 0x7u); } - inline void clear() { _bits = 0; } - inline void setzero() { clear(); } - inline void setnar() { _bits = 0x4u; } + void clear() { _bits = 0; } + void setzero() { clear(); } + void setnar() { _bits = 0x4u; } + posit& minpos() { + clear(); + return ++(*this); + } + posit& maxpos() { + setnar(); + return --(*this); + } + posit& zero() { + clear(); + return *this; + } + posit& minneg() { + clear(); + return --(*this); + } + posit& maxneg() { + setnar(); + return ++(*this); + } private: uint8_t _bits; @@ -288,23 +330,35 @@ namespace sw { namespace universal { internal::value v((T)rhs); // special case processing + if (v.isinf() || v.isnan()) { // posit encode for FP_INFINITE and NaN as NaR (Not a Real) + setnar(); + return *this; + } if (v.iszero()) { setzero(); return *this; } - if (v.isinf() || v.isnan()) { // posit encode for FP_INFINITE and NaN as NaR (Not a Real) - setnar(); - return *this; + bool _sign = v.sign(); + int _scale = v.scale(); + // value range of a posit<3,1> is + // -4 -1 -0.25 0 0.25 1 4 + if (rhs <= -2) { + _bits = 0b101; // -4 } - - if (rhs <= -0.5) { - _bits = 0x2; // value is -1, or -maxpos + else if (rhs < -0.5) { + _bits = 0b110; // -1 } - else if (-0.5 < rhs && rhs < 0.5) { - _bits = 0x0; // value is 0 + else if (rhs < 0) { + _bits = 0b111; // -0.25 } - else if (rhs >= 0.5) { - _bits = 0x1; // value is 1, or maxpos + else if (rhs < 0.5) { + _bits = 0b001; // 0.25 + } + else if (rhs <= 2) { + _bits = 0b010; // 1 + } + else { + _bits = 4; } return *this; } diff --git a/include/universal/number/posit/specialized/posit_4_0.hpp b/include/universal/number/posit/specialized/posit_4_0.hpp index 9afb02498..e291a804c 100644 --- a/include/universal/number/posit/specialized/posit_4_0.hpp +++ b/include/universal/number/posit/specialized/posit_4_0.hpp @@ -1,7 +1,7 @@ #pragma once // posit_4_0.hpp: specialized 4-bit posit using lookup table arithmetic // -// Copyright (C) 2017-2022 Supercomputing, Inc. +// Copyright (C) 2017 Supercomputing, Inc. // First implementation: 2019 // // This file is part of the universal numbers project, which is released under an MIT Open Source license. @@ -182,13 +182,13 @@ class posit { if (rhs <= -4) { _bits = 0x9; // value is -4, or -maxpos } - else if (-4 > rhs && rhs <= -2) { + else if (-4 < rhs && rhs <= -2) { _bits = 0xA; // value is -2 } - else if (-2 > rhs && rhs <= -1) { + else if (-2 < rhs && rhs <= -1) { _bits = 0xC; // value is -1 } - else if (-1 > rhs && rhs < 1) { + else if (-1 < rhs && rhs < 1) { _bits = 0x0; // value is 0 } else if (1 <= rhs && rhs < 2) { @@ -278,7 +278,7 @@ class posit { operator--(); return tmp; } - posit reciprocate() const { + posit reciprocal() const { posit p; p.setbits(posit_4_0_reciprocal_lookup[_bits]); return p; diff --git a/include/universal/number/posit/specialized/posit_8_0.h b/include/universal/number/posit/specialized/posit_8_0.h index 9dfc1fab3..265188129 100644 --- a/include/universal/number/posit/specialized/posit_8_0.h +++ b/include/universal/number/posit/specialized/posit_8_0.h @@ -539,7 +539,7 @@ posit8_t posit8_divp8(posit8_t lhs, posit8_t rhs) { p.v = (sign ? -raw : raw); return p; } -posit8_t posit8_reciprocate(posit8_t rhs) { +posit8_t posit8_reciprocal(posit8_t rhs) { posit8_t one = { { 0x40 } }; return posit8_divp8(one, rhs); } diff --git a/include/universal/number/posit/specialized/posit_8_0.hpp b/include/universal/number/posit/specialized/posit_8_0.hpp index d0984ee1d..047868877 100644 --- a/include/universal/number/posit/specialized/posit_8_0.hpp +++ b/include/universal/number/posit/specialized/posit_8_0.hpp @@ -1,7 +1,7 @@ #pragma once // posit_8_0.hpp: specialized 8-bit posit using fast compute specialized for posit<8,0> // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. @@ -30,7 +30,7 @@ template<> class posit { public: static constexpr unsigned nbits = NBITS_IS_8; - static constexpr unsigned es = ES_IS_0; + static constexpr unsigned es = ES_IS_0; static constexpr unsigned sbits = 1; static constexpr unsigned rbits = nbits - sbits; static constexpr unsigned ebits = es; @@ -89,19 +89,19 @@ class posit { explicit posit(long double initial_value) : _bits(0) { *this = initial_value; } // assignment operators for native types - constexpr posit& operator=(signed char rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(short rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(int rhs) { return integer_assign(rhs); } - constexpr posit& operator=(long rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(long long rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(char rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(unsigned short rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(unsigned int rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(unsigned long rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(unsigned long long rhs) { return operator=((int)(rhs)); } - posit& operator=(float rhs) { return float_assign(rhs); } - posit& operator=(double rhs) { return float_assign(float(rhs)); } - posit& operator=(long double rhs) { return float_assign(float(rhs)); } + constexpr posit& operator=(signed char rhs) { return operator=((long long)(rhs)); } + constexpr posit& operator=(short rhs) { return operator=((long long)(rhs)); } + constexpr posit& operator=(int rhs) { return operator=((long long)(rhs)); } + constexpr posit& operator=(long rhs) { return operator=((long long)(rhs)); } + constexpr posit& operator=(long long rhs) { return integer_assign(rhs); } + constexpr posit& operator=(char rhs) { return operator=((long long)(rhs)); } + constexpr posit& operator=(unsigned short rhs) { return operator=((long long)(rhs)); } + constexpr posit& operator=(unsigned int rhs) { return operator=((long long)(rhs)); } + constexpr posit& operator=(unsigned long rhs) { return operator=((long long)(rhs)); } + constexpr posit& operator=(unsigned long long rhs) { return operator=((long long)(rhs)); } + posit& operator=(float rhs) { return float_assign(rhs); } + posit& operator=(double rhs) { return float_assign(float(rhs)); } + posit& operator=(long double rhs) { return float_assign(float(rhs)); } explicit operator long double() const { return to_long_double(); } explicit operator double() const { return to_double(); } @@ -167,7 +167,7 @@ class posit { return tmp; } - posit reciprocate() const { + posit reciprocal() const { posit p = 1.0 / *this; return p; } @@ -182,7 +182,6 @@ class posit { bool sign() const noexcept { return (_bits & sign_mask); } bool isnar() const noexcept { return (_bits == sign_mask); } bool isnan() const noexcept { return isnar(); } - bool isinf() const noexcept { return false; } bool iszero() const noexcept { return (_bits == 0x00); } bool isone() const noexcept { return (_bits == 0x40); } // pattern 010000... bool isminusone() const noexcept { return (_bits == 0xC0); } // pattern 110000... @@ -199,13 +198,13 @@ class posit { void clear() noexcept { _bits = 0; } void setzero() noexcept { clear(); } void setnar() noexcept { _bits = 0x80; } - void setnan() noexcept { setnar(); } + void setnan(bool sign = true) noexcept { setnar(); } //void setnan(bool sign = false) noexcept { setnar(); } - posit& setBitblock(const sw::universal::bitblock& raw) { + posit& setBitblock(const sw::universal::bitblock& raw) noexcept { _bits = uint8_t(raw.to_ulong()); return *this; } - constexpr posit& setbits(uint64_t value) { + constexpr posit& setbits(uint64_t value) noexcept { _bits = uint8_t(value & 0xffu); return *this; } @@ -296,16 +295,16 @@ class posit { } // helper methods - constexpr posit& integer_assign(int rhs) { + constexpr posit& integer_assign(long long rhs) { // special case for speed as this is a common initialization if (rhs == 0) { _bits = 0x0; return *this; } bool sign = (rhs < 0) ? true : false; - int v = sign ? -rhs : rhs; // project to positive side of the projective reals + long long v = sign ? -rhs : rhs; // project to positive side of the projective reals uint8_t raw = 0; - if (v > 48) { // +-maxpos + if (v > 48 || v == rhs) { // +-maxpos raw = 0x7F; } else if (v < 2) { diff --git a/include/universal/number/posit/specialized/posit_8_2.hpp b/include/universal/number/posit/specialized/posit_8_2.hpp index c95c6c757..a98bf8087 100644 --- a/include/universal/number/posit/specialized/posit_8_2.hpp +++ b/include/universal/number/posit/specialized/posit_8_2.hpp @@ -1,15 +1,15 @@ -#pragma once +#pragma once // posit_8_2.hpp: specialized 8-bit posit using fast implementation specialized for posit<8,2> // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. // DO NOT USE DIRECTLY! // the compile guards in this file are only valid in the context of the specialization logic // configured in the main - #include +#include #ifndef POSIT_FAST_POSIT_8_2 #define POSIT_FAST_POSIT_8_2 0 @@ -30,13 +30,13 @@ template<> class posit { public: static constexpr unsigned nbits = NBITS_IS_8; - static constexpr unsigned es = ES_IS_2; + static constexpr unsigned es = ES_IS_2; static constexpr unsigned sbits = 1; static constexpr unsigned rbits = nbits - sbits; static constexpr unsigned ebits = es; static constexpr unsigned fbits = nbits - 3 - es; static constexpr unsigned fhbits = fbits + 1; - static constexpr uint8_t sign_mask = 0x80; + static constexpr uint8_t sign_mask = 0x80u; constexpr posit() : _bits(0) {} posit(const posit&) = default; @@ -74,31 +74,31 @@ class posit { } // initializers for native types - constexpr explicit posit(signed char initial_value) : _bits(0) { *this = initial_value; } - constexpr explicit posit(short initial_value) : _bits(0) { *this = initial_value; } - constexpr explicit posit(int initial_value) : _bits(0) { *this = initial_value; } - constexpr explicit posit(long initial_value) : _bits(0) { *this = initial_value; } - constexpr explicit posit(long long initial_value) : _bits(0) { *this = initial_value; } - constexpr explicit posit(char initial_value) : _bits(0) { *this = initial_value; } - constexpr explicit posit(unsigned short initial_value) : _bits(0) { *this = initial_value; } - constexpr explicit posit(unsigned int initial_value) : _bits(0) { *this = initial_value; } - constexpr explicit posit(unsigned long initial_value) : _bits(0) { *this = initial_value; } - constexpr explicit posit(unsigned long long initial_value) : _bits(0) { *this = initial_value; } - explicit posit(float initial_value) : _bits(0) { *this = initial_value; } - posit(double initial_value) : _bits(0) { *this = initial_value; } - explicit posit(long double initial_value) : _bits(0) { *this = initial_value; } + explicit posit(signed char initial_value) : _bits(0) { *this = initial_value; } + explicit posit(short initial_value) : _bits(0) { *this = initial_value; } + explicit posit(int initial_value) : _bits(0) { *this = initial_value; } + explicit posit(long initial_value) : _bits(0) { *this = initial_value; } + explicit posit(long long initial_value) : _bits(0) { *this = initial_value; } + explicit posit(char initial_value) : _bits(0) { *this = initial_value; } + explicit posit(unsigned short initial_value) : _bits(0) { *this = initial_value; } + explicit posit(unsigned int initial_value) : _bits(0) { *this = initial_value; } + explicit posit(unsigned long initial_value) : _bits(0) { *this = initial_value; } + explicit posit(unsigned long long initial_value) : _bits(0) { *this = initial_value; } + explicit posit(float initial_value) : _bits(0) { *this = initial_value; } + posit(double initial_value) : _bits(0) { *this = initial_value; } + explicit posit(long double initial_value) : _bits(0) { *this = initial_value; } // assignment operators for native types - constexpr posit& operator=(signed char rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(short rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(int rhs) { return integer_assign(rhs); } - constexpr posit& operator=(long rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(long long rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(char rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(unsigned short rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(unsigned int rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(unsigned long rhs) { return operator=((int)(rhs)); } - constexpr posit& operator=(unsigned long long rhs) { return operator=((int)(rhs)); } + posit& operator=(signed char rhs) { return operator=((long long)(rhs)); } + posit& operator=(short rhs) { return operator=((long long)(rhs)); } + posit& operator=(int rhs) { return operator=((long long)rhs); } + posit& operator=(long rhs) { return operator=((long long)(rhs)); } + posit& operator=(long long rhs) { return integer_assign(rhs); } + posit& operator=(char rhs) { return operator=((long long)(rhs)); } + posit& operator=(unsigned short rhs) { return operator=((long long)(rhs)); } + posit& operator=(unsigned int rhs) { return operator=((long long)(rhs)); } + posit& operator=(unsigned long rhs) { return operator=((long long)(rhs)); } + posit& operator=(unsigned long long rhs) { return operator=((long long)(rhs)); } posit& operator=(float rhs) { return float_assign(rhs); } posit& operator=(double rhs) { return float_assign(float(rhs)); } posit& operator=(long double rhs) { return float_assign(float(rhs)); } @@ -117,21 +117,314 @@ class posit { posit p; return p.setbits((~_bits) + 1ul); } + + //////////////////////////////////////////////////////////////// // arithmetic assignment operators posit& operator+=(const posit& b) { + // process special cases +#if POSIT_THROW_ARITHMETIC_EXCEPTION + if (isnar() || b.isnar()) { + throw posit_operand_is_nar{}; + } +#else + if (isnar() || b.isnar()) { + setnar(); + return *this; + } +#endif if (b.iszero()) return *this; + if (iszero()) { _bits = b._bits; return *this; } + if (isneg() != b.isneg()) return *this -= b.twosComplement(); + + uint8_t lhs = _bits; + uint8_t rhs = b._bits; + bool sign = (_bits & sign_mask) != 0; + if (sign) { + lhs = -lhs & 0xFFu; + rhs = -rhs & 0xFFu; + } + if (lhs < rhs) std::swap(lhs, rhs); + + // decode the regime of lhs + int8_t k; // regime numerical value + uint8_t remaining; // Remaining bits after the regime: 00..0 + decode_regime(lhs, k, remaining); + + // extract the exponent + uint8_t exp = remaining >> 5; // 8 - 1(sign) - 2(exponent) + + // extract remaining fraction bits + uint16_t lhs_fraction = ((0x40u | remaining << 1) & 0x7Fu) << 8; // 0x40 is the hidden bit + int8_t shiftRight = k; + + // adjust shift and extract fraction bits of rhs + extractAddand(rhs, shiftRight, remaining); + uint16_t rhs_fraction = ((0x40u | remaining << 1) & 0x7Fu) << 8; // 0x40 is the hidden bit + + // This is 4kZ + expZ; (where kZ=kA-kB and expZ=expA-expB) + shiftRight = (shiftRight << 2) + exp - (remaining >> 5); + + if (shiftRight == 0) { // we can simplify the computation + lhs_fraction += rhs_fraction; // this will always produce a carry + ++exp; + if (exp > 3) { + ++k; + exp &= 3; + } + lhs_fraction >>= 1; + } + else { + (shiftRight > 7) ? (rhs_fraction = 0) : (rhs_fraction >>= shiftRight); // frac16B >>= shiftRight + lhs_fraction += rhs_fraction; + + bool rcarry = (0x8000 & lhs_fraction) != 0; // first left bit + if (rcarry) { + ++exp; + if (exp > 3) { + ++k; + exp &= 3; + } + lhs_fraction >>= 1; + } + } + + _bits = round(k, exp, lhs_fraction); + if (sign) _bits = -_bits & 0xFFu; return *this; } posit& operator-=(const posit& b) { + // process special cases +#if POSIT_THROW_ARITHMETIC_EXCEPTION + if (isnar() || b.isnar()) { + throw posit_operand_is_nar{}; + } +#else + if (isnar() || b.isnar()) { + setnar(); + return *this; + } +#endif if (b.iszero()) return *this; + if (iszero()) { _bits = -(b._bits) & 0xFFu; return *this; } + posit bComplement = b.twosComplement(); + if (isneg() != b.isneg()) return *this += bComplement; + + uint8_t lhs = _bits; + uint8_t rhs = bComplement._bits; + // Both operands are actually the same sign if rhs inherits sign of sub: Make both positive + bool sign = (lhs & sign_mask) != 0; + (sign) ? (lhs = (-lhs & 0xFFu)) : (rhs = (-rhs & 0xFFu)); + + if (lhs == rhs) { + _bits = 0; + return *this; + } + if (lhs < rhs) { + std::swap(lhs, rhs); + sign = !sign; + } + + // decode the regime of lhs + int8_t k; // regime numerical value + uint8_t remaining; // Remaining bits after the regime: 00..0 + decode_regime(lhs, k, remaining); + + // extract the exponent + uint8_t exp = remaining >> 5; // 8 - 1(sign) - 2(exponent) + + uint16_t lhs_fraction = ((0x40u | remaining << 1) & 0x7Fu) << 8; // 0x40 is the hidden bit + int8_t shiftRight = k; + + // adjust shift and extract fraction bits of rhs + extractAddand(rhs, shiftRight, remaining); + uint16_t rhs_fraction = ((0x40u | remaining << 1) & 0x7Fu) << 8; // 0x40 is the hidden bit + + // align the fractions for subtraction + // This is 4kZ + expZ; (where kZ=kA-kB and expZ=expA-expB) + shiftRight = (shiftRight << 2) + exp - (remaining >> 5); + if (shiftRight > 15) { + _bits = lhs; + if (sign) _bits = -_bits & 0xFFu; + return *this; + } + else { + rhs_fraction >>= shiftRight; + } + + lhs_fraction -= rhs_fraction; + + while ((lhs_fraction >> 11) == 0) { + --k; + lhs_fraction <<= 4; + } + + bool ecarry = (0x4000u & lhs_fraction) != 0; + while (!ecarry) { + if (exp == 0) { + --k; + exp = 3; + } + else { + --exp; + } + lhs_fraction <<= 1; + ecarry = (0x4000u & lhs_fraction) != 0; + } + + _bits = round(k, exp, lhs_fraction); + if (sign) _bits = -_bits & 0xFFu; return *this; } posit& operator*=(const posit& b) { - if (b.iszero()) setzero(); + // process special cases +#if POSIT_THROW_ARITHMETIC_EXCEPTION + if (isnar() || b.isnar()) { + throw posit_operand_is_nar{}; + } +#else + if (isnar() || b.isnar()) { + setnar(); + return *this; + } +#endif + if (iszero() || b.iszero()) { + _bits = 0; + return *this; + } + uint8_t lhs = _bits; + uint8_t rhs = b._bits; + // calculate the sign of the result + bool sign = bool(lhs & sign_mask) ^ bool(rhs & sign_mask); + lhs = lhs & sign_mask ? -lhs : lhs; + rhs = rhs & sign_mask ? -rhs : rhs; + + // decode the regime of lhs + int8_t m = 0; // regime pattern length + uint8_t remaining; // Remaining bits after the regime: 00..0 + decode_regime(lhs, m, remaining); + + // extract the exponent + int8_t exp = (remaining >> 5); // 8 - 1(sign) - 2(exponent) + + // extract remaining fraction bits + uint8_t lhs_fraction = (0x40u | remaining << 1) & 0x7Fu; // 0x40 is the hidden bit + + // adjust shift and extract fraction bits of rhs + extractMultiplicand(rhs, m, remaining); + exp += (remaining >> 5); + uint8_t rhs_fraction = (0x40u | remaining << 1) & 0x7Fu; // 0x40 is the hidden bit + uint16_t result_fraction = (uint16_t)lhs_fraction * rhs_fraction; + + if (exp > 3) { + ++m; + exp &= 3; + } + + bool rcarry = (result_fraction & 0x2000u) != 0; + if (rcarry) { + //std::cerr << "fraction carry processing commensing\n"; + //std::cerr << to_binary(*this, true) << " * " << to_binary(b, true) << '\n'; + exp++; + if (exp > 3) { + ++m; + exp &= 3; + } + result_fraction >>= 1; + } + + // round + _bits = adjustAndRound(m, exp, result_fraction); + if (sign) _bits = -_bits & 0xFFu; return *this; } posit& operator/=(const posit& b) { - if (b.iszero()) setnar(); + // process special cases + // since we are encoding error conditions as NaR (Not a Real), we need to process that condition first +#if POSIT_THROW_ARITHMETIC_EXCEPTION + if (b.iszero()) { + throw posit_divide_by_zero{}; // not throwing is a quiet signalling NaR + } + if (b.isnar()) { + throw posit_divide_by_nar{}; + } + if (isnar()) { + throw posit_numerator_is_nar{}; + } +#else + if (isnar() || b.isnar() || b.iszero()) { + setnar(); + return *this; + } +#endif // POSIT_THROW_ARITHMETIC_EXCEPTION + + uint8_t lhs = _bits; + uint8_t rhs = b._bits; + if (iszero()) { + _bits = 0; + return *this; + } + + // calculate the sign of the result + bool sign = bool(lhs & sign_mask) ^ bool(rhs & sign_mask); + lhs = lhs & sign_mask ? -lhs : lhs; + rhs = rhs & sign_mask ? -rhs : rhs; + + // decode the regime of lhs + int8_t m{ 0 }; // regime pattern length + uint8_t remaining{ 0 }; // Remaining bits after the regime: 00..0 + decode_regime(lhs, m, remaining); + + //std::cout << "lhs m : " << int(m) << '\n'; + + // extract the exponent + int8_t exp = (remaining >> 5); // 8 - 1(sign) - 2(exponent) + //std::cout << "lhs exp : " << exp << '\n'; + + // extract remaining fraction bits + uint8_t lhs_fraction = (0x40u | remaining << 1) & 0x7Fu; // 0x40 is the hidden bit + uint16_t fraction = (uint16_t)lhs_fraction << 6; + //std::cout << "fraction : " << to_binary(fraction, 32, true) << '\n'; + + // adjust shift and extract fraction bits of rhs + extractDividand(rhs, m, remaining); + //uint16_t rhsExp = (remaining >> 5); + exp -= (remaining >> 5); + //std::cout << "result m : " << int(m) << '\n'; + //std::cout << "rhs exp : " << rhsExp << '\n'; + //std::cout << "final exp : " << exp << '\n'; + + uint8_t rhs_fraction = (0x40u | remaining << 1) & 0x7Fu; // 0x40 is the hidden bit + //std::cout << "lhs frac : " << to_binary(lhs_fraction, 16, true) << '\n'; + //std::cout << "rhs frac : " << to_binary(rhs_fraction, 16, true) << '\n'; + + div_t result = div(fraction, rhs_fraction); + uint16_t result_fraction = result.quot; + uint16_t remainder = result.rem; + + //std::cout << "result : " << to_binary(result_fraction, 32, true) << '\n'; + + // adjust the exponent if needed + if (exp < 0) { + exp += 4; + --m; + } + if (result_fraction != 0) { + bool rcarry = result_fraction >> 6; // this is the hidden bit (6th bit), extreme right bit is bit 0 + if (!rcarry) { + if (exp == 0) { + --m; + exp = 3; + } + else { + --exp; + } + result_fraction <<= 1; + } + } + + // round + _bits = divRound(m, exp, result_fraction, remainder != 0); + if (sign) _bits = -_bits & 0xFFu; return *this; } @@ -155,7 +448,7 @@ class posit { return tmp; } - posit reciprocate() const { + posit reciprocal() const { posit p = 1.0 / *this; return p; } @@ -166,35 +459,36 @@ class posit { return *this; } - // Selelctors - inline bool sign() const { return (_bits & sign_mask); } - inline bool isnar() const { return (_bits == sign_mask); } - inline bool iszero() const { return (_bits == 0x00); } - inline bool isone() const { return (_bits == 0x40); } // pattern 010000... - inline bool isminusone() const { return (_bits == 0xC0); } // pattern 110000... - inline bool isneg() const { return (_bits & sign_mask); } - inline bool ispos() const { return !isneg(); } - inline bool ispowerof2() const { return !(_bits & 0x1); } + // Selectors + inline bool sign() const noexcept { return (_bits & sign_mask); } + inline bool isnar() const noexcept { return (_bits == sign_mask); } + inline bool iszero() const noexcept { return (_bits == 0x00u); } + inline bool isone() const noexcept { return (_bits == 0x40u); } // pattern 010000... + inline bool isminusone() const noexcept { return (_bits == 0xC0u); } // pattern 110000... + inline bool isneg() const noexcept { return (_bits & sign_mask); } + inline bool ispos() const noexcept { return !isneg(); } + inline bool ispowerof2() const noexcept { return !(_bits & 0x1u); } - inline int sign_value() const { return (_bits & sign_mask ? -1 : 1); } + inline int sign_value() const noexcept { return (_bits & sign_mask ? -1 : 1); } - bitblock get() const { bitblock bb; bb = int(_bits); return bb; } - unsigned long long encoding() const { return (unsigned long long)(_bits); } + bitblock get() const noexcept { bitblock bb; bb = int(_bits); return bb; } + uint8_t bits() const noexcept { return _bits; } + unsigned long long encoding() const noexcept { return (unsigned long long)(_bits); } // Modifiers inline void clear() noexcept { _bits = 0; } inline void setzero() noexcept { clear(); } - inline void setnar() noexcept { _bits = 0x80; } - posit& setBitblock(const sw::universal::bitblock& raw) noexcept { + inline void setnar() noexcept { _bits = sign_mask; } + posit& setBitblock(const bitblock& raw) noexcept { _bits = uint8_t(raw.to_ulong()); return *this; } constexpr posit& setbits(uint64_t value) noexcept { - _bits = uint8_t(value & 0xffu); + _bits = uint8_t(value & 0xFFu); return *this; } constexpr posit& setbit(unsigned bitIndex, bool value = true) noexcept { - uint16_t bit_mask = (0x1u << bitIndex); + uint8_t bit_mask = (0x1u << bitIndex); if (value) { _bits |= bit_mask; } @@ -204,58 +498,60 @@ class posit { return *this; } - inline posit& minpos() { + posit& minpos() noexcept { clear(); return ++(*this); } - inline posit& maxpos() { + posit& maxpos() noexcept { setnar(); return --(*this); } - inline posit& zero() { + posit& zero() noexcept { clear(); return *this; } - inline posit& minneg() { + posit& minneg() noexcept { clear(); return --(*this); } - inline posit& maxneg() { + posit& maxneg() noexcept { setnar(); return ++(*this); } - inline posit twosComplement() const { - posit p; - int8_t v = -*(int8_t*)&_bits; - p.setbits(v); - return p; + posit twosComplement() const noexcept { + posit p; + return p.setbits(~_bits + 1ul); } -private: - uint8_t _bits; - - // decode takes the raw bits of the posit, - // returns the regime, m, and leaves the remaining bits in 'remainder' - int8_t decode_regime(uint8_t bits, uint8_t* remaining) const { - int8_t m = 0; - *remaining = (bits << 2) & 0xFF; - if (bits & 0x40) { // positive regimes - while (*remaining >> 7) { + uint16_t decode_posit(const uint8_t bits, uint8_t& exp, uint8_t& fraction) const noexcept { + int16_t m{ 0 }; + // posit is s.rrrr.ee.fffff + fraction = (bits << 2u) & 0xFFu; // remove sign and first regime bit + if (bits & 0x40u) { // positive regimes + m = 0; + while (fraction >> 7) { ++m; - *remaining = (*remaining << 1) & 0xFF; + fraction <<= 1; } } else { // negative regimes m = -1; - while (!(*remaining >> 7)) { + while (!(fraction >> 7)) { --m; - *remaining = (*remaining << 1) & 0xFF; + fraction <<= 1; } - *remaining &= 0x7F; + fraction &= 0x7Fu; } + exp = (fraction >> 5); // extract the exponent + // finalize the fraction bits as in 0b0hffff...ff00, so we have MSB = 0, hidden bit realized at 0x20, and two extra bits at the bottom + fraction &= 0x9Fu; // null the exponent bits + fraction |= 0x20u; // set the hidden bit return m; } +private: + uint8_t _bits; + // extract_exponent takes the regime, and the remaining bits // returns the exponent value, and updates remaining to hold just the fraction bits uint8_t extract_exponent(int8_t m, uint8_t* remaining) const { @@ -284,6 +580,7 @@ class posit { case -7: case -6: case 5: case 6: exp = 0; *remaining = 0; + break; default: exp = (*remaining >> 5); *remaining <<= 2; @@ -396,11 +693,12 @@ class posit { float to_float() const { if (iszero()) return 0.0f; - if (isnar()) return NAN; // INFINITY is not semantically correct. NaR is Not a Real and thus is more closely related to a NAN, or Not a Number + if (isnar()) return NAN; - uint8_t bits = ((_bits & 0x80) ? -_bits : _bits); + uint8_t bits = ((_bits & 0x80u) ? -_bits : _bits); uint8_t remaining = 0; - int8_t m = decode_regime(bits, &remaining); + int8_t m; + decode_regime(bits,m, remaining); // std::cout << to_binary(bits, 8) << " : " << to_binary(remaining, 8) << " : "; int regimeScale = (1 << es) * m; float s = (float)(sign_value()); @@ -424,16 +722,16 @@ class posit { } // helper methods - constexpr posit& integer_assign(int rhs) { + posit& integer_assign(long long rhs) noexcept { // special case for speed as this is a common initialization if (rhs == 0) { _bits = 0x0; return *this; } bool sign = (rhs < 0) ? true : false; - int v = sign ? -rhs : rhs; // project to positive side of the projective reals + long long v = sign ? -rhs : rhs; // project to positive side of the projective reals uint8_t raw = 0; - if (v > 48) { // +-maxpos + if (v > 48 || v == rhs) { // +-maxpos raw = 0x7F; } else if (v < 2) { @@ -459,95 +757,348 @@ class posit { _bits = sign ? -raw : raw; return *this; } - posit& float_assign(float rhs) { - bool sign = false; - bool bitNPlusOne = 0, bitsMore = 0; - constexpr float _minpos = 5.9604644775390625e-08f; - constexpr float _maxpos = 16777216.0f; + posit& float_assign(float rhs) noexcept { + // special case for speed as this is a common initialization + if (std::fpclassify(rhs) == FP_NAN || std::fpclassify(rhs) == FP_INFINITE) { + _bits = 0x80u; + return *this; + } + else if (rhs == 0.0f) { + _bits = 0; + return *this; + } - sign = (rhs < 0.0) ? true : false; + bool sign = (rhs < 0.0); + float v = (sign ? -rhs : rhs); + float_decoder fd{ v }; + uint8_t raw{ 0 }; + if (v == 1.0f) { + raw = 0x40u; + } + else if (v > 1) { + // geometric mean = sqrt(a*b) + // geometric range of the posit<8,2> + // maxpos = 16,777,216 0x0111'1111 2^(6*2^2) * 2^0 + // geo mean = 4,194,304 2^(5*2^2) * 2^2 + // maxpos / 2^4 = 1,048,576 0x0111'1110 2^(5*2^2) * 2^0 + // geo mean = 524,288 2^(5*2^2) * 2^1 + // maxpos / 2^6 = 262,144 0x0111'1101 2^(4*2^2) * 2^2 + // geo mean = 131,072 2^(4*2^2) * 2^1 + // maxpos / 2^8 = 65,536 0x0111'1100 2^(4*2^2) * 2^0 + // maxpos / 2^9 = 32,768 0x0111'1011 2^(3*2^2) * 2^3 + // maxpos / 2^10 = 16,384 0x0111'1010 2^(3*2^2) * 2^2 + if (v > 4194304) { + raw = 0x7Fu; // maxpos + } + else if (v > 524288) { + raw = 0x7Eu; // maxpos / 2^4 + } + else if (v > 131072) { + raw = 0x7Du; // maxpos / 2^6 + } + else { + //std::cout << "value : " << v << '\n'; + int scale = fd.parts.exponent - 127; + //std::cout << "scale : " << scale << '\n'; + unsigned reglen = 1u + (scale >> 2); + //std::cout << "reglen : " << reglen << '\n'; + uint8_t regime = 0x7Fu - (0x7Fu >> reglen); + //std::cout << "regime : " << to_binary(regime, 8, true) << '\n'; + uint8_t esval = (scale % 0x04u); + + int sign_regime_es = 1 + reglen + 1 + 2; // 1 sign, reglen+1 regime, 2 exponent bits + int nf = std::max(0, nbits - sign_regime_es); + uint8_t exponent = (esval << nf); + //std::cout << "exponent : " << to_binary(exponent, 8, true) << '\n'; + + // copy most significant nf fraction bits into fraction + //std::cout << "fracin : " << to_binary(fd.parts.fraction, 23, true) << '\n'; + uint8_t fraction = fd.parts.fraction >> (23 - nf); + //std::cout << "fraction : " << to_binary(fraction, 8, true) << '\n'; - constexpr int spfbits = std::numeric_limits::digits - 1; - internal::value v(rhs); - if (v.isinf() || v.isnan()) { - _bits = 0x80; + // construct the untruncated posit + raw = regime | exponent | fraction; + + // round + } } - else if (rhs == 0) { - _bits = 0; + else if (v < 1) { + // geometric range of the posit<8,2> + // minpos = 1/16,777,216 0x0000'0001 2^(-6*2^2) * 2^0 5.9604644775390625e-08f + // geo mean = 1/ 4,194,304 2.384185791015625e-07f + // minpos * 2^4 = 1/ 1,048,576 0x0000'0010 2^(-5*2^2) * 2^0 9.5367431640625e-07f + // geo mean = 1/ 524,288 1.9073486328125e-06f + // minpos * 2^6 = 1/ 262,144 0x0000'0011 2^(-4*2^2) * 2^2 3.814697265625e-06f + // geo mean = 1/ 131,072 7.62939453125e-06f + // minpos * 2^8 = 1/ 65,536 0x0000'0100 2^(-4*2^2) * 2^0 1.52587890625e-05f + + if (v < 2.384185791015625e-07f) { + raw = 0x01u; + } + else if (v < 1.9073486328125e-06f) { + raw = 0x02u; + } + else if (v < 7.62939453125e-06f) { + raw = 0x03u; + } + else { + //std::cout << "value : " << v << '\n'; + + int scale = fd.parts.exponent - 127; + //std::cout << "scale : " << scale << '\n'; + unsigned reglen = -(scale >> 2); + //std::cout << "reglen : " << reglen << '\n'; + uint8_t regime = 0x40u >> reglen; + //std::cout << "regime : " << to_binary(regime, 8, true) << '\n'; + uint8_t esval = (scale % 0x04u); + + int sign_regime_es = 1 + reglen + 1 + 2; // 1 sign, reglen+1 regime, 2 exponent bits + int nf = std::max(0, nbits - sign_regime_es); + uint8_t exponent = (esval << nf); + //std::cout << "exponent : " << to_binary(exponent, 8, true) << '\n'; + + // copy most significant nf fraction bits into fraction + //std::cout << "fracin : " << to_binary(fd.parts.fraction, 23, true) << '\n'; + uint8_t fraction = fd.parts.fraction >> (23 - nf); + //std::cout << "fraction : " << to_binary(fraction, 8, true) << '\n'; + + // construct the untruncated posit + raw = regime | exponent | fraction; + + // round + } + + } + else { + // std::cout << "NaN maps to NaR\n"; + _bits = 0x80u; // NaR + return *this; + } + + _bits = sign ? -raw : raw; + return *this; + } + + + // decode_regime takes the raw bits of the posit, and returns the + // regime numerical meaning, k, and the remaining bits shifted to + // the left in remaining, with a 0 appended to the left. I.e., + // remaining = 00..0 + // + // The regime numerical meaning is as follows: If m is the number of + // identical bits in the regime, if the bits are 0s, then k = −m; + // if they are 1s, then k = m − 1. + void decode_regime(uint8_t bits, int8_t& m, uint8_t& remaining) const noexcept { + remaining = (bits << 2) & 0xFFu; // remove sign and first regime bit + if (bits & 0x40u) { // positive regimes + m = 0; + while (remaining >> 7) { + ++m; + remaining = (remaining << 1) & 0xFFu; + } } - else if (rhs == 1.0f) { - _bits = 0x40; + else { // negative regimes + m = -1; + while (!(remaining >> 7)) { + --m; + remaining = (remaining << 1) & 0xFFu; + } + remaining &= 0x7Fu; } - else if (rhs == -1.0f) { - _bits = 0xC0; + } + void extractAddand(const uint8_t bits, int8_t& m, uint8_t& remaining) const noexcept { + remaining = (bits << 2) & 0xFFu; + if (bits & 0x40u) { // positive regimes + while (remaining >> 7) { + --m; + remaining = (remaining << 1) & 0xFFu; + } } - else if (rhs >= _maxpos) { - _bits = 0x7F; + else { // negative regimes + ++m; + while (!(remaining >> 7)) { + ++m; + remaining = (remaining << 1) & 0xFFu; + } + remaining &= 0x7Fu; } - else if (rhs <= -_maxpos) { - _bits = 0x81; + } + void extractMultiplicand(const uint8_t bits, int8_t& m, uint8_t& remaining) const noexcept { + remaining = (bits << 2) & 0xFFu; + if (bits & 0x40u) { // positive regimes + while (remaining >> 7) { + ++m; + remaining = (remaining << 1) & 0xFFu; + } } - else if (rhs <= _minpos && !sign) { - _bits = 0x01; + else { // negative regimes + --m; + while (!(remaining >> 7)) { + --m; + remaining = (remaining << 1) & 0xFFu; + } + remaining &= 0x7Fu; } - else if (rhs >= -_minpos && sign) { - _bits = 0xFF; + } + void extractDividand(const uint8_t bits, int8_t& m, uint8_t& remaining) const noexcept { + remaining = (bits << 2) & 0xFFu; + if (bits & 0x40u) { // positive regimes + while (remaining >> 7) { + --m; + remaining = (remaining << 1) & 0xFFu; + } } - else if (rhs < -1 || rhs > 1) { - if (sign) { - rhs = -rhs; // project to positive reals to simplify computation + else { // negative regimes + ++m; + while (!(remaining >> 7)) { + ++m; + remaining = (remaining << 1) & 0xFFu; } + remaining &= 0x7Fu; + } + } + uint16_t round(const int8_t m, uint8_t exp, uint16_t frac16) const noexcept { + uint8_t reglen, regime, bits; + if (m < 0) { + reglen = (-m & 0xFFu); + regime = 0x40u >> reglen; + } + else { + reglen = m + 1; + regime = 0x7Fu - (0x7Fu >> reglen); + } - if (rhs <= _minpos) { - _bits = 0x01; + if (reglen > 6) { + bits = (m < 0 ? 0x01u : 0x7Fu); // minpos and maxpos. exp and frac do not matter + } + else { + frac16 = (frac16 & 0x3FFF) >> (reglen + 2); // remove both carry bits, 2 bits exp + uint8_t fraction = uint8_t(frac16 >> 8); + bool bitNPlusOne = false; + uint8_t moreBits = 0; + if (reglen <= 4) { + bitNPlusOne = (0x80u & frac16) != 0; + exp <<= (4 - reglen); } - else { // determine the regime - unsigned k = 1; //because k = m-1, we need to add back 1 - while (rhs >= 2) { - rhs *= 0.5; - k++; + else { + if (reglen == 6) { + bitNPlusOne = bool(exp & 0x2); + moreBits = exp & 0x1; + exp = 0; } - - // rounding off regime bits - if (k > 6) { - _bits = 0x7F; + else if (reglen == 5) { + bitNPlusOne = bool(exp & 0x1); + exp >>= 1; } - else { - int8_t fracLength = 6 - k; - uint8_t frac = (uint8_t)convertFraction(rhs, fracLength, &bitNPlusOne, &bitsMore); - uint_fast8_t regime = 0x7F - (0x7F >> k); - _bits = (regime + frac); - if (bitNPlusOne) _bits += ((_bits & 0x01) | bitsMore); + if (fraction > 0) { + fraction = 0; + moreBits = 1; } - _bits = sign ? -_bits : _bits; } - } - else if (rhs > -1 && rhs < 1) { - if (sign) { - rhs = -rhs; + + bits = regime | exp | fraction; + // n+1 frac bit is 1. Need to check if another bit is 1 too if not round to even + if (bitNPlusOne) { + if (0x7Fu & frac16) moreBits = 1; + bits += (bits & 0x01u) | moreBits; } - unsigned k = 0; - while (rhs < 1) { - rhs *= 2; - k++; + } + return bits; + } + uint8_t divRound(const int8_t m, uint8_t exp, uint16_t frac16, bool nonZeroRemainder) const noexcept { + uint8_t reglen, regime, bits; + if (m < 0) { + reglen = (-m & 0xFFu); + regime = 0x40u >> reglen; + } + else { + reglen = m + 1; + regime = 0x7Fu - (0x7Fu >> reglen); + } + + if (reglen > 6) { + bits = (m < 0 ? 0x01u : 0x7Fu); // minpos and maxpos + } + else { + frac16 &= 0x3Fu; // remove both carry bits + uint8_t fraction = uint8_t(frac16 >> (reglen + 2)); + + bool bitNPlusOne = false; + uint16_t moreBits{ 0 }; + if (reglen <= 4) { + bitNPlusOne = bool((frac16 >> (reglen + 1)) & 0x1); + exp <<= (4 - reglen); + if (bitNPlusOne) moreBits = (((1ull << (reglen + 1)) - 1ull) & frac16) ? 0x1 : 0x0; } - // rounding off regime bits - if (k > 6) - _bits = 0x1; else { - int8_t fracLength = 6 - k; - uint8_t frac = (uint8_t)convertFraction(rhs, fracLength, &bitNPlusOne, &bitsMore); - uint8_t regime = 0x40 >> k; - _bits = (regime + frac); - if (bitNPlusOne) _bits += ((_bits & 0x01) | bitsMore); + if (reglen == 6) { + bitNPlusOne = bool(exp & 0x2); + moreBits = exp & 0x1; + exp = 0; + } + else if (reglen == 5) { + bitNPlusOne = bool(exp & 0x1); + exp >>= 1; + } + if (frac16 > 0) { + fraction = 0; + moreBits = 0x1; + } } - _bits = sign ? -_bits : _bits; + if (nonZeroRemainder) moreBits = 0x1; + bits = regime | exp | uint8_t(fraction); + if (bitNPlusOne) bits += (bits & 0x1) | moreBits; + } + return bits; + } + inline uint8_t adjustAndRound(const int8_t m, uint8_t exp, uint16_t frac16) const noexcept { + uint8_t reglen, regime, bits; + if (m < 0) { + reglen = (-m & 0xFFu); + regime = 0x40u >> reglen; } else { - //NaR - for NaN, INF and all other combinations - _bits = 0x80; + reglen = m + 1u; + regime = 0x7Fu - (0x7Fu >> reglen); } - return *this; + + if (reglen > 6) { + bits = m < 0 ? 0x01u : 0x7Fu; // minpos and maxpos. exp and frac do not matter + } + else { + // remove carry and rcarry bits and shift to correct position + frac16 = (frac16 & 0x0FFFu) >> reglen; + uint8_t fraction = uint8_t(frac16 >> 8); + bool bitNPlusOne = false; + uint8_t moreBits = 0; + if (reglen <= 4) { + bitNPlusOne = bool(0x80u & frac16); + exp <<= (4 - reglen); + } + else { + if (reglen == 6) { + bitNPlusOne = bool(exp & 0x2); + moreBits = exp & 0x1; + exp = 0; + } + else if (reglen == 5) { + bitNPlusOne = bool(exp & 0x1); + exp >>= 1; + } + if (fraction > 0) { + fraction = 0; + moreBits = 1; + } + } + + bits = regime | exp | fraction; + // n+1 frac bit is 1. Need to check if another bit is 1 too if not round to even + if (bitNPlusOne) { + if (0x7Fu & frac16) moreBits = 1; + bits += (bits & 0x01u) | moreBits; + } + } + return bits; } // I/O operators diff --git a/include/universal/number/posit2/posit_impl.hpp b/include/universal/number/posit2/posit_impl.hpp index 7d4c1a483..95a7330f4 100644 --- a/include/universal/number/posit2/posit_impl.hpp +++ b/include/universal/number/posit2/posit_impl.hpp @@ -834,8 +834,8 @@ class posit { return *this /= posit(rhs); } - posit reciprocate() const noexcept { - if (_trace_reciprocate) std::cout << "-------------------- RECIPROCATE ----------------" << std::endl; + posit reciprocal() const noexcept { + if (_trace_reciprocal) std::cout << "-------------------- RECIPROCAL ----------------" << std::endl; posit p; // special case of NaR (Not a Real) if (isnar()) { @@ -870,7 +870,7 @@ class posit { constexpr unsigned reciprocal_size = 3 * fbits + 4; blockbinary reciprocal; divide_with_fraction(one, frac, reciprocal); - if (_trace_reciprocate) { + if (_trace_reciprocal) { std::cout << "one " << one << std::endl; std::cout << "frac " << frac << std::endl; std::cout << "recip " << reciprocal << std::endl; @@ -878,14 +878,14 @@ class posit { // radix point falls at operand size == reciprocal_size - operand_size - 1 reciprocal <<= operand_size - 1; - if (_trace_reciprocate) std::cout << "frac " << reciprocal << std::endl; + if (_trace_reciprocal) std::cout << "frac " << reciprocal << std::endl; int new_scale = -scale(*this); int msb = findMostSignificantBit(reciprocal); if (msb > 0) { int shift = static_cast(reciprocal_size - static_cast(msb)); reciprocal <<= static_cast(shift); new_scale -= (shift-1); - if (_trace_reciprocate) std::cout << "result " << reciprocal << std::endl; + if (_trace_reciprocal) std::cout << "result " << reciprocal << std::endl; } //std::bitset tr; //truncate(reciprocal, tr); diff --git a/include/universal/number/posito/posito.hpp b/include/universal/number/posito/posito.hpp index fa8d20af8..8bb33a96e 100644 --- a/include/universal/number/posito/posito.hpp +++ b/include/universal/number/posito/posito.hpp @@ -36,8 +36,18 @@ #if !defined(POSITO_THROW_ARITHMETIC_EXCEPTION) // default is to use NaR as a signalling error #define POSITO_THROW_ARITHMETIC_EXCEPTION 0 + +// this is problematic: both posit and posito rely on value<> and bitblock<> +// so when both arithmetic types are used in the same program +// the first configuration of VALUE and BITBLOCK will stick. +// TODO: the limb-based posit implementation will resolve this +// as it removes the dependency on value and bitblock +#if !defined(VALUE_THROW_ARITHMETIC_EXCEPTION) #define VALUE_THROW_ARITHMETIC_EXCEPTION 0 +#endif +#if !defined(BITBLOCK_THROW_ARITHMETIC_EXCEPTION) #define BITBLOCK_THROW_ARITHMETIC_EXCEPTION 0 +#endif #else // for the composite value<> class assume the same behavior as requested for posits #define VALUE_THROW_ARITHMETIC_EXCEPTION POSITO_THROW_ARITHMETIC_EXCEPTION diff --git a/include/universal/number/posito/posito_impl.hpp b/include/universal/number/posito/posito_impl.hpp index faf533cbe..7b46db44d 100644 --- a/include/universal/number/posito/posito_impl.hpp +++ b/include/universal/number/posito/posito_impl.hpp @@ -624,8 +624,8 @@ class posito { return *this /= posito(rhs); } - posito reciprocate() const { - if (_trace_reciprocate) std::cout << "-------------------- RECIPROCATE ----------------" << std::endl; + posito reciprocal() const { + if (_trace_reciprocal) std::cout << "-------------------- RECIPROCAl ----------------" << std::endl; posito p; // special case of NaR (Not a Real) if (isnar()) { @@ -660,7 +660,7 @@ class posito { constexpr unsigned reciprocal_size = 3 * fbits + 4; internal::bitblock reciprocal; divide_with_fraction(one, frac, reciprocal); - if (_trace_reciprocate) { + if (_trace_reciprocal) { std::cout << "one " << one << std::endl; std::cout << "frac " << frac << std::endl; std::cout << "recip " << reciprocal << std::endl; @@ -668,14 +668,14 @@ class posito { // radix point falls at operand size == reciprocal_size - operand_size - 1 reciprocal <<= operand_size - 1; - if (_trace_reciprocate) std::cout << "frac " << reciprocal << std::endl; + if (_trace_reciprocal) std::cout << "frac " << reciprocal << std::endl; int new_scale = -scale(*this); int msb = findMostSignificantBit(reciprocal); if (msb > 0) { int shift = static_cast(reciprocal_size - static_cast(msb)); reciprocal <<= static_cast(shift); new_scale -= (shift-1); - if (_trace_reciprocate) std::cout << "result " << reciprocal << std::endl; + if (_trace_reciprocal) std::cout << "result " << reciprocal << std::endl; } //std::bitset tr; //truncate(reciprocal, tr); diff --git a/include/universal/traits/arithmetic_traits.hpp b/include/universal/traits/arithmetic_traits.hpp index 88bb513a5..86ab1e01d 100644 --- a/include/universal/traits/arithmetic_traits.hpp +++ b/include/universal/traits/arithmetic_traits.hpp @@ -1,7 +1,7 @@ #pragma once // arithmetic_traits.hpp: functions to report on number system properties // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include diff --git a/include/universal/traits/cfloat_traits.hpp b/include/universal/traits/cfloat_traits.hpp index 256ece437..18b1def25 100644 --- a/include/universal/traits/cfloat_traits.hpp +++ b/include/universal/traits/cfloat_traits.hpp @@ -1,7 +1,7 @@ #pragma once // cfloat_traits.hpp : traits for classic floating-point number systems // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include diff --git a/include/universal/traits/number_traits.hpp b/include/universal/traits/number_traits.hpp index a1acac57c..dd1fb7fb1 100644 --- a/include/universal/traits/number_traits.hpp +++ b/include/universal/traits/number_traits.hpp @@ -1,7 +1,7 @@ #pragma once // number_traits.hpp : number system traits // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include diff --git a/include/universal/utility/bit_cast.hpp b/include/universal/utility/bit_cast.hpp index dcff89b56..cd4f04107 100644 --- a/include/universal/utility/bit_cast.hpp +++ b/include/universal/utility/bit_cast.hpp @@ -1,7 +1,7 @@ #pragma once // bit_cast.hpp provides sw::bit_cast, a backport of C++20 std::bit_cast // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. diff --git a/include/universal/utility/compiler.hpp b/include/universal/utility/compiler.hpp index a1669451d..203db8cda 100644 --- a/include/universal/utility/compiler.hpp +++ b/include/universal/utility/compiler.hpp @@ -1,5 +1,9 @@ #pragma once - +// identify compiler +// +// Copyright (C) 2017 Stillwater Supercomputing, Inc. +// +// This file is part of the universal numbers project, which is released under an MIT Open Source license. #include namespace sw { namespace universal { diff --git a/include/universal/utility/long_double.hpp b/include/universal/utility/long_double.hpp index dab4294a8..f4702412b 100644 --- a/include/universal/utility/long_double.hpp +++ b/include/universal/utility/long_double.hpp @@ -1,7 +1,7 @@ #pragma once // long_double.hpp: compiler specialization for long double support // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. diff --git a/include/universal/verification/cfloat_math_test_suite.hpp b/include/universal/verification/cfloat_test_suite_mathlib.hpp similarity index 99% rename from include/universal/verification/cfloat_math_test_suite.hpp rename to include/universal/verification/cfloat_test_suite_mathlib.hpp index 2894436d3..3b5aad3da 100644 --- a/include/universal/verification/cfloat_math_test_suite.hpp +++ b/include/universal/verification/cfloat_test_suite_mathlib.hpp @@ -1,7 +1,7 @@ #pragma once -// cfloat_math_test_suite.hpp : test suite runners for math library functions +// cfloat_test_suite_mathlib.hpp : test suite runners for math library functions // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is art of the universal numbers project, which is released under an MIT Open Source license. #include diff --git a/include/universal/verification/fixpnt_test_suite.hpp b/include/universal/verification/fixpnt_test_suite.hpp index a6db1e1b6..93eb0d450 100644 --- a/include/universal/verification/fixpnt_test_suite.hpp +++ b/include/universal/verification/fixpnt_test_suite.hpp @@ -1,7 +1,7 @@ #pragma once // fixpnt_test_suite.hpp : arithmetic/logic test suite for arbitrary fixed point number systems // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -20,21 +20,21 @@ namespace sw { namespace universal { /////////////////////////////// VERIFICATION TEST SUITES //////////////////////////////// template -int Compare(double testValue, const fixpnt& presult, double reference, bool bReportIndividualTestCases) { +int Compare(double testValue, const fixpnt& presult, double reference, bool reportTestCases) { int fail = 0; double result = double(presult); if (std::fabs(result - reference) > 0.000000001) { fail++; - if (bReportIndividualTestCases) ReportConversionError("FAIL", "=", testValue, presult, reference); + if (reportTestCases) ReportConversionError("FAIL", "=", testValue, presult, reference); } else { - // if (bReportIndividualTestCases) ReportConversionSuccess("PASS", "=", testValue, reference, presult); + // if (reportTestCases) ReportConversionSuccess("PASS", "=", testValue, reference, presult); } return fail; } template -int VerifyAssignment(bool bReportIndividualTestCases) { +int VerifyAssignment(bool reportTestCases) { const unsigned NR_NUMBERS = (unsigned(1) << nbits); int nrOfFailedTestCases = 0; @@ -49,10 +49,10 @@ int VerifyAssignment(bool bReportIndividualTestCases) { //std::cout << p << " " << value << " " << assigned << std::endl; if (p != assigned) { nrOfFailedTestCases++; - if (bReportIndividualTestCases) ReportAssignmentError("FAIL", "=", p, assigned, value); + if (reportTestCases) ReportAssignmentError("FAIL", "=", p, assigned, value); } else { - //if (bReportIndividualTestCases) ReportAssignmentSuccess("PASS", "=", p, assigned, value); + //if (reportTestCases) ReportAssignmentSuccess("PASS", "=", p, assigned, value); } } return nrOfFailedTestCases; @@ -64,7 +64,7 @@ int VerifyAssignment(bool bReportIndividualTestCases) { */ // enumerate all conversion cases for a fixed-point configuration template -int VerifyConversion(bool bReportIndividualTestCases) { +int VerifyConversion(bool reportTestCases) { // we are going to generate a test set that consists of all fixed-point configs and their midpoints // we do this by enumerating a fixed-point that is 1-bit larger than the test configuration // with the extra bit allocated to the fraction => rbits+1 @@ -106,13 +106,13 @@ int VerifyConversion(bool bReportIndividualTestCases) { // special case of a tie that needs to round to even -> 0 testValue = da; nut = testValue; - nrOfFailedTests += Compare(testValue, nut, 0.0, bReportIndividualTestCases); + nrOfFailedTests += Compare(testValue, nut, 0.0, reportTestCases); // this rounds up testValue = da + eps; nut = testValue; next.setbits(i + 1); - nrOfFailedTests += Compare(testValue, nut, (double)next, bReportIndividualTestCases); + nrOfFailedTests += Compare(testValue, nut, (double)next, reportTestCases); } else if (i == HALF - 1) { @@ -120,25 +120,25 @@ int VerifyConversion(bool bReportIndividualTestCases) { testValue = da - eps; nut = testValue; prev.setbits(HALF - 2); - nrOfFailedTests += Compare(testValue, nut, (double)prev, bReportIndividualTestCases); + nrOfFailedTests += Compare(testValue, nut, (double)prev, reportTestCases); } else if (i == HALF + 1) { // special case of projecting to maxneg testValue = da - eps; nut = testValue; - nrOfFailedTests += Compare(testValue, nut, dmaxneg, bReportIndividualTestCases); + nrOfFailedTests += Compare(testValue, nut, dmaxneg, reportTestCases); } else if (i == NR_TEST_CASES - 1) { // special case of projecting to minneg testValue = da - eps; nut = testValue; prev.setbits(i - 1); - nrOfFailedTests += Compare(testValue, nut, (double)prev, bReportIndividualTestCases); + nrOfFailedTests += Compare(testValue, nut, (double)prev, reportTestCases); // but the +delta goes to 0 testValue = da + eps; nut = testValue; -// nrOfFailedTests += Compare(testValue, nut, (double)prev, bReportIndividualTestCases); - nrOfFailedTests += Compare(testValue, nut, 0.0, bReportIndividualTestCases); +// nrOfFailedTests += Compare(testValue, nut, (double)prev, reportTestCases); + nrOfFailedTests += Compare(testValue, nut, 0.0, reportTestCases); } else { // for odd values, we are between fixed point values, so we create the round-up and round-down cases @@ -146,12 +146,12 @@ int VerifyConversion(bool bReportIndividualTestCases) { testValue = da - eps; nut = testValue; prev.setbits(i - 1); - nrOfFailedTests += Compare(testValue, nut, (double)prev, bReportIndividualTestCases); + nrOfFailedTests += Compare(testValue, nut, (double)prev, reportTestCases); // round-up testValue = da + eps; nut = testValue; next.setbits(i + 1); - nrOfFailedTests += Compare(testValue, nut, (double)next, bReportIndividualTestCases); + nrOfFailedTests += Compare(testValue, nut, (double)next, reportTestCases); } } else { @@ -163,29 +163,29 @@ int VerifyConversion(bool bReportIndividualTestCases) { // special case of assigning to 0 testValue = da; nut = testValue; - nrOfFailedTests += Compare(testValue, nut, da, bReportIndividualTestCases); + nrOfFailedTests += Compare(testValue, nut, da, reportTestCases); testValue = da + eps; nut = testValue; - nrOfFailedTests += Compare(testValue, nut, da, bReportIndividualTestCases); + nrOfFailedTests += Compare(testValue, nut, da, reportTestCases); } else if (i == NR_TEST_CASES - 2) { // special case of projecting to minneg testValue = da - eps; nut = testValue; prev.setbits(NR_TEST_CASES - 2); - nrOfFailedTests += Compare(testValue, nut, (double)prev, bReportIndividualTestCases); + nrOfFailedTests += Compare(testValue, nut, (double)prev, reportTestCases); } else { // for even values, we are on actual fixed point values, so we create the round-up and round-down cases // round-up testValue = da - eps; nut = testValue; - nrOfFailedTests += Compare(testValue, nut, da, bReportIndividualTestCases); + nrOfFailedTests += Compare(testValue, nut, da, reportTestCases); // round-down testValue = da + eps; nut = testValue; - nrOfFailedTests += Compare(testValue, nut, da, bReportIndividualTestCases); + nrOfFailedTests += Compare(testValue, nut, da, reportTestCases); } } } @@ -194,7 +194,7 @@ int VerifyConversion(bool bReportIndividualTestCases) { // enumerate all addition cases for an fixpnt configuration template -int VerifyAddition(bool bReportIndividualTestCases) { +int VerifyAddition(bool reportTestCases) { constexpr unsigned NR_VALUES = (unsigned(1) << nbits); int nrOfFailedTests = 0; fixpnt a, b, result, cref; @@ -231,10 +231,10 @@ int VerifyAddition(bool bReportIndividualTestCases) { cref = ref; if (result != cref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportBinaryArithmeticError("FAIL", "+", a, b, cref, result); + if (reportTestCases) ReportBinaryArithmeticError("FAIL", "+", a, b, cref, result); } else { - //if (bReportIndividualTestCases) ReportBinaryArithmeticSuccess("PASS", "+", a, b, cref, result); + //if (reportTestCases) ReportBinaryArithmeticSuccess("PASS", "+", a, b, cref, result); } if (nrOfFailedTests > 100) return nrOfFailedTests; } @@ -246,7 +246,7 @@ int VerifyAddition(bool bReportIndividualTestCases) { // enumerate all subtraction cases for an fixpnt configuration template -int VerifySubtraction(bool bReportIndividualTestCases) { +int VerifySubtraction(bool reportTestCases) { constexpr unsigned NR_VALUES = (unsigned(1) << nbits); int nrOfFailedTests = 0; fixpnt a, b, result, cref; @@ -283,10 +283,10 @@ int VerifySubtraction(bool bReportIndividualTestCases) { cref = ref; if (result != cref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportBinaryArithmeticError("FAIL", "-", a, b, cref, result); + if (reportTestCases) ReportBinaryArithmeticError("FAIL", "-", a, b, cref, result); } else { - // if (bReportIndividualTestCases) ReportBinaryArithmeticSuccess("PASS", "-", a, b, cref, result); + // if (reportTestCases) ReportBinaryArithmeticSuccess("PASS", "-", a, b, cref, result); } if (nrOfFailedTests > 100) return nrOfFailedTests; } @@ -298,7 +298,7 @@ int VerifySubtraction(bool bReportIndividualTestCases) { // enumerate all multiplication cases for an fixpnt configuration template -int VerifyMultiplication(bool bReportIndividualTestCases) { +int VerifyMultiplication(bool reportTestCases) { constexpr unsigned NR_VALUES = (unsigned(1) << nbits); int nrOfFailedTests = 0; fixpnt a, b, result, cref; @@ -335,10 +335,10 @@ int VerifyMultiplication(bool bReportIndividualTestCases) { cref = ref; if (result != cref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportBinaryArithmeticError("FAIL", "*", a, b, cref, result); + if (reportTestCases) ReportBinaryArithmeticError("FAIL", "*", a, b, cref, result); } else { - // if (bReportIndividualTestCases) ReportBinaryArithmeticSuccess("PASS", "*", a, b, cref, result); + // if (reportTestCases) ReportBinaryArithmeticSuccess("PASS", "*", a, b, cref, result); } if (nrOfFailedTests > 24) return nrOfFailedTests; } @@ -350,7 +350,7 @@ int VerifyMultiplication(bool bReportIndividualTestCases) { // enumerate all division cases for a fixpnt configuration template -int VerifyDivision(bool bReportIndividualTestCases) { +int VerifyDivision(bool reportTestCases) { constexpr unsigned NR_VALUES = (unsigned(1) << nbits); int nrOfFailedTests = 0; fixpnt a, b, result, cref; @@ -391,10 +391,10 @@ int VerifyDivision(bool bReportIndividualTestCases) { cref = ref; if (result != cref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportBinaryArithmeticError("FAIL", "/", a, b, result, cref); + if (reportTestCases) ReportBinaryArithmeticError("FAIL", "/", a, b, result, cref); } else { - // if (bReportIndividualTestCases) ReportBinaryArithmeticSuccess("PASS", "/", a, b, result, cref); + // if (reportTestCases) ReportBinaryArithmeticSuccess("PASS", "/", a, b, result, cref); } // if (nrOfFailedTests > 1) return nrOfFailedTests; } diff --git a/include/universal/verification/fixpnt_math_test_suite.hpp b/include/universal/verification/fixpnt_test_suite_mathlib.hpp similarity index 100% rename from include/universal/verification/fixpnt_math_test_suite.hpp rename to include/universal/verification/fixpnt_test_suite_mathlib.hpp diff --git a/include/universal/verification/lns_math_test_suite.hpp b/include/universal/verification/lns_test_suite_mathlib.hpp similarity index 100% rename from include/universal/verification/lns_math_test_suite.hpp rename to include/universal/verification/lns_test_suite_mathlib.hpp diff --git a/include/universal/verification/posit_number_system.hpp b/include/universal/verification/posit_number_system.hpp new file mode 100644 index 000000000..025cf8a46 --- /dev/null +++ b/include/universal/verification/posit_number_system.hpp @@ -0,0 +1,109 @@ +#pragma once +// posit_number_system.hpp: reusable test suite for posit number systems +// +// Copyright (C) 2017 Stillwater Supercomputing, Inc. +// +// This file is part of the universal numbers project, which is released under an MIT Open Source license. +#include +#include +#include +#include +#include +//#include + +namespace sw { + namespace universal { + + template + int VerifySpecialCases(bool reportTestCases) { + int nrOfFailedTestCases = 0; + TestType v{ 0 }, maxpos(SpecificValue::maxpos); + if (!v.iszero()) { + if (reportTestCases) std::cerr << "FAIL: test of zero: " << to_binary(v, true) << " : " << v << '\n'; + ++nrOfFailedTestCases; + } + v = NAN; + if (!v.isnar()) { + if (reportTestCases) std::cerr << "FAIL: test of float assign NaN did not yield NaR: " << to_binary(v, true) << " : " << v << '\n'; + ++nrOfFailedTestCases; + } + v = INFINITY; + if (!v.isnar()) { + if (reportTestCases) std::cerr << "FAIL: test of float assign INF did not yield NaR: " << to_binary(v, true) << " : " << v << '\n'; + ++nrOfFailedTestCases; + } + v = double(NAN); + if (!v.isnar()) { + if (reportTestCases) std::cerr << "FAIL: test of double assign NaN did not yield NaR: " << to_binary(v, true) << " : " << v << '\n'; + ++nrOfFailedTestCases; + } + v = -double(INFINITY); + if (!v.isnar()) { + if (reportTestCases) std::cerr << "FAIL: test of double assign INF did not yield NaR: " << to_binary(v, true) << " : " << v << '\n'; + ++nrOfFailedTestCases; + } + return nrOfFailedTestCases; + } + + template + int ExhaustiveNumberSystemTest(const std::string& test_tag, bool reportTestCases) { + int nrOfFailedTestCases = 0; + + // special cases + nrOfFailedTestCases += ReportTestResult(VerifySpecialCases (reportTestCases), test_tag, "special cases"); + + // conversion tests + std::cerr << "Assignment/conversion tests " << '\n'; + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion (reportTestCases), test_tag, "integer assign (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyConversion (reportTestCases), test_tag, "float assign (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyConversion (reportTestCases), test_tag, "double assign (native) "); + + // logic tests + std::cerr << "Logic function tests " << '\n'; + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual (reportTestCases), test_tag, " == "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual (reportTestCases), test_tag, " != "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan (reportTestCases), test_tag, " < "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan (reportTestCases), test_tag, " <= "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan (reportTestCases), test_tag, " > "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan(reportTestCases), test_tag, " >= "); + + // arithmetic tests + std::cerr << "Arithmetic tests " << '\n'; + nrOfFailedTestCases += ReportTestResult(VerifyNegation (reportTestCases), test_tag, "negate (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyAddition (reportTestCases), test_tag, "add (native) "); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction (reportTestCases), test_tag, "subtract (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication (reportTestCases), test_tag, "multiply (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyDivision (reportTestCases), test_tag, "divide (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyInPlaceAddition (reportTestCases), test_tag, "+= (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyInPlaceSubtraction (reportTestCases), test_tag, "-= (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyInPlaceMultiplication (reportTestCases), test_tag, "*= (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyInPlaceDivision (reportTestCases), test_tag, "/= (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation (reportTestCases), test_tag, "reciprocate (native) "); + + // elementary function tests + std::cerr << "Elementary function tests " << '\n'; + nrOfFailedTestCases += ReportTestResult(VerifySqrt (reportTestCases), test_tag, "sqrt (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyExp (reportTestCases), test_tag, "exp "); + nrOfFailedTestCases += ReportTestResult(VerifyExp2 (reportTestCases), test_tag, "exp2 "); + nrOfFailedTestCases += ReportTestResult(VerifyLog (reportTestCases), test_tag, "log "); + nrOfFailedTestCases += ReportTestResult(VerifyLog2 (reportTestCases), test_tag, "log2 "); + nrOfFailedTestCases += ReportTestResult(VerifyLog10 (reportTestCases), test_tag, "log10 "); + nrOfFailedTestCases += ReportTestResult(VerifySine (reportTestCases), test_tag, "sin "); + nrOfFailedTestCases += ReportTestResult(VerifyCosine (reportTestCases), test_tag, "cos "); + nrOfFailedTestCases += ReportTestResult(VerifyTangent (reportTestCases), test_tag, "tan "); + nrOfFailedTestCases += ReportTestResult(VerifyAtan (reportTestCases), test_tag, "atan "); + nrOfFailedTestCases += ReportTestResult(VerifyAsin (reportTestCases), test_tag, "asin "); + nrOfFailedTestCases += ReportTestResult(VerifyAcos (reportTestCases), test_tag, "acos "); + nrOfFailedTestCases += ReportTestResult(VerifySinh (reportTestCases), test_tag, "sinh "); + nrOfFailedTestCases += ReportTestResult(VerifyCosh (reportTestCases), test_tag, "cosh "); + nrOfFailedTestCases += ReportTestResult(VerifyTanh (reportTestCases), test_tag, "tanh "); + nrOfFailedTestCases += ReportTestResult(VerifyAtanh (reportTestCases), test_tag, "atanh "); + nrOfFailedTestCases += ReportTestResult(VerifyAcosh (reportTestCases), test_tag, "acosh "); + nrOfFailedTestCases += ReportTestResult(VerifyAsinh (reportTestCases), test_tag, "asinh "); + + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction (reportTestCases), test_tag, "pow "); + + return nrOfFailedTestCases; + } + +} } // namespace sw::universal diff --git a/include/universal/verification/posit_test_suite.hpp b/include/universal/verification/posit_test_suite.hpp index b99cd7066..c504f303a 100644 --- a/include/universal/verification/posit_test_suite.hpp +++ b/include/universal/verification/posit_test_suite.hpp @@ -49,8 +49,10 @@ namespace sw { namespace universal { } // enumerate all conversion cases for a posit configuration - template + template int VerifyConversion(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; // we are going to generate a test set that consists of all posit configs and their midpoints // we do this by enumerating a posit that is 1-bit larger than the test posit configuration // These larger posits will be at the mid-point between the smaller posit sample values @@ -64,16 +66,16 @@ namespace sw { namespace universal { std::cout << "VerifyConversion<" << nbits << "," << es << ">: NR_TEST_CASES = " << NR_TEST_CASES << " constrained due to nbits > 20" << std::endl; } - double halfMinpos = double(posit(SpecificValue::minpos)) / 2.0; + SrcType halfMinpos = SrcType(posit(SpecificValue::minpos)) / 2.0; // execute the test int nrOfFailedTests = 0; for (unsigned i = 0; i < NR_TEST_CASES; i++) { posit pref, pprev, pnext; pref.setbits(i); - double da = double(pref); - double eps = double(i == 0 ? halfMinpos : (da > 0 ? da * 1.0e-6 : da * -1.0e-6)); - double input; + SrcType da = SrcType(pref); + SrcType eps = double(i == 0 ? halfMinpos : (da > 0 ? da * 1.0e-6 : da * -1.0e-6)); + SrcType input; posit pa; if (i % 2) { if (i == 1) { @@ -162,19 +164,44 @@ namespace sw { namespace universal { } template<> - int VerifyConversion(bool reportTestCases) { + int VerifyConversion, float>(bool reportTestCases) { + using SrcType = float; + int nrOfFailedTestCases = 0; + // special case + posit p = -INFINITY; + if (!isnar(p)) nrOfFailedTestCases++; + // test vector + std::vector in = { -4.0, -2.0, -1.0, -0.5, -0.25, 0.0, 0.25, 0.5, 1.0, 2.0, 4.0 }; + std::vector ref = { -1.0, -1.0, -1.0, -1.0, -1.00, 0.0, 1.00, 1.0, 1.0, 1.0, 1.0 }; + unsigned ref_index = 0; + for (auto v : in) { + p = v; + SrcType refv = ref[ref_index++]; + if (SrcType(p) != refv) { + if (reportTestCases) std::cout << " FAIL " << p << " != " << refv << std::endl; + nrOfFailedTestCases++; + } + else { + //if (reportTestCases) std::cout << " PASS " << p << " == " << refv << std::endl; + } + } + return nrOfFailedTestCases; + } + template<> + int VerifyConversion, double>(bool reportTestCases) { + using SrcType = double; int nrOfFailedTestCases = 0; // special case posit p = -INFINITY; if (!isnar(p)) nrOfFailedTestCases++; // test vector - std::vector in = { -4.0, -2.0, -1.0, -0.5, -0.25, 0.0, 0.25, 0.5, 1.0, 2.0, 4.0 }; - std::vector ref = { -1.0, -1.0, -1.0, -1.0, -1.00, 0.0, 1.00, 1.0, 1.0, 1.0, 1.0 }; + std::vector in = { -4.0, -2.0, -1.0, -0.5, -0.25, 0.0, 0.25, 0.5, 1.0, 2.0, 4.0 }; + std::vector ref = { -1.0, -1.0, -1.0, -1.0, -1.00, 0.0, 1.00, 1.0, 1.0, 1.0, 1.0 }; unsigned ref_index = 0; for (auto v : in) { p = v; - double refv = ref[ref_index++]; - if (double(p) != refv) { + SrcType refv = ref[ref_index++]; + if (SrcType(p) != refv) { if (reportTestCases) std::cout << " FAIL " << p << " != " << refv << std::endl; nrOfFailedTestCases++; } @@ -186,26 +213,22 @@ namespace sw { namespace universal { } // enumerate all conversion cases for integers - template + template int VerifyIntegerConversion(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; // we generate numbers from 1 via NaR to -1 and through the special case of 0 back to 1 constexpr unsigned max = nbits > 20 ? 20 : nbits; unsigned NR_TEST_CASES = (unsigned(1) << (max - 1)) + 1; int nrOfFailedTestCases = 0; - // special cases in case we are clipped by the nbits > 20 - long ref = 0x80000000; // -2147483648 - posit presult(ref); - if (ref != presult) { - std::cout << " FAIL long(" << ref << ") != long(" << presult << ") : reference = -2147483648" << std::endl; - nrOfFailedTestCases++; - } posit p(1); for (unsigned i = 0; i < NR_TEST_CASES; ++i) { + //std::cout << to_binary(p) << " : " << p << '\n'; if (!p.isnar()) { - ref = (long)p; // obtain the integer cast of this posit - presult = ref; // assign this integer to a posit - if (ref != presult) { // compare the integer cast to the reference posit - if (reportTestCases) std::cout << " FAIL long(" << p << ") != long(" << presult << ") : reference = " << ref << std::endl; + long long ref = (long long)(p); // obtain the integer cast of this posit + posit presult = ref; // assign this integer to a posit + if (ref != (long long)presult) { // compare the integer cast to the reference posit + if (reportTestCases) std::cout << " FAIL " << p << " != " << presult << " : reference = " << ref << std::endl; nrOfFailedTestCases++; } else { @@ -262,8 +285,10 @@ namespace sw { namespace universal { */ // enumerate all conversion cases for integers - template + template int VerifyUintConversion(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; // we generate numbers from 1 via NaR to -1 and through the special case of 0 back to 1 constexpr unsigned max = nbits > 20 ? 20 : nbits; unsigned NR_TEST_CASES = (unsigned(1) << (max - 1)) + 1; @@ -313,8 +338,10 @@ namespace sw { namespace universal { } // Generate ordered set in ascending order from [-NaR, -maxpos, ..., +maxpos] for a particular posit config - template - void GenerateOrderedPositSet(std::vector>& set) { + template + void GenerateOrderedPositSet(std::vector& set) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; constexpr unsigned NR_OF_REALS = (unsigned(1) << nbits); // don't do this for state spaces larger than 4G std::vector< posit > s(NR_OF_REALS); posit p; @@ -329,8 +356,10 @@ namespace sw { namespace universal { } // Verify the increment operator++ - template + template int VerifyIncrement(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; std::vector< posit > set; GenerateOrderedPositSet(set); // [NaR, -maxpos, ..., -minpos, 0, minpos, ..., maxpos] @@ -352,9 +381,10 @@ namespace sw { namespace universal { } // Verify the decrement operator-- - template - int VerifyDecrement(bool reportTestCases) - { + template + int VerifyDecrement(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; std::vector< posit > set; GenerateOrderedPositSet(set); // [NaR, -maxpos, ..., -minpos, 0, minpos, ..., maxpos] @@ -376,9 +406,10 @@ namespace sw { namespace universal { } // Verify the postfix operator++ - template - int VerifyPostfix(bool reportTestCases) - { + template + int VerifyPostfix(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; std::vector< posit > set; GenerateOrderedPositSet(set); // [NaR, -maxpos, ..., -minpos, 0, minpos, ..., maxpos] @@ -400,9 +431,10 @@ namespace sw { namespace universal { } // Verify the prefix operator++ - template - int VerifyPrefix(bool reportTestCases) - { + template + int VerifyPrefix(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; std::vector< posit > set; GenerateOrderedPositSet(set); // [NaR, -maxpos, ..., -minpos, 0, minpos, ..., maxpos] @@ -424,8 +456,10 @@ namespace sw { namespace universal { } // enumerate all negation cases for a posit configuration: executes within 10 sec till about nbits = 14 - template + template int VerifyNegation(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; constexpr unsigned NR_TEST_CASES = (unsigned(1) << nbits); int nrOfFailedTests = 0; posit pa(0), pneg(0), pref(0); @@ -449,8 +483,10 @@ namespace sw { namespace universal { } // enumerate all SQRT cases for a posit configuration: executes within 10 sec till about nbits = 14 - template + template int VerifySqrt(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; constexpr unsigned NR_TEST_CASES = (unsigned(1) << nbits); int nrOfFailedTests = 0; @@ -475,8 +511,10 @@ namespace sw { namespace universal { } // enumerate all addition cases for a posit configuration - template + template int VerifyAddition(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; const unsigned NR_POSITS = (unsigned(1) << nbits); int nrOfFailedTests = 0; posit pa, pb, psum, pref; @@ -521,8 +559,10 @@ namespace sw { namespace universal { } // enumerate all addition cases for a posit configuration - template + template int VerifyInPlaceAddition(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; const unsigned NR_POSITS = (unsigned(1) << nbits); int nrOfFailedTests = 0; for (unsigned i = 0; i < NR_POSITS; i++) { @@ -567,8 +607,10 @@ namespace sw { namespace universal { } // enumerate all subtraction cases for a posit configuration: is within 10sec till about nbits = 14 - template + template int VerifySubtraction(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; const unsigned NR_POSITS = (unsigned(1) << nbits); int nrOfFailedTests = 0; for (unsigned i = 0; i < NR_POSITS; i++) { @@ -611,8 +653,10 @@ namespace sw { namespace universal { } // enumerate all subtraction cases for a posit configuration: is within 10sec till about nbits = 14 - template + template int VerifyInPlaceSubtraction(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; const unsigned NR_POSITS = (unsigned(1) << nbits); int nrOfFailedTests = 0; for (unsigned i = 0; i < NR_POSITS; i++) { @@ -656,8 +700,10 @@ namespace sw { namespace universal { } // enumerate all multiplication cases for a posit configuration: is within 10sec till about nbits = 14 - template + template int VerifyMultiplication(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; int nrOfFailedTests = 0; const unsigned NR_POSITS = (unsigned(1) << nbits); for (unsigned i = 0; i < NR_POSITS; i++) { @@ -698,8 +744,10 @@ namespace sw { namespace universal { } // enumerate all multiplication cases for a posit configuration: is within 10sec till about nbits = 14 - template + template int VerifyInPlaceMultiplication(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; int nrOfFailedTests = 0; const unsigned NR_POSITS = (unsigned(1) << nbits); for (unsigned i = 0; i < NR_POSITS; i++) { @@ -742,8 +790,10 @@ namespace sw { namespace universal { } // enerate all reciprocation cases for a posit configuration: executes within 10 sec till about nbits = 14 - template + template int VerifyReciprocation(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; const unsigned NR_TEST_CASES = (unsigned(1) << nbits); int nrOfFailedTests = 0; for (unsigned i = 0; i < NR_TEST_CASES; i++) { @@ -751,15 +801,39 @@ namespace sw { namespace universal { pa.setbits(i); // generate reference double da; - if (pa.isnar()) { - preference.setnar(); +#if POSIT_THROW_ARITHMETIC_EXCEPTION + try { + preciprocal = pa.reciprocal(); + if (pa.isnar()) { + preference.setnar(); + } + else { + da = double(pa); + preference = 1.0 / da; + } } - else { - da = double(pa); - preference = 1.0 / da; + catch (const posit_divide_by_zero& err) { + if (pa.iszero()) { + // correctly caught the exception + } + else { + throw err; + } } - preciprocal = pa.reciprocate(); - + catch (const posit_divide_by_nar& err) { + if (pa.isnar()) { + // correctly caught the exception + preference.setnar(); + } + else { + throw err; + } + } +#else + preciprocal = pa.reciprocal(); // this will err when pa == 0 + da = double(pa); + preference = 1.0 / da; +#endif if (preciprocal != preference) { nrOfFailedTests++; if (reportTestCases) ReportUnaryArithmeticError("FAIL", "reciprocate", pa, preciprocal, preference); @@ -772,8 +846,10 @@ namespace sw { namespace universal { } // enumerate all division cases for a posit configuration: is within 10sec till about nbits = 14 - template + template int VerifyDivision(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; constexpr unsigned NR_POSITS = (unsigned(1) << nbits); int nrOfFailedTests = 0; for (unsigned i = 0; i < NR_POSITS; i++) { @@ -845,8 +921,10 @@ namespace sw { namespace universal { } // enumerate all division cases for a posit configuration: is within 10sec till about nbits = 14 - template + template int VerifyInPlaceDivision(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; constexpr unsigned NR_POSITS = (unsigned(1) << nbits); int nrOfFailedTests = 0; for (unsigned i = 0; i < NR_POSITS; i++) { @@ -921,8 +999,10 @@ namespace sw { namespace universal { // Posit equal diverges from IEEE float in dealing with INFINITY/NAN // Posit NaR can be checked for equality/inequality - template - int VerifyPositLogicEqual() { + template + int VerifyLogicEqual(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; constexpr unsigned max = nbits > 10 ? 10 : nbits; unsigned NR_TEST_CASES = (unsigned(1) << max); int nrOfFailedTestCases = 0; @@ -957,7 +1037,7 @@ namespace sw { namespace universal { bool presult = (a == b); if (ref != presult) { nrOfFailedTestCases++; - std::cout << a << " == " << b << " fails: reference is " << ref << " actual is " << presult << std::endl; + if (reportTestCases) std::cout << a << " == " << b << " fails: reference is " << ref << " actual is " << presult << std::endl; } } } @@ -966,8 +1046,10 @@ namespace sw { namespace universal { // Posit not-equal diverges from IEEE float in dealing with INFINITY/NAN // Posit NaR can be checked for equality/inequality - template - int VerifyPositLogicNotEqual() { + template + int VerifyLogicNotEqual(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; constexpr unsigned max = nbits > 10 ? 10 : nbits; unsigned NR_TEST_CASES = (unsigned(1) << max); int nrOfFailedTestCases = 0; @@ -1003,7 +1085,7 @@ namespace sw { namespace universal { bool presult = (a != b); if (ref != presult) { nrOfFailedTestCases++; - std::cout << a << " != " << b << " fails: reference is " << ref << " actual is " << presult << std::endl; + if (reportTestCases) std::cout << a << " != " << b << " fails: reference is " << ref << " actual is " << presult << std::endl; } } } @@ -1012,8 +1094,10 @@ namespace sw { namespace universal { // Posit less-than diverges from IEEE float in dealing with INFINITY/NAN // Posit NaR is smaller than any other value - template - int VerifyPositLogicLessThan() { + template + int VerifyLogicLessThan(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; constexpr unsigned max = nbits > 10 ? 10 : nbits; unsigned NR_TEST_CASES = (unsigned(1) << max); int nrOfFailedTestCases = 0; @@ -1040,7 +1124,7 @@ namespace sw { namespace universal { bool presult = (a < b); if (ref != presult) { nrOfFailedTestCases++; - std::cout << a << " < " << b << " fails: reference is " << ref << " actual is " << presult << std::endl; + if (reportTestCases) std::cout << a << " < " << b << " fails: reference is " << ref << " actual is " << presult << std::endl; } } } @@ -1049,8 +1133,10 @@ namespace sw { namespace universal { // Posit greater-than diverges from IEEE float in dealing with INFINITY/NAN // Any number is greater-than posit NaR - template - int VerifyPositLogicGreaterThan() { + template + int VerifyLogicGreaterThan(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; constexpr unsigned max = nbits > 10 ? 10 : nbits; unsigned NR_TEST_CASES = (unsigned(1) << max); int nrOfFailedTestCases = 0; @@ -1069,7 +1155,7 @@ namespace sw { namespace universal { bool presult = (a > b); if (ref != presult) { nrOfFailedTestCases++; - std::cout << a << " > " << b << " fails: reference is " << ref << " actual is " << presult << std::endl; + if (reportTestCases) std::cout << a << " > " << b << " fails: reference is " << ref << " actual is " << presult << std::endl; } } } @@ -1078,8 +1164,10 @@ namespace sw { namespace universal { // Posit less-or-equal-than diverges from IEEE float in dealing with INFINITY/NAN // Posit NaR is smaller or equal than any other value - template - int VerifyPositLogicLessOrEqualThan() { + template + int VerifyLogicLessOrEqualThan(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; constexpr unsigned max = nbits > 10 ? 10 : nbits; unsigned NR_TEST_CASES = (unsigned(1) << max); int nrOfFailedTestCases = 0; @@ -1099,7 +1187,7 @@ namespace sw { namespace universal { bool presult = (a <= b); if (ref != presult) { nrOfFailedTestCases++; - std::cout << a << " <= " << b << " fails: reference is " << ref << " actual is " << presult << std::endl; + if (reportTestCases) std::cout << a << " <= " << b << " fails: reference is " << ref << " actual is " << presult << std::endl; } } } @@ -1108,8 +1196,10 @@ namespace sw { namespace universal { // Posit greater-or-equal-than diverges from IEEE float in dealing with INFINITY/NAN // Any number is greater-or-equal-than posit NaR - template - int VerifyPositLogicGreaterOrEqualThan() { + template + int VerifyLogicGreaterOrEqualThan(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; constexpr unsigned max = nbits > 10 ? 10 : nbits; unsigned NR_TEST_CASES = (unsigned(1) << max); int nrOfFailedTestCases = 0; @@ -1129,7 +1219,7 @@ namespace sw { namespace universal { bool presult = (a >= b); if (ref != presult) { nrOfFailedTestCases++; - std::cout << a << " >= " << b << " fails: reference is " << ref << " actual is " << presult << std::endl; + if (reportTestCases) std::cout << a << " >= " << b << " fails: reference is " << ref << " actual is " << presult << std::endl; } } } diff --git a/include/universal/verification/posit_math_test_suite.hpp b/include/universal/verification/posit_test_suite_mathlib.hpp similarity index 86% rename from include/universal/verification/posit_math_test_suite.hpp rename to include/universal/verification/posit_test_suite_mathlib.hpp index 411920739..28f3cecae 100644 --- a/include/universal/verification/posit_math_test_suite.hpp +++ b/include/universal/verification/posit_test_suite_mathlib.hpp @@ -1,8 +1,8 @@ #pragma once -// posit_math_test_suite.hpp : functions to aid in testing and test reporting of function evaluation on posit types. +// posit_test_suite_mathlib.hpp : functions to aid in testing and test reporting of function evaluation on posit types. // Needs to be included after posit type is declared. // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -13,7 +13,6 @@ // mathematical function definitions and implementations #include -#include #include namespace sw { namespace universal { @@ -23,11 +22,12 @@ namespace sw { namespace universal { //////////////////////////////////// MATHEMATICAL FUNCTIONS ////////////////////////////////////////// // enumerate all NATURAL LOGARITHM cases for a posit configuration -template +template int VerifyLog(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, plog, pref; + TestType pa, plog, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -48,11 +48,12 @@ int VerifyLog(bool reportTestCases) { // enumerate all BINARY LOGARITHM cases for a posit configuration -template +template int VerifyLog2(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, plog2, pref; + TestType pa, plog2, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -73,11 +74,12 @@ int VerifyLog2(bool reportTestCases) { // enumerate all DECIMAL LOGARITHM cases for a posit configuration -template +template int VerifyLog10(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, plog10, pref; + TestType pa, plog10, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -98,11 +100,12 @@ int VerifyLog10(bool reportTestCases) { // enumerate all base-e exponent cases for a posit configuration -template +template int VerifyExp(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, pexp, pref; + TestType pa, pexp, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -125,11 +128,12 @@ int VerifyExp(bool reportTestCases) { // enumerate all base-2 exponent cases for a posit configuration -template +template int VerifyExp2(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, pexp2, pref; + TestType pa, pexp2, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -152,11 +156,12 @@ int VerifyExp2(bool reportTestCases) { // enumerate all power method cases for a posit configuration -template +template int VerifyPowerFunction(bool reportTestCases, unsigned int maxSamples = 10000) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (unsigned(1) << nbits); int nrOfFailedTests = 0; - posit pa, pb, ppow, pref; + TestType pa, pb, ppow, pref; uint32_t testNr = 0; for (size_t i = 0; i < NR_TEST_CASES; ++i) { @@ -201,11 +206,12 @@ int VerifyPowerFunction(bool reportTestCases, unsigned int maxSamples = 10000) { // enumerate all trigonometric sine cases for a posit configuration -template +template int VerifySine(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, psin, pref; + TestType pa, psin, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -226,11 +232,12 @@ int VerifySine(bool reportTestCases) { // enumerate all trigonometric cosine cases for a posit configuration -template +template int VerifyCosine(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, pcos, pref; + TestType pa, pcos, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -251,11 +258,12 @@ int VerifyCosine(bool reportTestCases) { // enumerate all trigonometric tangent cases for a posit configuration -template +template int VerifyTangent(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, ptan, pref; + TestType pa, ptan, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -276,11 +284,12 @@ int VerifyTangent(bool reportTestCases) { // enumerate all trigonometric cotangent cases for a posit configuration -template +template int VerifyAtan(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, patan, pref; + TestType pa, patan, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -301,11 +310,12 @@ int VerifyAtan(bool reportTestCases) { // enumerate all trigonometric sec cases for a posit configuration -template +template int VerifyAsin(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, pasin, pref; + TestType pa, pasin, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -326,11 +336,12 @@ int VerifyAsin(bool reportTestCases) { // enumerate all trigonometric cosec cases for a posit configuration -template +template int VerifyAcos(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, pacos, pref; + TestType pa, pacos, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -351,11 +362,12 @@ int VerifyAcos(bool reportTestCases) { // enumerate all hyperbolic sine cases for a posit configuration -template +template int VerifySinh(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, psinh, pref; + TestType pa, psinh, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -376,11 +388,12 @@ int VerifySinh(bool reportTestCases) { // enumerate all hyperbolic cosine cases for a posit configuration -template +template int VerifyCosh(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, pcosh, pref; + TestType pa, pcosh, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -401,11 +414,12 @@ int VerifyCosh(bool reportTestCases) { // enumerate all hyperbolic tangent cases for a posit configuration -template +template int VerifyTanh(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, ptanh, pref; + TestType pa, ptanh, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -426,11 +440,12 @@ int VerifyTanh(bool reportTestCases) { // enumerate all hyperbolic cotangent cases for a posit configuration -template +template int VerifyAtanh(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, patanh, pref; + TestType pa, patanh, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -451,11 +466,12 @@ int VerifyAtanh(bool reportTestCases) { // enumerate all hyperbolic sec cases for a posit configuration -template +template int VerifyAsinh(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, pasinh, pref; + TestType pa, pasinh, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -476,11 +492,12 @@ int VerifyAsinh(bool reportTestCases) { // enumerate all hyperbolic cosec cases for a posit configuration -template +template int VerifyAcosh(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, pacosh, pref; + TestType pa, pacosh, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); @@ -501,11 +518,12 @@ int VerifyAcosh(bool reportTestCases) { // enumerate all hypotenuse cases for a posit configuration -template +template int VerifyHypot(bool reportTestCases) { + constexpr unsigned nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - posit pa, pb, phypot, pref; + TestType pa, pb, phypot, pref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { pa.setbits(i); diff --git a/include/universal/verification/posit_test_randoms.hpp b/include/universal/verification/posit_test_suite_randoms.hpp similarity index 99% rename from include/universal/verification/posit_test_randoms.hpp rename to include/universal/verification/posit_test_suite_randoms.hpp index 5e38d3d66..ea91d7cec 100644 --- a/include/universal/verification/posit_test_randoms.hpp +++ b/include/universal/verification/posit_test_suite_randoms.hpp @@ -1,5 +1,5 @@ #pragma once -// posit_test_randoms.hpp : posit verification functions based on random operand generation testing +// posit_test_suite_randoms.hpp : posit verification functions based on random operand generation testing // Needs to be included after posit type is declared. // // Copyright (C) 2017 Stillwater Supercomputing, Inc. diff --git a/include/universal/verification/test_number_system.hpp b/include/universal/verification/test_number_system.hpp index ab44090b1..377274320 100644 --- a/include/universal/verification/test_number_system.hpp +++ b/include/universal/verification/test_number_system.hpp @@ -11,89 +11,93 @@ #include //#include -template -int ExhaustiveNumberSystemTest(const std::string& test_tag, bool reportTestCases) { - using namespace std; - using namespace sw::universal; - int nrOfFailedTestCases = 0; - TestType v; +namespace sw { namespace universal { - // special cases - v = 0; - if (!v.iszero()) { - cout << "FAIL: test of zero: " << to_binary(v, true) << " : " << v << '\n'; - ++nrOfFailedTestCases; - } - v = NAN; - if (!v.isnan()) { - cout << "FAIL: test of float assign to NaN: " << to_binary(v, true) << " : " << v << '\n'; - ++nrOfFailedTestCases; - } - v = INFINITY; - if (!v.isinf()) { - cout << "FAIL: test of float assign to INF: " << to_binary(v, true) << " : " << v << '\n'; - ++nrOfFailedTestCases; - } - v = double(NAN); - if (!v.isnan()) { - cout << "FAIL: test of double assign to NaN: " << to_binary(v, true) << " : " << v << '\n'; - ++nrOfFailedTestCases; - } - v = double(INFINITY); - if (!v.isinf()) { - cout << "FAIL: test of double assign to INF: " << to_binary(v, true) << " : " << v << '\n'; - ++nrOfFailedTestCases; - } + template + int ExhaustiveNumberSystemTest(const std::string& test_tag, bool reportTestCases) { + using namespace std; + using namespace sw::universal; + int nrOfFailedTestCases = 0; + TestType v; + + // special cases + v = 0; + if (!v.iszero()) { + cout << "FAIL: test of zero: " << to_binary(v, true) << " : " << v << '\n'; + ++nrOfFailedTestCases; + } + v = NAN; + if (!v.isnan()) { + cout << "FAIL: test of float assign to NaN: " << to_binary(v, true) << " : " << v << '\n'; + ++nrOfFailedTestCases; + } + v = INFINITY; + if (!v.isinf()) { + cout << "FAIL: test of float assign to INF: " << to_binary(v, true) << " : " << v << '\n'; + ++nrOfFailedTestCases; + } + v = double(NAN); + if (!v.isnan()) { + cout << "FAIL: test of double assign to NaN: " << to_binary(v, true) << " : " << v << '\n'; + ++nrOfFailedTestCases; + } + v = double(INFINITY); + if (!v.isinf()) { + cout << "FAIL: test of double assign to INF: " << to_binary(v, true) << " : " << v << '\n'; + ++nrOfFailedTestCases; + } - // logic tests - nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual (), test_tag, " == "); - nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual (), test_tag, " != "); - nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan (), test_tag, " < "); - nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan (), test_tag, " <= "); - nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan (), test_tag, " > "); - nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan(), test_tag, " >= "); + // logic tests + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual (reportTestCases), test_tag, " == "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual (reportTestCases), test_tag, " != "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan (reportTestCases), test_tag, " < "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan (reportTestCases), test_tag, " <= "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan (reportTestCases), test_tag, " > "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan(reportTestCases), test_tag, " >= "); - // conversion tests - cout << "Assignment/conversion tests " << endl; - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion (reportTestCases), test_tag, "integer assign (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyConversion (reportTestCases), test_tag, "float assign (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyConversion (reportTestCases), test_tag, "double assign (native) "); + // conversion tests + cout << "Assignment/conversion tests " << endl; + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion (reportTestCases), test_tag, "integer assign (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyConversion (reportTestCases), test_tag, "float assign (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyConversion (reportTestCases), test_tag, "double assign (native) "); - // arithmetic tests - cout << "Arithmetic tests " << endl; - nrOfFailedTestCases += ReportTestResult(VerifyNegation (reportTestCases), test_tag, "negate (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyAddition (reportTestCases), test_tag, "add (native) "); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction (reportTestCases), test_tag, "subtract (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication (reportTestCases), test_tag, "multiply (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyDivision (reportTestCases), test_tag, "divide (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyInPlaceAddition (reportTestCases), test_tag, "+= (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyInPlaceSubtraction (reportTestCases), test_tag, "-= (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyInPlaceMultiplication (reportTestCases), test_tag, "*= (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyInPlaceDivision (reportTestCases), test_tag, "/= (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation (reportTestCases), test_tag, "reciprocate (native) "); + // arithmetic tests + cout << "Arithmetic tests " << endl; + nrOfFailedTestCases += ReportTestResult(VerifyNegation (reportTestCases), test_tag, "negate (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyAddition (reportTestCases), test_tag, "add (native) "); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction (reportTestCases), test_tag, "subtract (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication (reportTestCases), test_tag, "multiply (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyDivision (reportTestCases), test_tag, "divide (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyInPlaceAddition (reportTestCases), test_tag, "+= (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyInPlaceSubtraction (reportTestCases), test_tag, "-= (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyInPlaceMultiplication (reportTestCases), test_tag, "*= (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyInPlaceDivision (reportTestCases), test_tag, "/= (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation (reportTestCases), test_tag, "reciprocate (native) "); - // elementary function tests - cout << "Elementary function tests " << endl; - nrOfFailedTestCases += ReportTestResult(VerifySqrt (reportTestCases), test_tag, "sqrt (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyExp (reportTestCases), test_tag, "exp "); - nrOfFailedTestCases += ReportTestResult(VerifyExp2 (reportTestCases), test_tag, "exp2 "); - nrOfFailedTestCases += ReportTestResult(VerifyLog (reportTestCases), test_tag, "log "); - nrOfFailedTestCases += ReportTestResult(VerifyLog2 (reportTestCases), test_tag, "log2 "); - nrOfFailedTestCases += ReportTestResult(VerifyLog10 (reportTestCases), test_tag, "log10 "); - nrOfFailedTestCases += ReportTestResult(VerifySine (reportTestCases), test_tag, "sin "); - nrOfFailedTestCases += ReportTestResult(VerifyCosine (reportTestCases), test_tag, "cos "); - nrOfFailedTestCases += ReportTestResult(VerifyTangent (reportTestCases), test_tag, "tan "); - nrOfFailedTestCases += ReportTestResult(VerifyAtan (reportTestCases), test_tag, "atan "); - nrOfFailedTestCases += ReportTestResult(VerifyAsin (reportTestCases), test_tag, "asin "); - nrOfFailedTestCases += ReportTestResult(VerifyAcos (reportTestCases), test_tag, "acos "); - nrOfFailedTestCases += ReportTestResult(VerifySinh (reportTestCases), test_tag, "sinh "); - nrOfFailedTestCases += ReportTestResult(VerifyCosh (reportTestCases), test_tag, "cosh "); - nrOfFailedTestCases += ReportTestResult(VerifyTanh (reportTestCases), test_tag, "tanh "); - nrOfFailedTestCases += ReportTestResult(VerifyAtanh (reportTestCases), test_tag, "atanh "); - nrOfFailedTestCases += ReportTestResult(VerifyAcosh (reportTestCases), test_tag, "acosh "); - nrOfFailedTestCases += ReportTestResult(VerifyAsinh (reportTestCases), test_tag, "asinh "); + // elementary function tests + cout << "Elementary function tests " << endl; + nrOfFailedTestCases += ReportTestResult(VerifySqrt (reportTestCases), test_tag, "sqrt (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyExp (reportTestCases), test_tag, "exp "); + nrOfFailedTestCases += ReportTestResult(VerifyExp2 (reportTestCases), test_tag, "exp2 "); + nrOfFailedTestCases += ReportTestResult(VerifyLog (reportTestCases), test_tag, "log "); + nrOfFailedTestCases += ReportTestResult(VerifyLog2 (reportTestCases), test_tag, "log2 "); + nrOfFailedTestCases += ReportTestResult(VerifyLog10 (reportTestCases), test_tag, "log10 "); + nrOfFailedTestCases += ReportTestResult(VerifySine (reportTestCases), test_tag, "sin "); + nrOfFailedTestCases += ReportTestResult(VerifyCosine (reportTestCases), test_tag, "cos "); + nrOfFailedTestCases += ReportTestResult(VerifyTangent (reportTestCases), test_tag, "tan "); + nrOfFailedTestCases += ReportTestResult(VerifyAtan (reportTestCases), test_tag, "atan "); + nrOfFailedTestCases += ReportTestResult(VerifyAsin (reportTestCases), test_tag, "asin "); + nrOfFailedTestCases += ReportTestResult(VerifyAcos (reportTestCases), test_tag, "acos "); + nrOfFailedTestCases += ReportTestResult(VerifySinh (reportTestCases), test_tag, "sinh "); + nrOfFailedTestCases += ReportTestResult(VerifyCosh (reportTestCases), test_tag, "cosh "); + nrOfFailedTestCases += ReportTestResult(VerifyTanh (reportTestCases), test_tag, "tanh "); + nrOfFailedTestCases += ReportTestResult(VerifyAtanh (reportTestCases), test_tag, "atanh "); + nrOfFailedTestCases += ReportTestResult(VerifyAcosh (reportTestCases), test_tag, "acosh "); + nrOfFailedTestCases += ReportTestResult(VerifyAsinh (reportTestCases), test_tag, "asinh "); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction (reportTestCases), test_tag, "pow "); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction (reportTestCases), test_tag, "pow "); + + return nrOfFailedTestCases; + } - return nrOfFailedTestCases; -} +} } // namespace sw::universal diff --git a/include/universal/verification/test_suite_arithmetic.hpp b/include/universal/verification/test_suite_arithmetic.hpp index b010dd145..6ce407b8f 100644 --- a/include/universal/verification/test_suite_arithmetic.hpp +++ b/include/universal/verification/test_suite_arithmetic.hpp @@ -549,7 +549,7 @@ int VerifyReciprocation(bool reportTestCases) { double da = double(a); #if THROW_ARITHMETIC_EXCEPTION try { - reciprocal = a.reciprocate(); + reciprocal = a.reciprocal(); ref = 1.0 / da; } catch (...) { diff --git a/include/universal/verification/test_suite_logic.hpp b/include/universal/verification/test_suite_logic.hpp index 11eada7d9..8f7c477d8 100644 --- a/include/universal/verification/test_suite_logic.hpp +++ b/include/universal/verification/test_suite_logic.hpp @@ -1,7 +1,7 @@ #pragma once // test_suite_logic.hpp : boolean logic relationship test suite for arbitrary universal number systems // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include diff --git a/include/universal/verification/test_suite_random.hpp b/include/universal/verification/test_suite_randoms.hpp similarity index 100% rename from include/universal/verification/test_suite_random.hpp rename to include/universal/verification/test_suite_randoms.hpp diff --git a/static/bfloat/arithmetic/addition.cpp b/static/bfloat/arithmetic/addition.cpp index 3e37319b3..fc9c5007a 100644 --- a/static/bfloat/arithmetic/addition.cpp +++ b/static/bfloat/arithmetic/addition.cpp @@ -1,6 +1,6 @@ // addition.cpp: test suite runner for addition on bfloat16s // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include // Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override diff --git a/static/bfloat/arithmetic/arithmetic.cpp b/static/bfloat/arithmetic/arithmetic.cpp index ba7c8e5d8..af2252233 100644 --- a/static/bfloat/arithmetic/arithmetic.cpp +++ b/static/bfloat/arithmetic/arithmetic.cpp @@ -1,6 +1,6 @@ // arithmetic.cpp: test suite runner for arithmetic on bfloat16s // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include // Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override diff --git a/static/cfloat/arithmetic/decrement.cpp b/static/cfloat/arithmetic/decrement.cpp index da5ae690b..e83f15a7d 100644 --- a/static/cfloat/arithmetic/decrement.cpp +++ b/static/cfloat/arithmetic/decrement.cpp @@ -1,6 +1,6 @@ // decrement.cpp: test suite runner for decrement operator on classic floats // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include diff --git a/static/cfloat/arithmetic/nonsaturating/normal/addition.cpp b/static/cfloat/arithmetic/nonsaturating/normal/addition.cpp index 13c98c2fc..4e41295aa 100644 --- a/static/cfloat/arithmetic/nonsaturating/normal/addition.cpp +++ b/static/cfloat/arithmetic/nonsaturating/normal/addition.cpp @@ -1,6 +1,6 @@ // addition.cpp: test suite runner for addition on classic floats // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include @@ -199,7 +199,6 @@ try { #endif #if REGRESSION_LEVEL_2 -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<9, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 1,uint8_t, f,f,f>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<9, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 2,uint8_t, f,f,f>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<9, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 3,uint8_t, f,f,f>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<9, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 4,uint8_t, f,f,f>", "addition"); @@ -209,77 +208,74 @@ try { #endif #if REGRESSION_LEVEL_3 -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<10, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 1,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<10, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 2,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<10, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 3,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<10, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 4,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<10, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 2,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<10, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 3,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<10, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 4,uint8_t, f,f,f>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<10, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 5,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<10, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 6,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<10, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 7,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<10, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 8,uint8_t, f,f,f>", "addition"); - -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 1,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 2,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 3,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 4,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<10, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 6,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<10, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 7,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<10, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 8,uint8_t, f,f,f>", "addition"); + +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 2,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 3,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 4,uint8_t, f,f,f>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 5,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 6,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 7,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 8,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 9,uint8_t, f,f,f>", "addition"); - -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 1,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 2,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 3,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 4,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 6,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 7,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 8,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<11, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 9,uint8_t, f,f,f>", "addition"); + +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 2,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 3,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 4,uint8_t, f,f,f>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 5,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 6,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 7,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 8,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 9,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12,10,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 6,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 7,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 8,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 9,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<12,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12,10,uint8_t, f,f,f>", "addition"); #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 3,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 4,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 5,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 6,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 7,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 3,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 4,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 5,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 6,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 7,uint8_t, f,f,f>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 8,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 9,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,10,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13,11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,11,uint8_t, f,f,f>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 3,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 4,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 5,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 6,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 7,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 8,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 9,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,10,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<13,11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,11,uint8_t, f,f,f>", "addition"); + +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 3,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 4,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 5,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 6,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 7,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 8,uint8_t, f,f,f>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 9,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,10,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14,11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,11,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,10,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<14,11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,11,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 3,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 4,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 5,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 6,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 3,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 4,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 5,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 6,uint8_t, f,f,f>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 7,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 8,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 9,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15,10,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15,11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15,11,uint8_t, f,f,f>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 3,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 4,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 5,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 8,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 9,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15,10,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<15,11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15,11,uint8_t, f,f,f>", "addition"); + +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 3,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 4,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 5,uint8_t, f,f,f>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 6,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 7,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 8,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 9,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,10,uint8_t, f,f,f>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16,11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,11,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 7,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 8,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 9,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,10,uint8_t, f,f,f>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatAddition< cfloat<16,11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,11,uint8_t, f,f,f>", "addition"); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/cfloat/arithmetic/nonsaturating/normal/division.cpp b/static/cfloat/arithmetic/nonsaturating/normal/division.cpp index 44a442303..01923a167 100644 --- a/static/cfloat/arithmetic/nonsaturating/normal/division.cpp +++ b/static/cfloat/arithmetic/nonsaturating/normal/division.cpp @@ -1,6 +1,6 @@ // division.cpp: test suite runner for division on classic floats // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -11,7 +11,7 @@ //#define BLOCKTRIPLE_TRACE_DIV #include #include -#include +#include #include void ReportIeee754NotANumberArithmetic() @@ -234,7 +234,6 @@ try { #endif #if REGRESSION_LEVEL_2 -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<9, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 1,uint8_t,f,f,f>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<9, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 2,uint8_t,f,f,f>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<9, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 3,uint8_t,f,f,f>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<9, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 4,uint8_t,f,f,f>", "division"); @@ -242,7 +241,6 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<9, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 6,uint8_t,f,f,f>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<9, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 7,uint8_t,f,f,f>", "division"); -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<10, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 1,uint8_t,f,f,f>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<10, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 2,uint8_t,f,f,f>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<10, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 3,uint8_t,f,f,f>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<10, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 4,uint8_t,f,f,f>", "division"); @@ -251,70 +249,68 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<10, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 7,uint8_t,f,f,f>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<10, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 8,uint8_t,f,f,f>", "division"); -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 1,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 2,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 3,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 4,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 2,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 3,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 4,uint8_t,f,f,f>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 5,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 6,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 7,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 8,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 9,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 6,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 7,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 8,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<11, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 9,uint8_t,f,f,f>", "division"); #endif #if REGRESSION_LEVEL_3 -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 1,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 2,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 3,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 4,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 2,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 3,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 4,uint8_t,f,f,f>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 5,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 6,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 7,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 8,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 9,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12,10,uint8_t,f,f,f>", "division"); - - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 3,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 4,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 5,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 6,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 7,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 8,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 9,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<12,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12,10,uint8_t,f,f,f>", "division"); + +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 3,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 4,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 5,uint8_t,f,f,f>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 6,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 7,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 8,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 9,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,10,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,11,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 7,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 8,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 9,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,10,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<13, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,11,uint8_t,f,f,f>", "division"); #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 3,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 4,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 5,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 6,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 3,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 4,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 5,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 6,uint8_t,f,f,f>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 7,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 8,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 9,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,10,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,11,uint8_t,f,f,f>", "division"); - - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 3,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 4,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 5,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 6,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 7,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 8,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 9,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,10,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<14, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,11,uint8_t,f,f,f>", "division"); + +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 3,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 4,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 5,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 6,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 7,uint8_t,f,f,f>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 8,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 9,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15,10,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15,11,uint8_t,f,f,f>", "division"); - - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 3,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 4,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 5,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 6,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 7,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 9,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15,10,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<15, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15,11,uint8_t,f,f,f>", "division"); + +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 3,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 4,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 5,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 6,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 7,uint8_t,f,f,f>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 8,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 9,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,10,uint8_t,f,f,f>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,11,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 9,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,10,uint8_t,f,f,f>", "division"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatDivision< cfloat<16, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,11,uint8_t,f,f,f>", "division"); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/cfloat/arithmetic/nonsaturating/normal/fma.cpp b/static/cfloat/arithmetic/nonsaturating/normal/fma.cpp index 045064f7e..30a193527 100644 --- a/static/cfloat/arithmetic/nonsaturating/normal/fma.cpp +++ b/static/cfloat/arithmetic/nonsaturating/normal/fma.cpp @@ -1,6 +1,6 @@ // fma.cpp: test suite runner for cfloat fused multiply-accumulate algorithm // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. @@ -11,7 +11,7 @@ // #define CFLOAT_NATIVE_SQRT 1 #include #include -#include +#include #include // generate specific test case that you can trace with the trace conditions in posit.hpp diff --git a/static/cfloat/arithmetic/nonsaturating/normal/multiplication.cpp b/static/cfloat/arithmetic/nonsaturating/normal/multiplication.cpp index e6d4a90c3..a80529ff2 100644 --- a/static/cfloat/arithmetic/nonsaturating/normal/multiplication.cpp +++ b/static/cfloat/arithmetic/nonsaturating/normal/multiplication.cpp @@ -1,6 +1,6 @@ // multiplication.cpp: test suite runner for multiplication on classic floats // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -11,7 +11,7 @@ //#define BLOCKTRIPLE_TRACE_MUL #include #include -#include +#include #include void ReportIeee754NotANumberArithmetic() @@ -181,87 +181,83 @@ try { #endif #if REGRESSION_LEVEL_2 -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<9, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 1,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<9, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 2,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<9, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 3,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<9, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 4,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<9, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 2,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<9, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 3,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<9, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 4,uint8_t,f,f,f>", "multiplication"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<9, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 5,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<9, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 6,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<9, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 7,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<9, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 6,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<9, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 7,uint8_t,f,f,f>", "multiplication"); -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<10, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 1,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<10, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 2,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<10, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 3,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<10, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 4,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<10, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 2,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<10, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 3,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<10, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 4,uint8_t,f,f,f>", "multiplication"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<10, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 5,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<10, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 6,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<10, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 7,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<10, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 8,uint8_t,f,f,f>", "multiplication"); - -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 1,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 2,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 3,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 4,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<10, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 6,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<10, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 7,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<10, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 8,uint8_t,f,f,f>", "multiplication"); + +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 2,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 3,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 4,uint8_t,f,f,f>", "multiplication"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 5,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 6,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 7,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 8,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 9,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 6,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 7,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 8,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<11, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 9,uint8_t,f,f,f>", "multiplication"); #endif #if REGRESSION_LEVEL_3 -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 1,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 2,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 3,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 4,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 5,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 2,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 3,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 4,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 5,uint8_t,f,f,f>", "multiplication"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 6,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 7,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 8,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 9,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12,10,uint8_t,f,f,f>", "multiplication"); - - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 3,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 4,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 5,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 6,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 7,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 8,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 9,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<12,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12,10,uint8_t,f,f,f>", "multiplication"); + +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 3,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 4,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 5,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 6,uint8_t,f,f,f>", "multiplication"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 7,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 8,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 9,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,10,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,11,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 8,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 9,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,10,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<13, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,11,uint8_t,f,f,f>", "multiplication"); #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 3,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 4,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 5,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 3,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 4,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 5,uint8_t,f,f,f>", "multiplication"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 6,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 7,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 8,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 9,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,10,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,11,uint8_t,f,f,f>", "multiplication"); - - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 3,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 4,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 5,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 7,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 8,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 9,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,10,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<14, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,11,uint8_t,f,f,f>", "multiplication"); + +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 3,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 4,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 5,uint8_t,f,f,f>", "multiplication"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 6,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 7,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 8,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 9,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15,10,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15,11,uint8_t,f,f,f>", "multiplication"); - - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 3,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 4,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 5,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 6,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 7,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 7,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 8,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 9,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15,10,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<15, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15,11,uint8_t,f,f,f>", "multiplication"); + +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 3,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 4,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 5,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 6,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 7,uint8_t,f,f,f>", "multiplication"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 8,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 9,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,10,uint8_t,f,f,f>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,11,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 9,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,10,uint8_t,f,f,f>", "multiplication"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatMultiplication< cfloat<16, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,11,uint8_t,f,f,f>", "multiplication"); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/cfloat/arithmetic/nonsaturating/normal/sqrt.cpp b/static/cfloat/arithmetic/nonsaturating/normal/sqrt.cpp index e1fbe455c..2c08cb53a 100644 --- a/static/cfloat/arithmetic/nonsaturating/normal/sqrt.cpp +++ b/static/cfloat/arithmetic/nonsaturating/normal/sqrt.cpp @@ -10,7 +10,7 @@ // #define CFLOAT_NATIVE_SQRT 1 #include #include -#include +#include #include // generate specific test case that you can trace with the trace conditions in posit.hpp diff --git a/static/cfloat/arithmetic/nonsaturating/normal/subtraction.cpp b/static/cfloat/arithmetic/nonsaturating/normal/subtraction.cpp index 3b4bb8426..d01aac19d 100644 --- a/static/cfloat/arithmetic/nonsaturating/normal/subtraction.cpp +++ b/static/cfloat/arithmetic/nonsaturating/normal/subtraction.cpp @@ -1,6 +1,6 @@ // subtraction.cpp: test suite runner for subtraction on classic floats // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -9,7 +9,7 @@ //#define BLOCKTRIPLE_TRACE_ADD #include #include -#include +#include #include /* @@ -162,87 +162,83 @@ try { #endif #if REGRESSION_LEVEL_2 -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<9, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 1,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<9, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 2,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<9, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 3,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<9, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 4,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<9, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 2,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<9, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 3,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<9, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 4,uint8_t,f,f,f>", "subtraction"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<9, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 5,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<9, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 6,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<9, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 7,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<9, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 6,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<9, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat< 9, 7,uint8_t,f,f,f>", "subtraction"); -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<10, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 1,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<10, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 2,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<10, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 3,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<10, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 4,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<10, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 2,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<10, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 3,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<10, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 4,uint8_t,f,f,f>", "subtraction"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<10, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 5,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<10, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 6,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<10, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 7,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<10, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 8,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<10, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 6,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<10, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 7,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<10, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<10, 8,uint8_t,f,f,f>", "subtraction"); -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 1,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 2,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 3,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 4,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 2,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 3,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 4,uint8_t,f,f,f>", "subtraction"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 5,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 6,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 7,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 8,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 9,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 6,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 7,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 8,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<11, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<11, 9,uint8_t,f,f,f>", "subtraction"); #endif #if REGRESSION_LEVEL_3 -// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 1, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 1,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 2,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 3,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 4,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 5,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 2, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 2,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 3,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 4,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 5,uint8_t,f,f,f>", "subtraction"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 6,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 7,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 8,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 9,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12,10,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 7,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 8,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12, 9,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<12,10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<12,10,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 3,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 3,uint8_t,f,f,f>", "subtraction"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 4,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 5,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 6,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 7,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 8,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 9,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,10,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,11,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 5,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 6,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 7,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 8,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13, 9,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,10,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<13, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<13,11,uint8_t,f,f,f>", "subtraction"); #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 3,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 4,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 3,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 4,uint8_t,f,f,f>", "subtraction"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 5,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 6,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 7,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 8,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 9,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,10,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,11,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 6,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 7,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 8,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14, 9,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,10,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<14, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<14,11,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 3,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 4,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 5,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 6,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 7,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 8,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 9,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 3,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 4,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 5,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 6,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 7,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 8,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15, 9,uint8_t,f,f,f>", "subtraction"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15,10,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15,11,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<15, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<15,11,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 3,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 4,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 3, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 3,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 4, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 4,uint8_t,f,f,f>", "subtraction"); nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 5,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 6,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 7,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 8,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 9,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,10,uint8_t,f,f,f>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,11,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 6, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 6,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 7, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 7,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 8,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 9, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16, 9,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 10, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,10,uint8_t,f,f,f>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(VerifyCfloatSubtraction< cfloat<16, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating> >(reportTestCases), "cfloat<16,11,uint8_t,f,f,f>", "subtraction"); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/cfloat/arithmetic/nonsaturating/subnormal/sqrt.cpp b/static/cfloat/arithmetic/nonsaturating/subnormal/sqrt.cpp index df893337e..cb2fb6c59 100644 --- a/static/cfloat/arithmetic/nonsaturating/subnormal/sqrt.cpp +++ b/static/cfloat/arithmetic/nonsaturating/subnormal/sqrt.cpp @@ -10,7 +10,7 @@ // #define CFLOAT_NATIVE_SQRT 1 #include #include -#include +#include #include // generate specific test case that you can trace with the trace conditions in posit.hpp diff --git a/static/cfloat/arithmetic/nonsaturating/subsuper/addition.cpp b/static/cfloat/arithmetic/nonsaturating/subsuper/addition.cpp index 262c4bdbd..eae0b463e 100644 --- a/static/cfloat/arithmetic/nonsaturating/subsuper/addition.cpp +++ b/static/cfloat/arithmetic/nonsaturating/subsuper/addition.cpp @@ -1,6 +1,6 @@ // addition.cpp: test suite runner for addition on classic floats // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -11,7 +11,7 @@ //#define BLOCKTRIPLE_TRACE_ADD #include #include -#include +#include #include // Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override diff --git a/static/cfloat/arithmetic/nonsaturating/subsuper/division.cpp b/static/cfloat/arithmetic/nonsaturating/subsuper/division.cpp index 4cf3121e1..6e9a5495c 100644 --- a/static/cfloat/arithmetic/nonsaturating/subsuper/division.cpp +++ b/static/cfloat/arithmetic/nonsaturating/subsuper/division.cpp @@ -1,6 +1,6 @@ // division.cpp: test suite runner for division on classic floats // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -11,7 +11,7 @@ //#define BLOCKTRIPLE_TRACE_DIV #include #include -#include +#include #include /* diff --git a/static/cfloat/arithmetic/nonsaturating/subsuper/multiplication.cpp b/static/cfloat/arithmetic/nonsaturating/subsuper/multiplication.cpp index de4a346d3..ec3e76346 100644 --- a/static/cfloat/arithmetic/nonsaturating/subsuper/multiplication.cpp +++ b/static/cfloat/arithmetic/nonsaturating/subsuper/multiplication.cpp @@ -1,6 +1,6 @@ // multiplication.cpp: test suite runner for multiplication on classic floats // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -12,7 +12,7 @@ //#define TRACE_CONVERSION 1 #include #include -#include +#include #include // Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override diff --git a/static/cfloat/arithmetic/nonsaturating/subsuper/sqrt.cpp b/static/cfloat/arithmetic/nonsaturating/subsuper/sqrt.cpp index 3da9c966a..e642f39f8 100644 --- a/static/cfloat/arithmetic/nonsaturating/subsuper/sqrt.cpp +++ b/static/cfloat/arithmetic/nonsaturating/subsuper/sqrt.cpp @@ -10,7 +10,7 @@ // #define CFLOAT_NATIVE_SQRT 1 #include #include -#include +#include #include // generate specific test case that you can trace with the trace conditions in posit.hpp diff --git a/static/cfloat/arithmetic/nonsaturating/supernormal/sqrt.cpp b/static/cfloat/arithmetic/nonsaturating/supernormal/sqrt.cpp index 71a2c8085..c4cfb3003 100644 --- a/static/cfloat/arithmetic/nonsaturating/supernormal/sqrt.cpp +++ b/static/cfloat/arithmetic/nonsaturating/supernormal/sqrt.cpp @@ -10,7 +10,7 @@ // #define CFLOAT_NATIVE_SQRT 1 #include #include -#include +#include #include // generate specific test case that you can trace with the trace conditions in posit.hpp diff --git a/static/cfloat/arithmetic/random_arithmetic.cpp b/static/cfloat/arithmetic/random_arithmetic.cpp index 089f9b905..4c42cba56 100644 --- a/static/cfloat/arithmetic/random_arithmetic.cpp +++ b/static/cfloat/arithmetic/random_arithmetic.cpp @@ -1,6 +1,6 @@ // random_arithmetic.cpp: test suite runner for arithmetic operators for classic floats using randoms // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -9,7 +9,7 @@ // use default number system configuration #include #include -#include +#include template int Randoms(bool reportTestCases, const std::string& test_tag, size_t nrTests) diff --git a/static/cfloat/arithmetic/saturating/normal/division.cpp b/static/cfloat/arithmetic/saturating/normal/division.cpp index 44a442303..9735e6032 100644 --- a/static/cfloat/arithmetic/saturating/normal/division.cpp +++ b/static/cfloat/arithmetic/saturating/normal/division.cpp @@ -1,6 +1,6 @@ // division.cpp: test suite runner for division on classic floats // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -11,7 +11,7 @@ //#define BLOCKTRIPLE_TRACE_DIV #include #include -#include +#include #include void ReportIeee754NotANumberArithmetic() diff --git a/static/cfloat/arithmetic/saturating/normal/multiplication.cpp b/static/cfloat/arithmetic/saturating/normal/multiplication.cpp index 308f3ea96..44f91c76c 100644 --- a/static/cfloat/arithmetic/saturating/normal/multiplication.cpp +++ b/static/cfloat/arithmetic/saturating/normal/multiplication.cpp @@ -1,6 +1,6 @@ // multiplication.cpp: test suite runner for multiplication on classic floats // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -11,7 +11,7 @@ //#define BLOCKTRIPLE_TRACE_MUL #include #include -#include +#include #include void ReportIeee754NotANumberArithmetic() diff --git a/static/cfloat/arithmetic/saturating/normal/subtraction.cpp b/static/cfloat/arithmetic/saturating/normal/subtraction.cpp index 3b4bb8426..e1ebb4e1c 100644 --- a/static/cfloat/arithmetic/saturating/normal/subtraction.cpp +++ b/static/cfloat/arithmetic/saturating/normal/subtraction.cpp @@ -1,6 +1,6 @@ // subtraction.cpp: test suite runner for subtraction on classic floats // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -9,7 +9,7 @@ //#define BLOCKTRIPLE_TRACE_ADD #include #include -#include +#include #include /* diff --git a/static/cfloat/arithmetic/saturating/subsuper/division.cpp b/static/cfloat/arithmetic/saturating/subsuper/division.cpp index 4cf3121e1..6e9a5495c 100644 --- a/static/cfloat/arithmetic/saturating/subsuper/division.cpp +++ b/static/cfloat/arithmetic/saturating/subsuper/division.cpp @@ -1,6 +1,6 @@ // division.cpp: test suite runner for division on classic floats // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -11,7 +11,7 @@ //#define BLOCKTRIPLE_TRACE_DIV #include #include -#include +#include #include /* diff --git a/static/cfloat/arithmetic/sqrt_algorithm_reference.cpp b/static/cfloat/arithmetic/sqrt_algorithm_reference.cpp index fcd7d9448..50983322e 100644 --- a/static/cfloat/arithmetic/sqrt_algorithm_reference.cpp +++ b/static/cfloat/arithmetic/sqrt_algorithm_reference.cpp @@ -1,6 +1,6 @@ // sqrt_algorithm_reference.cpp: test suite runner for native floating-point square root algorithm // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -10,7 +10,7 @@ // #define CFLOAT_NATIVE_SQRT 1 #include #include -#include +#include #include template diff --git a/static/cfloat/conversion/nonsaturating/normal/from_blocktriple.cpp b/static/cfloat/conversion/nonsaturating/normal/from_blocktriple.cpp index c664e6f72..4328b4c9b 100644 --- a/static/cfloat/conversion/nonsaturating/normal/from_blocktriple.cpp +++ b/static/cfloat/conversion/nonsaturating/normal/from_blocktriple.cpp @@ -1,6 +1,6 @@ // from_blocktriple.cpp: test suite runner for conversion tests between blocktriple and cfloats // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -15,7 +15,7 @@ #define TRACE_CONVERSION 0 #include #include -#include +#include #include #include diff --git a/static/cfloat/conversion/saturating/normal/from_blocktriple.cpp b/static/cfloat/conversion/saturating/normal/from_blocktriple.cpp index 3211d100b..a0651e3c9 100644 --- a/static/cfloat/conversion/saturating/normal/from_blocktriple.cpp +++ b/static/cfloat/conversion/saturating/normal/from_blocktriple.cpp @@ -1,6 +1,6 @@ // from_blocktriple.cpp: test suite runner for conversion tests between blocktriple and cfloats // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -15,7 +15,7 @@ #define TRACE_CONVERSION 0 #include #include -#include +#include #include #include diff --git a/static/cfloat/math/classify.cpp b/static/cfloat/math/classify.cpp index 0b3727e60..789ba4e9d 100644 --- a/static/cfloat/math/classify.cpp +++ b/static/cfloat/math/classify.cpp @@ -1,12 +1,12 @@ // classify.cpp: test suite runner for classification functions specialized for classic floats // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include #include #include -#include +#include bool isdenorm(float f) { return (std::fpclassify(f) == FP_SUBNORMAL); diff --git a/static/cfloat/math/exponent.cpp b/static/cfloat/math/exponent.cpp index 8b7ef0e8d..657eb90a9 100644 --- a/static/cfloat/math/exponent.cpp +++ b/static/cfloat/math/exponent.cpp @@ -1,6 +1,6 @@ // exponent.cpp: test suite runner for exponent (exp, exp2, exp10) functions // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -11,7 +11,7 @@ // use default number system library configuration #include -#include +#include // Background: http://numbers.computation.free.fr/Constants/E/e.html // diff --git a/static/cfloat/math/fractional.cpp b/static/cfloat/math/fractional.cpp index bc9e1bbed..590667eab 100644 --- a/static/cfloat/math/fractional.cpp +++ b/static/cfloat/math/fractional.cpp @@ -1,12 +1,12 @@ // fractional.cpp: test suite runner for mod/frac/reminder functions specialized for classic floats // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // #define TRACE_CONVERSION 1 #include -#include +#include namespace sw { namespace universal { diff --git a/static/cfloat/math/hyperbolic.cpp b/static/cfloat/math/hyperbolic.cpp index c24f7c693..66291351b 100644 --- a/static/cfloat/math/hyperbolic.cpp +++ b/static/cfloat/math/hyperbolic.cpp @@ -1,12 +1,12 @@ // hyperbolic.cpp: test suite runner for hyperbolic functions (sinh/cosh/tanh/atanh/acosh/asinh) // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // use default library configuration #include -#include +#include // generate specific test case that you can trace with the trace conditions in cfloat.h // for most bugs they are traceable with _trace_conversion and _trace_add diff --git a/static/cfloat/math/hypotenuse.cpp b/static/cfloat/math/hypotenuse.cpp index 67ca53f5d..530e47dda 100644 --- a/static/cfloat/math/hypotenuse.cpp +++ b/static/cfloat/math/hypotenuse.cpp @@ -1,11 +1,11 @@ // hypotenuse.cpp: test suite runner for the hypotenuse functions (hypot, hypotf, hypotl) // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include #include -#include +#include // generate specific test case that you can trace with the trace conditions in cfloat.hpp // for most bugs they are traceable with _trace_conversion and _trace_add diff --git a/static/cfloat/math/logarithm.cpp b/static/cfloat/math/logarithm.cpp index e205df77f..128de5f73 100644 --- a/static/cfloat/math/logarithm.cpp +++ b/static/cfloat/math/logarithm.cpp @@ -1,12 +1,12 @@ // logarithm.cpp: test suite runner for the logarithm functions (log2, log10, ln) // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // use default library configuration #include -#include +#include // generate specific test case that you can trace with the trace conditions in cfloat.hpp // for most bugs they are traceable with _trace_conversion and _trace_add diff --git a/static/cfloat/math/pow.cpp b/static/cfloat/math/pow.cpp index c47ae168a..a6302c28e 100644 --- a/static/cfloat/math/pow.cpp +++ b/static/cfloat/math/pow.cpp @@ -1,11 +1,11 @@ // pow.cpp: test suite runner for pow function // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include #include -#include +#include // generate specific test case that you can trace with the trace conditions in cfloat.h // for most bugs they are traceable with _trace_conversion and _trace_add diff --git a/static/cfloat/math/trigonometry.cpp b/static/cfloat/math/trigonometry.cpp index 3cd176e45..36329ddf0 100644 --- a/static/cfloat/math/trigonometry.cpp +++ b/static/cfloat/math/trigonometry.cpp @@ -1,12 +1,12 @@ // trigonometry.cpp: test suite runner for trigonometric functions (sin/cos/tan/atan/acos/asin) // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // use default library configuration #include -#include +#include /* Writes result sine result sin(πa) to the location pointed to by sp diff --git a/static/cfloat/math/truncate.cpp b/static/cfloat/math/truncate.cpp index 33f66c32a..008102f54 100644 --- a/static/cfloat/math/truncate.cpp +++ b/static/cfloat/math/truncate.cpp @@ -1,12 +1,12 @@ // truncate.cpp: test suite runner for truncation functions trunc, round, floor, and ceil // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // use default number system library configuration #include -#include +#include template int VerifyFloor(bool reportTestCases) { diff --git a/static/dbns/arithmetic/division.cpp b/static/dbns/arithmetic/division.cpp index bcde30558..0b482c4ca 100644 --- a/static/dbns/arithmetic/division.cpp +++ b/static/dbns/arithmetic/division.cpp @@ -240,9 +240,9 @@ try { using DBNS9_4_sat_uint16 = dbns<9, 4, std::uint16_t>; using DBNS10_4_sat = dbns<10, 4, std::uint8_t>; - nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "dbns< 9,4,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "dbns< 9,4,uint16_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "dbns<10,4,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(local::VerifyDivision(reportTestCases), "dbns< 9,4,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(local::VerifyDivision(reportTestCases), "dbns< 9,4,uint16_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(local::VerifyDivision(reportTestCases), "dbns<10,4,uint8_t>", test_tag); #endif diff --git a/static/dbns/arithmetic/multiplication.cpp b/static/dbns/arithmetic/multiplication.cpp index 842b2d6f0..331092bf9 100644 --- a/static/dbns/arithmetic/multiplication.cpp +++ b/static/dbns/arithmetic/multiplication.cpp @@ -309,11 +309,11 @@ try { #endif #if REGRESSION_LEVEL_2 - using DBNS10_0_sat = dbns<10, 0, std::uint8_t>; + using DBNS10_2_sat = dbns<10, 2, std::uint8_t>; using DBNS10_4_sat = dbns<10, 4, std::uint8_t>; using DBNS10_8_sat = dbns<10, 8, std::uint8_t>; - nrOfFailedTestCases += ReportTestResult(local::VerifyMultiplication(reportTestCases), "dbns<10,0, uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(local::VerifyMultiplication(reportTestCases), "dbns<10,2, uint8_t>", test_tag); nrOfFailedTestCases += ReportTestResult(local::VerifyMultiplication(reportTestCases), "dbns<10,4, uint8_t>", test_tag); nrOfFailedTestCases += ReportTestResult(local::VerifyMultiplication(reportTestCases), "dbns<10,8, uint8_t>", test_tag); #endif diff --git a/static/fixpnt/binary/math/exponent.cpp b/static/fixpnt/binary/math/exponent.cpp index ead673b54..d2b3570ba 100644 --- a/static/fixpnt/binary/math/exponent.cpp +++ b/static/fixpnt/binary/math/exponent.cpp @@ -1,13 +1,13 @@ // exponent.cpp: test suite runner for exponent (exp, exp2, exp10) functions // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // use default number system library configuration #include #include -#include +#include // Background: http://numbers.computation.free.fr/Constants/E/e.html // diff --git a/static/fixpnt/binary/math/hyperbolic.cpp b/static/fixpnt/binary/math/hyperbolic.cpp index 3473eac09..85c495e9b 100644 --- a/static/fixpnt/binary/math/hyperbolic.cpp +++ b/static/fixpnt/binary/math/hyperbolic.cpp @@ -1,12 +1,12 @@ // hyperbolic.cpp: test suite runner for hyperbolic functions (sinh/cosh/tanh/atanh/acosh/asinh) // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // use default library configuration #include -#include +#include template void GenerateTestCaseSinh(Ty v) { diff --git a/static/fixpnt/binary/math/logarithm.cpp b/static/fixpnt/binary/math/logarithm.cpp index 73dcfb0f7..dbb278f14 100644 --- a/static/fixpnt/binary/math/logarithm.cpp +++ b/static/fixpnt/binary/math/logarithm.cpp @@ -1,12 +1,12 @@ // logarithm.cpp: test suite runner for the logarithm functions (log2, log10, ln) // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // use default library configuration #include -#include +#include // generate specific test case template diff --git a/static/fixpnt/binary/math/pow.cpp b/static/fixpnt/binary/math/pow.cpp index acf85d7b9..5a9923eeb 100644 --- a/static/fixpnt/binary/math/pow.cpp +++ b/static/fixpnt/binary/math/pow.cpp @@ -1,12 +1,12 @@ // pow.cpp: test suite runner for pow function // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // use default library configuration #include -#include +#include // Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 0 diff --git a/static/fixpnt/binary/math/trigonometry.cpp b/static/fixpnt/binary/math/trigonometry.cpp index 8c8348cd8..f0c2c33bb 100644 --- a/static/fixpnt/binary/math/trigonometry.cpp +++ b/static/fixpnt/binary/math/trigonometry.cpp @@ -1,12 +1,12 @@ // trigonometry.cpp: test suite runner for trigonometric functions (sin/cos/tan/atan/acos/asin) // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // use default library configuration #include -#include +#include /* Writes result sine result sin(πa) to the location pointed to by sp diff --git a/static/fixpnt/binary/math/truncate.cpp b/static/fixpnt/binary/math/truncate.cpp index 5110bb53e..540011fba 100644 --- a/static/fixpnt/binary/math/truncate.cpp +++ b/static/fixpnt/binary/math/truncate.cpp @@ -1,12 +1,12 @@ // truncate.cpp: test suite runner for truncation functions trunc, round, floor, and ceil // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // use default number system library configuration #include -#include +#include template int VerifyFloor(bool reportTestCases) { diff --git a/static/integer/binary/arithmetic/addition.cpp b/static/integer/binary/arithmetic/addition.cpp index 145470e07..575186368 100644 --- a/static/integer/binary/arithmetic/addition.cpp +++ b/static/integer/binary/arithmetic/addition.cpp @@ -1,6 +1,6 @@ // addition.cpp : test runner for addition operator on fixed-size abitrary precision integers // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include diff --git a/static/integer/binary/logic/shift_right.cpp b/static/integer/binary/logic/shift_right.cpp index 8a86c7da1..3093386dc 100644 --- a/static/integer/binary/logic/shift_right.cpp +++ b/static/integer/binary/logic/shift_right.cpp @@ -128,8 +128,21 @@ try { #if REGRESSION_LEVEL_4 // verification suite does not support integers and shifts bigger than 64 - nrOfFailedTestCases += ReportTestResult(VerifyArithmeticRightShift< 71, uint8_t>(reportTestCases), "integer< 71,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyArithmeticRightShift<123, uint8_t>(reportTestCases), "integer<123,uint8_t>", test_tag); + //nrOfFailedTestCases += ReportTestResult(VerifyArithmeticRightShift< 71, uint8_t>(reportTestCases), "integer< 71,uint8_t>", test_tag); + //nrOfFailedTestCases += ReportTestResult(VerifyArithmeticRightShift<123, uint8_t>(reportTestCases), "integer<123,uint8_t>", test_tag); + integer<71, uint8_t, IntegerNumberType::IntegerNumber> a{ -1 }; + a >>= 7; + if (a != -1) { + std::cerr << "integer<71> arithmetic right shift failed: " << to_hex(a) << " : " << a << " != -1\n"; + ++nrOfFailedTestCases; + } + + // arithmetic right shift of a native int32_t as reference + int32_t b{ -1 }; + std::cout << to_hex(b, true) << " : " << b << '\n'; + b >>= 7; + std::cout << to_hex(b, true) << " : " << b << '\n'; + #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/integer/decimal/CMakeLists.txt b/static/integer/decimal/CMakeLists.txt index 776a0c41b..663ae26a2 100644 --- a/static/integer/decimal/CMakeLists.txt +++ b/static/integer/decimal/CMakeLists.txt @@ -5,9 +5,9 @@ file(GLOB ARITHMETIC_SRC "arithmetic/*.cpp") file(GLOB MATH_SRC "math/*.cpp") file(GLOB PERFORMANCE_SRC "performance/*.cpp") -compile_all("true" "decimal" "Number Systems/static/integer/decimal/decimal/api" "${API_SRC}") -compile_all("true" "decimal" "Number Systems/static/integer/decimal/decimal/conversion" "${CONVERSION_SRC}") -compile_all("true" "decimal" "Number Systems/static/integer/decimal/decimal/logic" "${LOGIC_SRC}") -compile_all("true" "decimal" "Number Systems/static/integer/decimal/decimal/arithmetic" "${ARITHMETIC_SRC}") -compile_all("true" "decimal" "Number Systems/static/integer/decimal/decimal/math" "${MATH_SRC}") -compile_all("true" "decimal" "Number Systems/static/integer/decimal/decimal/performance" "${PERFORMANCE_SRC}") +compile_all("true" "dint" "Number Systems/static/integer/decimal/integer/api" "${API_SRC}") +compile_all("true" "dint" "Number Systems/static/integer/decimal/integer/conversion" "${CONVERSION_SRC}") +compile_all("true" "dint" "Number Systems/static/integer/decimal/integer/logic" "${LOGIC_SRC}") +compile_all("true" "dint" "Number Systems/static/integer/decimal/integer/arithmetic" "${ARITHMETIC_SRC}") +compile_all("true" "dint" "Number Systems/static/integer/decimal/integer/math" "${MATH_SRC}") +compile_all("true" "dint" "Number Systems/static/integer/decimal/integer/performance" "${PERFORMANCE_SRC}") diff --git a/static/lns/arithmetic/multiplication.cpp b/static/lns/arithmetic/multiplication.cpp index f6b1c6155..a6910bdd8 100644 --- a/static/lns/arithmetic/multiplication.cpp +++ b/static/lns/arithmetic/multiplication.cpp @@ -53,7 +53,7 @@ namespace sw { // std::cout << "cref : " << std::setw(68) << to_binary(cref) << " : " << cref << '\n'; } else { - if (reportTestCases) ReportBinaryArithmeticSuccess("PASS", "*", a, b, c, ref); + //if (reportTestCases) ReportBinaryArithmeticSuccess("PASS", "*", a, b, c, ref); } if (nrOfFailedTestCases > 25) return nrOfFailedTestCases; } @@ -216,7 +216,7 @@ try { using LNS9_7_sat = lns<9, 7, std::uint8_t>; using LNS9_8_sat = lns<9, 8, std::uint8_t>; - nrOfFailedTestCases += ReportTestResult(local::VerifyMultiplication(reportTestCases), "lns<4,0, uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(local::VerifyMultiplication(true), "lns<4,0, uint8_t>", test_tag); nrOfFailedTestCases += ReportTestResult(local::VerifyMultiplication(reportTestCases), "lns<4,1, uint8_t>", test_tag); nrOfFailedTestCases += ReportTestResult(local::VerifyMultiplication(reportTestCases), "lns<4,2, uint8_t>", test_tag); nrOfFailedTestCases += ReportTestResult(local::VerifyMultiplication(reportTestCases), "lns<4,3, uint8_t>", test_tag); diff --git a/static/lns/math/classify.cpp b/static/lns/math/classify.cpp index 94605596d..623f2875e 100644 --- a/static/lns/math/classify.cpp +++ b/static/lns/math/classify.cpp @@ -1,12 +1,12 @@ // classify.cpp: test suite runner for classification functions specialized for logarithmic floats // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include #include #include -#include +#include bool isdenorm(float f) { return (std::fpclassify(f) == FP_SUBNORMAL); diff --git a/static/lns/math/exponent.cpp b/static/lns/math/exponent.cpp index 1a315ed78..ff4070ba5 100644 --- a/static/lns/math/exponent.cpp +++ b/static/lns/math/exponent.cpp @@ -1,12 +1,12 @@ // exponent.cpp: test suite runner for exponent (exp, exp2, exp10) functions // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include #include -#include -#include +#include +#include // Background: http://numbers.computation.free.fr/Constants/E/e.html // diff --git a/static/lns/math/fractional.cpp b/static/lns/math/fractional.cpp index fb2503965..acf1a2408 100644 --- a/static/lns/math/fractional.cpp +++ b/static/lns/math/fractional.cpp @@ -1,11 +1,11 @@ // fractional.cpp: test suite runner for mod/frac/reminder functions specialized for logarithmic floats // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include #include -#include +#include namespace sw { namespace universal { diff --git a/static/lns/math/hyperbolic.cpp b/static/lns/math/hyperbolic.cpp index 43878e27f..e2ef29fd2 100644 --- a/static/lns/math/hyperbolic.cpp +++ b/static/lns/math/hyperbolic.cpp @@ -1,12 +1,12 @@ // hyperbolic.cpp: test suite runner for hyperbolic functions (sinh/cosh/tanh/atanh/acosh/asinh) using logarithmic floats // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // use default library configuration #include -#include +#include // generate specific test case that you can trace with the trace conditions in lns.hpp // for most bugs they are traceable with _trace_conversion and _trace_add diff --git a/static/lns/math/hypotenuse.cpp b/static/lns/math/hypotenuse.cpp index 14f0905bd..02fe648b4 100644 --- a/static/lns/math/hypotenuse.cpp +++ b/static/lns/math/hypotenuse.cpp @@ -1,12 +1,12 @@ // hypotenuse.cpp: test suite runner for the hypotenuse functions (hypot, hypotf, hypotl) // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include #include -#include -#include +#include +#include // generate specific test case that you can trace with the trace conditions in lns.hpp // for most bugs they are traceable with _trace_conversion and _trace_add @@ -86,7 +86,7 @@ try { #if REGRESSION_LEVEL_4 // nbits=64 requires long double compiler support - nrOfFailedTestCases += ReportTestResult(VerifyUnaryOperatorThroughRandoms< lns<64, 2, std::uint32_t> >(reportTestCases, RandomsOp::OPCODE_HYPOT, 1000, 0.0), "lns<64,2>", "hypot"); + nrOfFailedTestCases += ReportTestResult(VerifyUnaryOperatorThroughRandoms< lns<64, 2, std::uint32_t> >(reportTestCases, RandomsOp::OPCODE_HYPOT, 1000), "lns<64,2>", "hypot"); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/lns/math/logarithm.cpp b/static/lns/math/logarithm.cpp index 10eb995ff..71fc0db17 100644 --- a/static/lns/math/logarithm.cpp +++ b/static/lns/math/logarithm.cpp @@ -1,11 +1,11 @@ // logarithm.cpp: test suite runner for the logarithm functions (log2, log10, ln) // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include #include -#include +#include // generate specific test case that you can trace with the trace conditions in lns.hpp // for most bugs they are traceable with _trace_conversion and _trace_add diff --git a/static/lns/math/pow.cpp b/static/lns/math/pow.cpp index 7fff50feb..1fdb3f802 100644 --- a/static/lns/math/pow.cpp +++ b/static/lns/math/pow.cpp @@ -1,11 +1,11 @@ // pow.cpp: test suite runner for power function // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include #include -#include +#include // generate specific test case that you can trace with the trace conditions in lns.hpp // for most bugs they are traceable with _trace_conversion and _trace_add diff --git a/static/lns/math/trigonometry.cpp b/static/lns/math/trigonometry.cpp index a50b3f5ab..27e2746bc 100644 --- a/static/lns/math/trigonometry.cpp +++ b/static/lns/math/trigonometry.cpp @@ -1,12 +1,12 @@ // trigonometry.cpp: test suite runner for trigonometric functions (sin/cos/tan/atan/acos/asin) // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // use default library configuration #include -#include +#include /* Writes result sine result sin(πa) to the location pointed to by sp diff --git a/static/lns/math/truncate.cpp b/static/lns/math/truncate.cpp index 1ac7edb8f..5bc2cd9a2 100644 --- a/static/lns/math/truncate.cpp +++ b/static/lns/math/truncate.cpp @@ -1,12 +1,12 @@ // truncate.cpp: test suite runner for truncation functions trunc, round, floor, and ceil // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // use default number system library configuration #include -#include +#include namespace sw { namespace universal { diff --git a/static/posit/api/number_traits.cpp b/static/posit/api/number_traits.cpp index 9c9374bd6..e137930fe 100644 --- a/static/posit/api/number_traits.cpp +++ b/static/posit/api/number_traits.cpp @@ -7,7 +7,7 @@ #include #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 #include -#include +#include int main() try { diff --git a/static/posit/api/postfix.cpp b/static/posit/api/postfix.cpp index 4fa530899..9c7f8feed 100644 --- a/static/posit/api/postfix.cpp +++ b/static/posit/api/postfix.cpp @@ -1,23 +1,23 @@ // postfix.cpp test suite runner for postfix operators // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include #include -#include +#include int main() try { using namespace sw::universal; - bool bReportIndividualTestCases = false; + bool reportTestCases = false; int nrOfFailedTestCases = 0; - nrOfFailedTestCases += ReportTestResult(VerifyPostfix<3, 0>(bReportIndividualTestCases), "posit<3,0>", "posit++"); + nrOfFailedTestCases += ReportTestResult(VerifyPostfix>(reportTestCases), "posit<3,0>", "posit++"); - nrOfFailedTestCases += ReportTestResult(VerifyPostfix<4, 0>(bReportIndividualTestCases), "posit<4,0>", "posit++"); - nrOfFailedTestCases += ReportTestResult(VerifyPostfix<4, 1>(bReportIndividualTestCases), "posit<4,1>", "posit++"); + nrOfFailedTestCases += ReportTestResult(VerifyPostfix>(reportTestCases), "posit<4,0>", "posit++"); + nrOfFailedTestCases += ReportTestResult(VerifyPostfix>(reportTestCases), "posit<4,1>", "posit++"); return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); } diff --git a/static/posit/api/prefix.cpp b/static/posit/api/prefix.cpp index 38ebb85e5..ff27b3765 100644 --- a/static/posit/api/prefix.cpp +++ b/static/posit/api/prefix.cpp @@ -1,23 +1,23 @@ // prefix.cpp test suite runner for prefix operators // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include #include -#include +#include int main() try { using namespace sw::universal; - bool bReportIndividualTestCases = false; + bool reportTestCases = false; int nrOfFailedTestCases = 0; - nrOfFailedTestCases += ReportTestResult(VerifyPrefix<3, 0>(bReportIndividualTestCases), "posit<3,0>", "prefix ++posit"); + nrOfFailedTestCases += ReportTestResult(VerifyPrefix>(reportTestCases), "posit<3,0>", "prefix ++posit"); - nrOfFailedTestCases += ReportTestResult(VerifyPrefix<4, 0>(bReportIndividualTestCases), "posit<4,0>", "prefix ++posit"); - nrOfFailedTestCases += ReportTestResult(VerifyPrefix<4, 1>(bReportIndividualTestCases), "posit<4,1>", "prefix ++posit"); + nrOfFailedTestCases += ReportTestResult(VerifyPrefix>(reportTestCases), "posit<4,0>", "prefix ++posit"); + nrOfFailedTestCases += ReportTestResult(VerifyPrefix>(reportTestCases), "posit<4,1>", "prefix ++posit"); return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); } diff --git a/static/posit/arithmetic/addition.cpp b/static/posit/arithmetic/addition.cpp index 6e2516d5c..a2708220e 100644 --- a/static/posit/arithmetic/addition.cpp +++ b/static/posit/arithmetic/addition.cpp @@ -14,9 +14,8 @@ #define ALGORITHM_VERBOSE_OUTPUT #define ALGORITHM_TRACE_ADD #include -#include #include -#include +#include // generate specific test case that you can trace with the trace conditions in posit.h // for most bugs they are traceable with _trace_conversion and _trace_add @@ -71,10 +70,10 @@ try { GenerateTestCase<3, 0>(0.5f, 1.0f); // manual exhaustive test - nrOfFailedTestCases += ReportTestResult(VerifyAddition<3, 0>(true), "posit<3,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<3, 1>(true), "posit<3,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<3, 2>(true), "posit<3,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<3, 3>(true), "posit<3,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<3,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<3,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<3,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<3,3>", "addition"); // nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<16, 1>(tag, true, OPCODE_ADD, 1000), "posit<16,1>", "addition"); // nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(tag, true, OPCODE_ADD, 1000), "posit<64,2>", "addition"); @@ -84,47 +83,47 @@ try { #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyAddition<2, 0>(reportTestCases), "posit< 2,0>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<3, 0>(reportTestCases), "posit< 3,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<3, 1>(reportTestCases), "posit< 3,1>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 0>(reportTestCases), "posit< 4,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 1>(reportTestCases), "posit< 4,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 2>(reportTestCases), "posit< 4,2>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<5, 0>(reportTestCases), "posit< 5,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<5, 1>(reportTestCases), "posit< 5,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<5, 2>(reportTestCases), "posit< 5,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<5, 3>(reportTestCases), "posit< 5,3>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<6, 0>(reportTestCases), "posit< 6,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<6, 1>(reportTestCases), "posit< 6,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<6, 2>(reportTestCases), "posit< 6,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<6, 3>(reportTestCases), "posit< 6,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<6, 4>(reportTestCases), "posit< 6,4>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 0>(reportTestCases), "posit< 7,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 1>(reportTestCases), "posit< 7,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 2>(reportTestCases), "posit< 7,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 3>(reportTestCases), "posit< 7,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 4>(reportTestCases), "posit< 7,4>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 5>(reportTestCases), "posit< 7,5>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 0>(reportTestCases), "posit< 8,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 1>(reportTestCases), "posit< 8,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 2>(reportTestCases), "posit< 8,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 3>(reportTestCases), "posit< 8,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 4>(reportTestCases), "posit< 8,4>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 5>(reportTestCases), "posit< 8,5>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 6>(reportTestCases), "posit< 8,6>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 2,0>", "addition"); + + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 3,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 3,1>", "addition"); + + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 4,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 4,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 4,2>", "addition"); + + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 5,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 5,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 5,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 5,3>", "addition"); + + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 6,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 6,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 6,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 6,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 6,4>", "addition"); + + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 7,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 7,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 7,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 7,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 7,4>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 7,5>", "addition"); + + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,4>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,5>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,6>", "addition"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 0>(reportTestCases), "posit<10,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 1>(reportTestCases), "posit<10,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 2>(reportTestCases), "posit<10,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 3>(reportTestCases), "posit<10,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<10,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<10,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<10,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<10,3>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 2>(reportTestCases, OPCODE_ADD, 1000), "posit<16,1>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<24, 2>(reportTestCases, OPCODE_ADD, 1000), "posit<24,1>", "addition"); @@ -149,9 +148,9 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(reportTestCases, OPCODE_ADD, 1000), "posit<64,4>", "addition"); #ifdef HARDWARE_ACCELERATION - nrOfFailedTestCases += ReportTestResult(VerifyAddition<12, 1>(reportTestCases), "posit<12,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<14, 1>(reportTestCases), "posit<14,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<16, 1>(reportTestCases), "posit<16,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<12,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<14,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<16,1>", "addition"); #endif // HARDWARE_ACCELERATION #endif // REGRESSION_LEVEL_4 diff --git a/static/posit/arithmetic/complex_add.cpp b/static/posit/arithmetic/complex_add.cpp index b92530d5b..53adcea89 100644 --- a/static/posit/arithmetic/complex_add.cpp +++ b/static/posit/arithmetic/complex_add.cpp @@ -14,9 +14,9 @@ //#define ALGORITHM_VERBOSE_OUTPUT #define ALGORITHM_TRACE_ADD #include -#include #include -#include +#include +#include #define FLOAT_TABLE_WIDTH 10 @@ -40,9 +40,11 @@ void ReportBinaryArithmeticError(const std::string& test_case, const std::string } // enumerate all addition cases for a posit configuration -template +template int VerifyComplexAddition(bool reportTestCases) { using namespace sw::universal; + constexpr unsigned nbits = TestType::nbits; + constexpr unsigned es = TestType::es; const unsigned NR_POSITS = (unsigned(1) << nbits); int nrOfFailedTests = 0; posit ar, ai, br, bi; @@ -144,29 +146,29 @@ try { cout << z1 << endl; } - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<2, 0>(reportTestCases), "posit<2,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<2,0>", "addition"); // manual exhaustive test - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<5, 0>(true), "complex>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<5, 1>(true), "complex>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<5, 2>(true), "complex>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<5, 3>(true), "complex>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "complex>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "complex>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "complex>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "complex>", "addition"); -// nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<16, 1>(true, OPCODE_ADD, 1000), "posit<16,1>", "addition"); -// nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<64, 2>(true, OPCODE_ADD, 1000), "posit<64,2>", "addition"); +// nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<16, 1>>(reportTestCases, OPCODE_ADD, 1000), "posit<16,1>", "addition"); +// nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<64, 2>>(reportTestCases, OPCODE_ADD, 1000), "posit<64,2>", "addition"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<2, 0>(reportTestCases), "posit<2,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<2,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<3, 0>(reportTestCases), "posit<3,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<3, 1>(reportTestCases), "posit<3,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<3,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<3,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<4, 0>(reportTestCases), "posit<4,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<4, 1>(reportTestCases), "posit<4,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<4, 2>(reportTestCases), "posit<4,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<4,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<4,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<4,2>", "addition"); #endif #if REGRESSION_LEVEL_2 @@ -174,41 +176,41 @@ try { #if REGRESSION_LEVEL_3 /* TODO - nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<16, 1>(reportTestCases, OPCODE_ADD, 1000), "posit<16,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<24, 1>(reportTestCases, OPCODE_ADD, 1000), "posit<24,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<32, 1>(reportTestCases, OPCODE_ADD, 1000), "posit<32,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<32, 2>(reportTestCases, OPCODE_ADD, 1000), "posit<32,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<16, 1>>(reportTestCases, OPCODE_ADD, 1000), "posit<16,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<24, 1>>(reportTestCases, OPCODE_ADD, 1000), "posit<24,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<32, 1>>(reportTestCases, OPCODE_ADD, 1000), "posit<32,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<32, 2>>(reportTestCases, OPCODE_ADD, 1000), "posit<32,2>", "addition"); */ #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<5, 0>(reportTestCases), "posit<5,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<5, 1>(reportTestCases), "posit<5,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<5, 2>(reportTestCases), "posit<5,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<5, 3>(reportTestCases), "posit<5,3>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<6, 0>(reportTestCases), "posit<6,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<6, 1>(reportTestCases), "posit<6,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<6, 2>(reportTestCases), "posit<6,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<6, 3>(reportTestCases), "posit<6,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<6, 4>(reportTestCases), "posit<6,4>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<7, 0>(reportTestCases), "posit<7,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<7, 1>(reportTestCases), "posit<7,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<7, 2>(reportTestCases), "posit<7,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<7, 3>(reportTestCases), "posit<7,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<7, 4>(reportTestCases), "posit<7,4>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<7, 5>(reportTestCases), "posit<7,5>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<8, 0>(reportTestCases), "posit<8,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<8, 1>(reportTestCases), "posit<8,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<8, 2>(reportTestCases), "posit<8,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<8, 3>(reportTestCases), "posit<8,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<8, 4>(reportTestCases), "posit<8,4>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<8, 5>(reportTestCases), "posit<8,5>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<8, 6>(reportTestCases), "posit<8,6>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<5,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<5,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<5,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<5,3>", "addition"); + + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<6,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<6,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<6,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<6,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<6,4>", "addition"); + + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<7,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<7,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<7,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<7,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<7,4>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<7,5>", "addition"); + + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<8,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<8,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<8,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<8,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<8,4>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<8,5>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<8,6>", "addition"); // nbits=48 also shows failures nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<48, 2>(reportTestCases, OPCODE_ADD, 1000), "posit<48,2>", "addition"); @@ -219,10 +221,10 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(reportTestCases, OPCODE_ADD, 1000), "posit<64,4>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<10, 1>(reportTestCases), "posit<10,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<12, 1>(reportTestCases), "posit<12,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<14, 1>(reportTestCases), "posit<14,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition<16, 1>(reportTestCases), "posit<16,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<10,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<12,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<14,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyComplexAddition>(reportTestCases), "posit<16,1>", "addition"); #endif // REGRESSION_LEVEL_4 ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/posit/arithmetic/decrement.cpp b/static/posit/arithmetic/decrement.cpp index 6d54a4eb2..3bc4f5645 100644 --- a/static/posit/arithmetic/decrement.cpp +++ b/static/posit/arithmetic/decrement.cpp @@ -5,8 +5,8 @@ // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include #include -#include -#include +#include +#include // Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 0 @@ -46,7 +46,7 @@ try { std::cout << s.get() << " " << s << '\n'; }); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement(reportTestCases), positConfig, test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), positConfig, test_tag); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; @@ -56,32 +56,32 @@ try { // Otherwise stated, an enumeration of tests for different posit configurations is a bit superfluous. #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<3, 0>(reportTestCases), "posit<3,0>", test_tag); - - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<4, 0>(reportTestCases), "posit<4,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<4, 1>(reportTestCases), "posit<4,1>", test_tag); - - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<5, 0>(reportTestCases), "posit<5,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<5, 1>(reportTestCases), "posit<5,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<5, 2>(reportTestCases), "posit<5,2>", test_tag); - - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<6, 0>(reportTestCases), "posit<6,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<6, 1>(reportTestCases), "posit<6,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<6, 2>(reportTestCases), "posit<6,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<6, 3>(reportTestCases), "posit<6,3>", test_tag); - - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<7, 0>(reportTestCases), "posit<7,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<7, 1>(reportTestCases), "posit<7,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<7, 2>(reportTestCases), "posit<7,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<7, 3>(reportTestCases), "posit<7,3>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<7, 4>(reportTestCases), "posit<7,4>", test_tag); - - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<8, 0>(reportTestCases), "posit<8,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<8, 1>(reportTestCases), "posit<8,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<8, 2>(reportTestCases), "posit<8,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<8, 3>(reportTestCases), "posit<8,3>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<8, 4>(reportTestCases), "posit<8,4>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<8, 5>(reportTestCases), "posit<8,5>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<3,0>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<4,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<4,1>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<5,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<5,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<5,2>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<6,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<6,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<6,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<6,3>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<7,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<7,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<7,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<7,3>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<7,4>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<8,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<8,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<8,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<8,3>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<8,4>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<8,5>", test_tag); #endif #if REGRESSION_LEVEL_2 @@ -93,34 +93,34 @@ try { #if REGRESSION_LEVEL_4 // AD/DA adapted data path configurations - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<10, 0>(reportTestCases), "posit<10,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<10, 1>(reportTestCases), "posit<10,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<10,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<10,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<12, 0>(reportTestCases), "posit<12,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<12, 1>(reportTestCases), "posit<12,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<12,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<12,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<14, 0>(reportTestCases), "posit<14,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<14, 1>(reportTestCases), "posit<14,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<14,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<14,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<15, 0>(reportTestCases), "posit<15,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<15, 1>(reportTestCases), "posit<15,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<15,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<15,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<16, 0>(reportTestCases), "posit<16,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<16, 1>(reportTestCases), "posit<16,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<16, 2>(reportTestCases), "posit<16,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<16,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<16,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<16,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<18, 0>(reportTestCases), "posit<18,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<18, 1>(reportTestCases), "posit<18,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<18, 2>(reportTestCases), "posit<18,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<18,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<18,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<18,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<20, 1>(reportTestCases), "posit<20,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<20,1>", test_tag); // legit float replacement - //nrOfFailedTestCases += ReportTestResult(VerifyDecrement<24, 1>(reportTestCases), "posit<24,1>", test_tag); - //nrOfFailedTestCases += ReportTestResult(VerifyDecrement<28, 1>(reportTestCases), "posit<28,2>", test_tag); + //nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<24,1>", test_tag); + //nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<28,2>", test_tag); // legit double replacement - //nrOfFailedTestCases += ReportTestResult(VerifyDecrement<32, 2>(reportTestCases), "posit<32,2>", test_tag); + //nrOfFailedTestCases += ReportTestResult(VerifyDecrement>(reportTestCases), "posit<32,2>", test_tag); #endif // REGRESSION_LEVEL_4 ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/posit/arithmetic/division.cpp b/static/posit/arithmetic/division.cpp index c1d04abc0..5e84224f3 100644 --- a/static/posit/arithmetic/division.cpp +++ b/static/posit/arithmetic/division.cpp @@ -14,9 +14,8 @@ //#define ALGORITHM_VERBOSE_OUTPUT #define ALGORITHM_TRACE_DIV #include -#include #include -#include +#include // generate specific test case that you can trace with the trace conditions in posit.h // for most bugs they are traceable with _trace_conversion and _trace_add @@ -206,59 +205,59 @@ try { // Generate the worst fraction pressure for different posit configurations EnumerateToughDivisions(); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<2, 0>(true), "posit<2,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<3, 0>(true), "posit<3,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<3, 1>(true), "posit<3,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<4, 0>(true), "posit<4,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<5, 0>(true), "posit<5,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<8, 0>(true), "posit<8,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<2,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<3,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<3,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<4,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<5,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<8,0>", "division"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyDivision<2, 0>(reportTestCases), "posit< 2,0>", "division"); - - nrOfFailedTestCases += ReportTestResult(VerifyDivision<3, 0>(reportTestCases), "posit< 3,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<3, 1>(reportTestCases), "posit< 3,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<3, 2>(reportTestCases), "posit< 3,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<3, 3>(reportTestCases), "posit< 3,3>", "division"); - - nrOfFailedTestCases += ReportTestResult(VerifyDivision<4, 0>(reportTestCases), "posit< 4,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<4, 1>(reportTestCases), "posit< 4,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<4, 2>(reportTestCases), "posit< 4,2>", "division"); - - nrOfFailedTestCases += ReportTestResult(VerifyDivision<5, 0>(reportTestCases), "posit< 5,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<5, 1>(reportTestCases), "posit< 5,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<5, 2>(reportTestCases), "posit< 5,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<5, 3>(reportTestCases), "posit< 5,3>", "division"); - - nrOfFailedTestCases += ReportTestResult(VerifyDivision<6, 0>(reportTestCases), "posit< 6,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<6, 1>(reportTestCases), "posit< 6,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<6, 2>(reportTestCases), "posit< 6,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<6, 3>(reportTestCases), "posit< 6,3>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<6, 4>(reportTestCases), "posit< 6,4>", "division"); - - nrOfFailedTestCases += ReportTestResult(VerifyDivision<7, 0>(reportTestCases), "posit< 7,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<7, 1>(reportTestCases), "posit< 7,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<7, 2>(reportTestCases), "posit< 7,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<7, 3>(reportTestCases), "posit< 7,3>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<7, 4>(reportTestCases), "posit< 7,4>", "division"); - - nrOfFailedTestCases += ReportTestResult(VerifyDivision<8, 0>(reportTestCases), "posit< 8,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<8, 1>(reportTestCases), "posit< 8,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<8, 2>(reportTestCases), "posit< 8,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<8, 3>(reportTestCases), "posit< 8,3>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<8, 4>(reportTestCases), "posit< 8,4>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<8, 5>(reportTestCases), "posit< 8,5>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 2,0>", "division"); + + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 3,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 3,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 3,2>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 3,3>", "division"); + + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 4,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 4,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 4,2>", "division"); + + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 5,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 5,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 5,2>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 5,3>", "division"); + + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 6,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 6,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 6,2>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 6,3>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 6,4>", "division"); + + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 7,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 7,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 7,2>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 7,3>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 7,4>", "division"); + + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 8,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 8,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 8,2>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 8,3>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 8,4>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit< 8,5>", "division"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifyDivision<10, 0>(reportTestCases), "posit<10,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<10, 1>(reportTestCases), "posit<10,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<10, 2>(reportTestCases), "posit<10,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<10, 3>(reportTestCases), "posit<10,3>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<10,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<10,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<10,2>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<10,3>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 2>(reportTestCases, OPCODE_DIV, 1000), "posit<16,2>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<24, 2>(reportTestCases, OPCODE_DIV, 1000), "posit<24,2>", "division"); @@ -284,9 +283,9 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(reportTestCases, OPCODE_DIV, 1000), "posit<64,4>", "division"); #ifdef HARDWARE_ACCELERATION - nrOfFailedTestCases += ReportTestResult(VerifyDivision<12, 1>(reportTestCases), "posit<12,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<14, 1>(reportTestCases), "posit<14,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<16, 1>(reportTestCases), "posit<16,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<12,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<14,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<16,1>", "division"); #endif // HARDWARE_ACCELERATION #endif // REGRESSION_LEVEL_4 diff --git a/static/posit/arithmetic/fma.cpp b/static/posit/arithmetic/fma.cpp index 6b2f05f32..84efc8056 100644 --- a/static/posit/arithmetic/fma.cpp +++ b/static/posit/arithmetic/fma.cpp @@ -11,8 +11,8 @@ // enable/disable posit arithmetic exceptions #define POSIT_THROW_ARITHMETIC_EXCEPTION 0 #include -#include -#include +#include +#include // generate specific test case that you can trace with the trace conditions in posit.h // for most bugs they are traceable with _trace_conversion and _trace_sub diff --git a/static/posit/arithmetic/increment.cpp b/static/posit/arithmetic/increment.cpp index 49f94aa3a..f99868ee0 100644 --- a/static/posit/arithmetic/increment.cpp +++ b/static/posit/arithmetic/increment.cpp @@ -5,7 +5,7 @@ // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include #include -#include +#include // Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 0 @@ -45,7 +45,7 @@ try { std::cout << s.get() << " " << s << std::endl; }); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement(reportTestCases), positConfig, test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), positConfig, test_tag); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; @@ -55,32 +55,32 @@ try { // Otherwise stated, an enumeration of tests for different posit configurations is a bit superfluous. #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<3, 0>(reportTestCases), "posit<3,0>", test_tag); - - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<4, 0>(reportTestCases), "posit<4,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<4, 1>(reportTestCases), "posit<4,1>", test_tag); - - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<5, 0>(reportTestCases), "posit<5,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<5, 1>(reportTestCases), "posit<5,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<5, 2>(reportTestCases), "posit<5,2>", test_tag); - - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<6, 0>(reportTestCases), "posit<6,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<6, 1>(reportTestCases), "posit<6,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<6, 2>(reportTestCases), "posit<6,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<6, 3>(reportTestCases), "posit<6,3>", test_tag); - - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<7, 0>(reportTestCases), "posit<7,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<7, 1>(reportTestCases), "posit<7,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<7, 2>(reportTestCases), "posit<7,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<7, 3>(reportTestCases), "posit<7,3>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<7, 4>(reportTestCases), "posit<7,4>", test_tag); - - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<8, 0>(reportTestCases), "posit<8,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<8, 1>(reportTestCases), "posit<8,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<8, 2>(reportTestCases), "posit<8,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<8, 3>(reportTestCases), "posit<8,3>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<8, 4>(reportTestCases), "posit<8,4>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<8, 5>(reportTestCases), "posit<8,5>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<3,0>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<4,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<4,1>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<5,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<5,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<5,2>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<6,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<6,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<6,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<6,3>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<7,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<7,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<7,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<7,3>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<7,4>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<8,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<8,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<8,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<8,3>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<8,4>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<8,5>", test_tag); #endif #if REGRESSION_LEVEL_2 @@ -91,34 +91,34 @@ try { #if REGRESSION_LEVEL_4 // AD/DA adapted data path configurations - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<10, 0>(reportTestCases), "posit<10,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<10, 1>(reportTestCases), "posit<10,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<10,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<10,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<12, 0>(reportTestCases), "posit<12,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<12, 1>(reportTestCases), "posit<12,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<12,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<12,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<14, 0>(reportTestCases), "posit<14,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<14, 1>(reportTestCases), "posit<14,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<14,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<14,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<15, 0>(reportTestCases), "posit<15,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<15, 1>(reportTestCases), "posit<15,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<15,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<15,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<16, 0>(reportTestCases), "posit<16,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<16, 1>(reportTestCases), "posit<16,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<16, 2>(reportTestCases), "posit<16,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<16,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<16,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<16,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<18, 0>(reportTestCases), "posit<18,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<18, 1>(reportTestCases), "posit<18,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<18, 2>(reportTestCases), "posit<18,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<18,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<18,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<18,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<20, 1>(reportTestCases), "posit<20,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<20,1>", test_tag); // legit float replacement - //nrOfFailedTestCases += ReportTestResult(VerifyIncrement<24, 1>(reportTestCases), "posit<24,1>", test_tag); - //nrOfFailedTestCases += ReportTestResult(VerifyIncrement<28, 2>(reportTestCases), "posit<28,2>", test_tag); + //nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<24,1>", test_tag); + //nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<28,2>", test_tag); // legit double replacement - //nrOfFailedTestCases += ReportTestResult(VerifyIncrement<32, 2>(reportTestCases), "posit<32,2>", test_tag); + //nrOfFailedTestCases += ReportTestResult(VerifyIncrement>(reportTestCases), "posit<32,2>", test_tag); #endif // REGRESSION_LEVEL_4 ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/posit/arithmetic/literals.cpp b/static/posit/arithmetic/literals.cpp index 85df692c0..2b2337974 100644 --- a/static/posit/arithmetic/literals.cpp +++ b/static/posit/arithmetic/literals.cpp @@ -16,8 +16,8 @@ // forth: enable/disable the ability to use literals in binary logic and arithmetic operators #define POSIT_ENABLE_LITERALS 1 #include -#include -#include +#include +#include // enumerate all addition cases for a posit configuration: is within 10sec till about nbits = 14 diff --git a/static/posit/arithmetic/multiplication.cpp b/static/posit/arithmetic/multiplication.cpp index 6f464c2c0..837dd7931 100644 --- a/static/posit/arithmetic/multiplication.cpp +++ b/static/posit/arithmetic/multiplication.cpp @@ -14,9 +14,8 @@ //#define ALGORITHM_VERBOSE_OUTPUT #define ALGORITHM_TRACE_MUL #include -#include #include -#include +#include // generate specific test case that you can trace with the trace conditions in posit.h // for most bugs they are traceable with _trace_conversion and _trace_mul @@ -154,57 +153,57 @@ try { DifficultRoundingCases(); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<2, 0>(reportTestCases), "posit<2,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 0>(reportTestCases), "posit<3,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 1>(reportTestCases), "posit<3,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 0>(reportTestCases), "posit<4,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit<2,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit<3,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit<3,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit<4,0>", "multiplication"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<2, 0>(reportTestCases), "posit< 2,0>", "multiplication"); - - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 0>(reportTestCases), "posit< 3,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 1>(reportTestCases), "posit< 3,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 2>(reportTestCases), "posit< 3,2>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 3>(reportTestCases), "posit< 3,3>", "multiplication"); - - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 0>(reportTestCases), "posit< 4,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 1>(reportTestCases), "posit< 4,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 2>(reportTestCases), "posit< 4,2>", "multiplication"); - - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<5, 0>(reportTestCases), "posit< 5,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<5, 1>(reportTestCases), "posit< 5,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<5, 2>(reportTestCases), "posit< 5,2>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<5, 3>(reportTestCases), "posit< 5,3>", "multiplication"); - - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<6, 0>(reportTestCases), "posit< 6,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<6, 1>(reportTestCases), "posit< 6,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<6, 2>(reportTestCases), "posit< 6,2>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<6, 3>(reportTestCases), "posit< 6,3>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<6, 4>(reportTestCases), "posit< 6,4>", "multiplication"); - - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<7, 0>(reportTestCases), "posit< 7,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<7, 1>(reportTestCases), "posit< 7,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<7, 2>(reportTestCases), "posit< 7,2>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<7, 3>(reportTestCases), "posit< 7,3>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<7, 4>(reportTestCases), "posit< 7,4>", "multiplication"); - - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 0>(reportTestCases), "posit< 8,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 1>(reportTestCases), "posit< 8,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 2>(reportTestCases), "posit< 8,2>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 3>(reportTestCases), "posit< 8,3>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 4>(reportTestCases), "posit< 8,4>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 5>(reportTestCases), "posit< 8,5>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 2,0>", "multiplication"); + + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 3,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 3,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 3,2>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 3,3>", "multiplication"); + + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 4,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 4,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 4,2>", "multiplication"); + + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 5,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 5,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 5,2>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 5,3>", "multiplication"); + + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 6,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 6,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 6,2>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 6,3>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 6,4>", "multiplication"); + + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 7,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 7,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 7,2>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 7,3>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 7,4>", "multiplication"); + + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 8,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 8,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 8,2>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 8,3>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 8,4>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 8,5>", "multiplication"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 0>(reportTestCases), "posit<10,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 1>(reportTestCases), "posit<10,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 2>(reportTestCases), "posit<10,2>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 3>(reportTestCases), "posit<10,3>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit<10,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit<10,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit<10,2>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit<10,3>", "multiplication"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 2>(reportTestCases, OPCODE_MUL, 1000), "posit<16,2>", "multiplication"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<24, 2>(reportTestCases, OPCODE_MUL, 1000), "posit<24,2>", "multiplication"); @@ -227,9 +226,9 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(reportTestCases, OPCODE_MUL, 1000), "posit<64,4>", "multiplication"); #ifdef HARDWARE_ACCELERATION - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<12, 1>(reportTestCases), "posit<12,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<14, 1>(reportTestCases), "posit<14,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<16, 1>(reportTestCases), "posit<16,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit<12,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit<14,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit<16,1>", "multiplication"); #endif // HARDWARE_ACCELERATION #endif // REGRESSION_LEVEL_4 diff --git a/static/posit/arithmetic/negation.cpp b/static/posit/arithmetic/negation.cpp index 6901ba19a..95b850267 100644 --- a/static/posit/arithmetic/negation.cpp +++ b/static/posit/arithmetic/negation.cpp @@ -14,7 +14,6 @@ //#define ALGORITHM_VERBOSE_OUTPUT #define ALGORITHM_TRACE_NEGATE #include -#include #include // generate specific test case that you can trace with the trace conditions in posit.h @@ -60,45 +59,45 @@ try { GenerateTestCase<5, 0, float>(-0.625f); GenerateTestCase<5, 0, float>(-0.500f); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<5, 0>(true), "posit<5,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation(true), "posit<5,0>", "multiplication"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyNegation<2, 0>(reportTestCases), "posit<2,0>", "negation"); - - nrOfFailedTestCases += ReportTestResult(VerifyNegation<3, 0>(reportTestCases), "posit<3,0>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<3, 1>(reportTestCases), "posit<3,1>", "negation"); - - nrOfFailedTestCases += ReportTestResult(VerifyNegation<4, 0>(reportTestCases), "posit<4,0>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<4, 1>(reportTestCases), "posit<4,1>", "negation"); - - nrOfFailedTestCases += ReportTestResult(VerifyNegation<5, 0>(reportTestCases), "posit<5,0>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<5, 1>(reportTestCases), "posit<5,1>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<5, 2>(reportTestCases), "posit<5,2>", "negation"); - - nrOfFailedTestCases += ReportTestResult(VerifyNegation<6, 0>(reportTestCases), "posit<6,0>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<6, 1>(reportTestCases), "posit<6,1>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<6, 2>(reportTestCases), "posit<6,2>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<6, 3>(reportTestCases), "posit<6,3>", "negation"); - - nrOfFailedTestCases += ReportTestResult(VerifyNegation<7, 0>(reportTestCases), "posit<7,0>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<7, 1>(reportTestCases), "posit<7,1>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<7, 2>(reportTestCases), "posit<7,2>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<7, 3>(reportTestCases), "posit<7,3>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<7, 4>(reportTestCases), "posit<7,4>", "negation"); - - nrOfFailedTestCases += ReportTestResult(VerifyNegation<8, 0>(reportTestCases), "posit<8,0>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<8, 1>(reportTestCases), "posit<8,1>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<8, 2>(reportTestCases), "posit<8,2>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<8, 3>(reportTestCases), "posit<8,3>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<8, 4>(reportTestCases), "posit<8,4>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<8, 5>(reportTestCases), "posit<8,5>", "negation"); - - nrOfFailedTestCases += ReportTestResult(VerifyNegation<10, 1>(reportTestCases), "posit<10,1>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<12, 1>(reportTestCases), "posit<12,1>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<16, 1>(reportTestCases), "posit<16,1>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<2,0>", "negation"); + + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<3,0>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<3,1>", "negation"); + + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<4,0>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<4,1>", "negation"); + + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<5,0>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<5,1>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<5,2>", "negation"); + + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<6,0>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<6,1>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<6,2>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<6,3>", "negation"); + + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<7,0>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<7,1>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<7,2>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<7,3>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<7,4>", "negation"); + + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<8,0>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<8,1>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<8,2>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<8,3>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<8,4>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<8,5>", "negation"); + + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<10,1>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<12,1>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<16,1>", "negation"); #endif #if REGRESSION_LEVEL_2 @@ -108,8 +107,8 @@ try { #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyNegation<20, 1>(reportTestCases), "posit<20,1>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<24, 1>(reportTestCases), "posit<24,1>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<20,1>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation>(reportTestCases), "posit<24,1>", "negation"); #endif // REGRESSION_LEVEL_4 diff --git a/static/posit/arithmetic/reciprocation.cpp b/static/posit/arithmetic/reciprocation.cpp index c48604a07..ee0b16d6a 100644 --- a/static/posit/arithmetic/reciprocation.cpp +++ b/static/posit/arithmetic/reciprocation.cpp @@ -12,10 +12,9 @@ // third: enable tracing // when you define ALGORITHM_VERBOSE_OUTPUT executing an reciprocate the code will print intermediate results //#define ALGORITHM_VERBOSE_OUTPUT -#define ALGORITHM_TRACE_RECIPROCATE +#define ALGORITHM_TRACE_RECIPROCAL #define ALGORITHM_TRACE_CONVERSION #include -#include #include // generate specific test case that you can trace with the trace conditions in posit.hpp @@ -78,30 +77,30 @@ try { cout << p.get() << " " << pretty_print(p, 17) << endl; tag = "Manual Testing: "; - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<3, 0>(tag, true), "posit<3,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<4, 0>(tag, true), "posit<4,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<5, 0>(tag, true), "posit<5,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<6, 0>(tag, true), "posit<6,0>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation(tag, true), "posit<3,0>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation(tag, true), "posit<4,0>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation(tag, true), "posit<5,0>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation(tag, true), "posit<6,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<5, 1>(tag, true), "posit<5,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<6, 1>(tag, true), "posit<6,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<7, 1>(tag, true), "posit<7,1>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation(tag, true), "posit<5,1>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation(tag, true), "posit<6,1>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation(tag, true), "posit<7,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<8, 2>(tag, true), "posit<8,2>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation(tag, true), "posit<8,2>", "reciprocation"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<3, 0>(reportTestCases), "posit<3,0>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<3,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<4, 0>(reportTestCases), "posit<4,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<4, 1>(reportTestCases), "posit<4,1>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<4,0>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<4,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<5, 0>(reportTestCases), "posit<5,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<5, 1>(reportTestCases), "posit<5,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<5, 2>(reportTestCases), "posit<5,2>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<5,0>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<5,1>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<5,2>", "reciprocation"); #endif #if REGRESSION_LEVEL_2 @@ -113,31 +112,31 @@ try { #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<6, 0>(reportTestCases), "posit<6,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<6, 1>(reportTestCases), "posit<6,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<6, 2>(reportTestCases), "posit<6,2>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<6, 3>(reportTestCases), "posit<6,3>", "reciprocation"); - - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<7, 0>(reportTestCases), "posit<7,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<7, 1>(reportTestCases), "posit<7,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<7, 2>(reportTestCases), "posit<7,2>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<7, 3>(reportTestCases), "posit<7,3>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<7, 4>(reportTestCases), "posit<7,4>", "reciprocation"); - - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<8, 0>(reportTestCases), "posit<8,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<8, 1>(reportTestCases), "posit<8,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<8, 2>(reportTestCases), "posit<8,2>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<8, 3>(reportTestCases), "posit<8,3>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<8, 4>(reportTestCases), "posit<8,4>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<8, 5>(reportTestCases), "posit<8,5>", "reciprocation"); - - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<10, 1>(reportTestCases), "posit<10,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<12, 1>(reportTestCases), "posit<12,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<14, 1>(reportTestCases), "posit<14,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<16, 1>(reportTestCases), "posit<16,1>", "reciprocation"); - - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<18, 1>(reportTestCases), "posit<18,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<20, 1>(reportTestCases), "posit<20,1>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<6,0>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<6,1>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<6,2>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<6,3>", "reciprocation"); + + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<7,0>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<7,1>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<7,2>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<7,3>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<7,4>", "reciprocation"); + + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<8,0>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<8,1>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<8,2>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<8,3>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<8,4>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<8,5>", "reciprocation"); + + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<10,1>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<12,1>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<14,1>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<16,1>", "reciprocation"); + + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<18,1>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation>(reportTestCases), "posit<20,1>", "reciprocation"); #endif // REGRESSION_LEVEL_4 ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/posit/arithmetic/sqrt.cpp b/static/posit/arithmetic/sqrt.cpp index adefc5f72..3f0dc00af 100644 --- a/static/posit/arithmetic/sqrt.cpp +++ b/static/posit/arithmetic/sqrt.cpp @@ -35,11 +35,9 @@ // // #define POSIT_NATIVE_SQRT 1 #include -#include -#include #include -#include -#include +#include +#include // generate specific test case that you can trace with the trace conditions in posit.h // for most bugs they are traceable with _trace_conversion and _trace_add @@ -144,83 +142,83 @@ try { #endif // manual exhaustive test - nrOfFailedTestCases += ReportTestResult(VerifySqrt<2, 0>(true), "posit<2,0>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<2,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<3, 0>(true), "posit<3,0>", "sqrt"); -// nrOfFailedTestCases += ReportTestResult(VerifySqrt<3, 1>(true), "posit<3,1>", "sqrt"); // TODO: these configs where nbits < es+sign+regime don't work + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<3,0>", "sqrt"); +// nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<3,1>", "sqrt"); // TODO: these configs where nbits < es+sign+regime don't work - nrOfFailedTestCases += ReportTestResult(VerifySqrt<4, 0>(true), "posit<4,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<4, 1>(true), "posit<4,1>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<4,0>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<4,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<5, 0>(true), "posit<5,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<5, 1>(true), "posit<5,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<5, 2>(true), "posit<5,2>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<5,0>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<5,1>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<5,2>", "sqrt"); - //nrOfFailedTestCases += ReportTestResult(VerifySqrt<8, 4>("Manual Testing", true), "posit<8,4>", "sqrt"); + //nrOfFailedTestCases += ReportTestResult(VerifySqrt("Manual Testing", true), "posit<8,4>", "sqrt"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifySqrt<2, 0>(reportTestCases), "posit<2,0>", "sqrt"); - - nrOfFailedTestCases += ReportTestResult(VerifySqrt<3, 0>(reportTestCases), "posit<3,0>", "sqrt"); -// nrOfFailedTestCases += ReportTestResult(VerifySqrt<3, 1>(reportTestCases), "posit<3,1>", "sqrt"); // TODO: these configs where nbits < es+sign+regime don't work - - nrOfFailedTestCases += ReportTestResult(VerifySqrt<4, 0>(reportTestCases), "posit<4,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<4, 1>(reportTestCases), "posit<4,1>", "sqrt"); - - nrOfFailedTestCases += ReportTestResult(VerifySqrt<5, 0>(reportTestCases), "posit<5,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<5, 1>(reportTestCases), "posit<5,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<5, 2>(reportTestCases), "posit<5,2>", "sqrt"); - - nrOfFailedTestCases += ReportTestResult(VerifySqrt<6, 0>(reportTestCases), "posit<6,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<6, 1>(reportTestCases), "posit<6,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<6, 2>(reportTestCases), "posit<6,2>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<6, 3>(reportTestCases), "posit<6,3>", "sqrt"); - - nrOfFailedTestCases += ReportTestResult(VerifySqrt<7, 0>(reportTestCases), "posit<7,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<7, 1>(reportTestCases), "posit<7,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<7, 2>(reportTestCases), "posit<7,2>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<7, 3>(reportTestCases), "posit<7,3>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<7, 4>(reportTestCases), "posit<7,4>", "sqrt"); - - nrOfFailedTestCases += ReportTestResult(VerifySqrt<8, 0>(reportTestCases), "posit<8,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<8, 1>(reportTestCases), "posit<8,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<8, 2>(reportTestCases), "posit<8,2>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<8, 3>(reportTestCases), "posit<8,3>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<8, 4>(reportTestCases), "posit<8,4>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<8, 5>(reportTestCases), "posit<8,5>", "sqrt"); - - nrOfFailedTestCases += ReportTestResult(VerifySqrt<9, 0>(reportTestCases), "posit<9,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<9, 1>(reportTestCases), "posit<9,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<9, 2>(reportTestCases), "posit<9,2>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<9, 3>(reportTestCases), "posit<9,3>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<9, 4>(reportTestCases), "posit<9,4>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<9, 5>(reportTestCases), "posit<9,5>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<9, 6>(reportTestCases), "posit<9,6>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<2,0>", "sqrt"); + + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<3,0>", "sqrt"); +// nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<3,1>", "sqrt"); // TODO: these configs where nbits < es+sign+regime don't work + + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<4,0>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<4,1>", "sqrt"); + + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<5,0>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<5,1>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<5,2>", "sqrt"); + + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<6,0>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<6,1>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<6,2>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<6,3>", "sqrt"); + + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<7,0>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<7,1>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<7,2>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<7,3>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<7,4>", "sqrt"); + + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<8,0>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<8,1>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<8,2>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<8,3>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<8,4>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<8,5>", "sqrt"); + + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<9,0>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<9,1>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<9,2>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<9,3>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<9,4>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<9,5>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<9,6>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<10, 0>(reportTestCases), "posit<10,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<10, 1>(reportTestCases), "posit<10,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<10, 2>(reportTestCases), "posit<10,2>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<10,0>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<10,1>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<10,2>", "sqrt"); // fails due to regime representation not being able to be represented by double - // nrOfFailedTestCases += ReportTestResult(VerifySqrt<10, 7>(reportTestCases), "posit<10,7>", "sqrt"); + // nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<10,7>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<12, 0>(reportTestCases), "posit<12,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<12, 1>(reportTestCases), "posit<12,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<12, 2>(reportTestCases), "posit<12,2>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<12,0>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<12,1>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<12,2>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<16, 0>(reportTestCases), "posit<16,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<16, 1>(reportTestCases), "posit<16,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<16, 2>(reportTestCases), "posit<16,2>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<16,0>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<16,1>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<16,2>", "sqrt"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifySqrt<10, 2>(reportTestCases), "posit<10,2>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<12, 2>(reportTestCases), "posit<12,2>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<14, 2>(reportTestCases), "posit<14,2>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<16, 2>(reportTestCases), "posit<16,2>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<10,2>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<12,2>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<14,2>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt>(reportTestCases), "posit<16,2>", "sqrt"); using Posit20_2 = posit<20, 2>; nrOfFailedTestCases += ReportTestResult(VerifyUnaryOperatorThroughRandoms< Posit20_2 >(reportTestCases, OPCODE_SQRT, 1000, double(Posit20_2(SpecificValue::minpos))), type_tag(Posit20_2()), "sqrt"); diff --git a/static/posit/arithmetic/subtraction.cpp b/static/posit/arithmetic/subtraction.cpp index 1d4480508..c0fe42377 100644 --- a/static/posit/arithmetic/subtraction.cpp +++ b/static/posit/arithmetic/subtraction.cpp @@ -14,9 +14,9 @@ //#define ALGORITHM_VERBOSE_OUTPUT #define ALGORITHM_TRACE_SUB #include -#include -#include -#include +#include +#include +#include // generate specific test case that you can trace with the trace conditions in posit.h // for most bugs they are traceable with _trace_conversion and _trace_sub @@ -76,7 +76,7 @@ try { // manual exhaustive testing std::string positCfg = "posit<4,0>"; - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 0>(true), positCfg, "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(true), positCfg, "subtraction"); // FAIL 011001011010110100000110111110010111010011001010 - 000010111000000110100000001010011011111111110110 != 011001011010110011111111111101100011010001110110 instead it yielded 011001011010110011111111111101100011010001110111 unsigned long long a = 0b011001011010110100000110111110010111010011001010ull; @@ -95,47 +95,47 @@ try { #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<2, 0>(reportTestCases), "posit< 2,0>", "subtraction"); - - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<3, 0>(reportTestCases), "posit< 3,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<3, 1>(reportTestCases), "posit< 3,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<3, 2>(reportTestCases), "posit< 3,2>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<3, 3>(reportTestCases), "posit< 3,3>", "subtraction"); - - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 0>(reportTestCases), "posit< 4,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 1>(reportTestCases), "posit< 4,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 2>(reportTestCases), "posit< 4,2>", "subtraction"); - - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<5, 0>(reportTestCases), "posit< 5,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<5, 1>(reportTestCases), "posit< 5,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<5, 2>(reportTestCases), "posit< 5,2>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<5, 3>(reportTestCases), "posit< 5,3>", "subtraction"); - - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<6, 0>(reportTestCases), "posit< 6,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<6, 1>(reportTestCases), "posit< 6,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<6, 2>(reportTestCases), "posit< 6,2>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<6, 3>(reportTestCases), "posit< 6,3>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<6, 4>(reportTestCases), "posit< 6,4>", "subtraction"); - - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<7, 0>(reportTestCases), "posit< 7,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<7, 1>(reportTestCases), "posit< 7,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<7, 2>(reportTestCases), "posit< 7,2>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<7, 3>(reportTestCases), "posit< 7,3>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<7, 4>(reportTestCases), "posit< 7,4>", "subtraction"); - - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<8, 0>(reportTestCases), "posit< 8,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<8, 1>(reportTestCases), "posit< 8,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<8, 2>(reportTestCases), "posit< 8,2>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<8, 3>(reportTestCases), "posit< 8,3>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<8, 4>(reportTestCases), "posit< 8,4>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<8, 5>(reportTestCases), "posit< 8,5>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 2,0>", "subtraction"); + + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 3,0>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 3,1>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 3,2>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 3,3>", "subtraction"); + + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 4,0>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 4,1>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 4,2>", "subtraction"); + + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 5,0>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 5,1>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 5,2>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 5,3>", "subtraction"); + + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 6,0>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 6,1>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 6,2>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 6,3>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 6,4>", "subtraction"); + + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 7,0>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 7,1>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 7,2>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 7,3>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 7,4>", "subtraction"); + + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 8,0>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 8,1>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 8,2>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 8,3>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 8,4>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 8,5>", "subtraction"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<10, 0>(reportTestCases), "posit<10,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<10, 1>(reportTestCases), "posit<10,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<10, 2>(reportTestCases), "posit<10,2>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<10, 3>(reportTestCases), "posit<10,3>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit<10,0>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit<10,1>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit<10,2>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit<10,3>", "subtraction"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 2>(reportTestCases, OPCODE_SUB, 1000), "posit<16,1>", "subtraction"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<24, 2>(reportTestCases, OPCODE_SUB, 1000), "posit<24,1>", "subtraction"); @@ -157,9 +157,9 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(reportTestCases, OPCODE_SUB, 1000), "posit<64,4>", "subtraction"); #ifdef HARDWARE_ACCELERATION - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<12, 1>(reportTestCases), "posit<12,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<14, 1>(reportTestCases), "posit<14,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<16, 1>(reportTestCases), "posit<16,1>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit<12,1>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit<14,1>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit<16,1>", "subtraction"); #endif // HARDWARE_ACCELERATION #endif // REGRESSION_LEVEL_4 diff --git a/static/posit/conversion/assignment.cpp b/static/posit/conversion/assignment.cpp index cbdb21405..ac4215d40 100644 --- a/static/posit/conversion/assignment.cpp +++ b/static/posit/conversion/assignment.cpp @@ -1,12 +1,12 @@ // assignment.cpp : test suite runner for native type literal assignments for posits // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include #include #include -#include +#include namespace sw { namespace universal { diff --git a/static/posit/conversion/conversion.cpp b/static/posit/conversion/conversion.cpp index 17ee8f19c..9fda446a1 100644 --- a/static/posit/conversion/conversion.cpp +++ b/static/posit/conversion/conversion.cpp @@ -1,6 +1,6 @@ // conversion.cpp : test suite runner for conversion operators to posit numbers // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -10,7 +10,6 @@ // enable the ability to use literals in binary logic and arithmetic operators #define POSIT_ENABLE_LITERALS 1 #include -#include #include template @@ -221,63 +220,63 @@ try { cout << "----------------\n"; #endif - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<3, 0>(true), "posit<3,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<4, 0>(true), "posit<4,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<5, 0>(true), "posit<5,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<6, 0>(true), "posit<6,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<7, 0>(true), "posit<7,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<8, 0>(true), "posit<8,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<9, 0>(true), "posit<9,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), "posit<3,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), "posit<4,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), "posit<5,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), "posit<6,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), "posit<7,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), "posit<8,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), "posit<9,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<3, 0>(true), "posit<3,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<4, 1>(true), "posit<4,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<5, 2>(true), "posit<5,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<6, 3>(true), "posit<6,3>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<3,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<4,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<5,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<6,3>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<4, 0>(true), "posit<4,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<4, 1>(true), "posit<4,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<5, 0>(true), "posit<5,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<5, 1>(true), "posit<5,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<5, 2>(true), "posit<5,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<4,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<4,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<5,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<5,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<5,2>", test_tag); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<3, 0>(reportTestCases), "posit<3,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<4, 0>(reportTestCases), "posit<4,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<5, 0>(reportTestCases), "posit<5,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<6, 0>(reportTestCases), "posit<6,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<7, 0>(reportTestCases), "posit<7,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<8, 0>(reportTestCases), "posit<8,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<9, 0>(reportTestCases), "posit<9,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), "posit<3,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), "posit<4,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), "posit<5,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), "posit<6,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), "posit<7,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), "posit<8,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), "posit<9,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 3, 0>(reportTestCases), "posit<3,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 4, 0>(reportTestCases), "posit<4,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 5, 0>(reportTestCases), "posit<5,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 6, 0>(reportTestCases), "posit<6,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 7, 0>(reportTestCases), "posit<7,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 0>(reportTestCases), "posit<8,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 0>(reportTestCases), "posit<9,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<3,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<4,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<5,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<6,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<7,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<8,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<9,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 4, 1>(reportTestCases), "posit<4,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 5, 1>(reportTestCases), "posit<5,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 6, 1>(reportTestCases), "posit<6,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 7, 1>(reportTestCases), "posit<7,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 1>(reportTestCases), "posit<8,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 1>(reportTestCases), "posit<9,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<4,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<5,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<6,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<7,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<8,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<9,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 5, 2>(reportTestCases), "posit<5,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 6, 2>(reportTestCases), "posit<6,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 7, 2>(reportTestCases), "posit<7,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 2>(reportTestCases), "posit<8,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 2>(reportTestCases), "posit<9,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<5,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<6,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<7,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<8,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, float>(reportTestCases), "posit<9,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 6, 3>(reportTestCases), "posit<6,3>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 7, 3>(reportTestCases), "posit<7,3>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 3>(reportTestCases), "posit<8,3>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 3>(reportTestCases), "posit<9,3>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<6,3>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<7,3>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<8,3>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<9,3>", test_tag); #endif #if REGRESSION_LEVEL_2 @@ -289,25 +288,25 @@ try { #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyConversion<10, 0>(reportTestCases), "posit<10,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<10, 1>(reportTestCases), "posit<10,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<10, 2>(reportTestCases), "posit<10,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<10, 3>(reportTestCases), "posit<10,3>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<10,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<10,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<10,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<10,3>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<12, 0>(reportTestCases), "posit<12,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<12, 1>(reportTestCases), "posit<12,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<12, 2>(reportTestCases), "posit<12,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<12, 3>(reportTestCases), "posit<12,3>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<12,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<12,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<12,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<12,3>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<14, 0>(reportTestCases), "posit<14,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<14, 1>(reportTestCases), "posit<14,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<14, 2>(reportTestCases), "posit<14,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<14, 3>(reportTestCases), "posit<14,3>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<14,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<14,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<14,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<14,3>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<16, 0>(reportTestCases), "posit<16,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<16, 1>(reportTestCases), "posit<16,1>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<16, 2>(reportTestCases), "posit<16,2>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<16, 3>(reportTestCases), "posit<16,3>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<16,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<16,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<16,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion, double>(reportTestCases), "posit<16,3>", test_tag); #endif // REGRESSION_LEVEL_4 ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/posit/logic/logic.cpp b/static/posit/logic/logic.cpp index 149b048fe..efd5218b0 100644 --- a/static/posit/logic/logic.cpp +++ b/static/posit/logic/logic.cpp @@ -7,7 +7,6 @@ // enable literals to simplify the testing codes #define POSIT_ENABLE_LITERALS 1 #include -#include #include // Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override @@ -61,12 +60,12 @@ try { } { - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<3, 0>(), "posit<3,0>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<3, 0>(), "posit<3,0>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<3, 0>(), "posit<3,0>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<3, 0>(), "posit<3,0>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<3, 0>(), "posit<3,0>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<3, 0>(), "posit<3,0>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<3,0>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<3,0>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<3,0>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<3,0>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<3,0>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<3,0>", ">="); } ReportTestSuiteResults(test_suite, nrOfFailedTestCases); @@ -76,27 +75,27 @@ try { #if REGRESSION_LEVEL_1 std::cout << "Logic: operator==()\n"; - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<3, 0>(), "posit<3,0>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<4, 0>(), "posit<4,0>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<4, 1>(), "posit<4,1>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<5, 0>(), "posit<5,0>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<5, 1>(), "posit<5,1>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<5, 2>(), "posit<5,2>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<6, 0>(), "posit<6,0>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<6, 1>(), "posit<6,1>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<6, 2>(), "posit<6,2>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<6, 3>(), "posit<6,3>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<7, 0>(), "posit<7,0>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<7, 1>(), "posit<7,1>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<7, 2>(), "posit<7,2>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<7, 3>(), "posit<7,3>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<7, 4>(), "posit<7,4>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<8, 0>(), "posit<8,0>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<8, 1>(), "posit<8,1>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<8, 2>(), "posit<8,2>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<8, 3>(), "posit<8,3>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<8, 4>(), "posit<8,4>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<8, 5>(), "posit<8,5>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<3,0>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<4,0>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<4,1>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<5,0>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<5,1>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<5,2>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<6,0>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<6,1>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<6,2>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<6,3>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<7,0>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<7,1>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<7,2>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<7,3>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<7,4>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<8,0>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<8,1>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<8,2>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<8,3>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<8,4>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<8,5>", "=="); if (!(p == 0)) { nrOfFailedTestCases += ReportTestResult(1, "posit<16,1> == 0", "== int literal"); } @@ -123,24 +122,24 @@ try { } std::cout << "Logic: operator!=()\n"; - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<3, 0>(), "posit<3,0>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<4, 0>(), "posit<4,0>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<4, 1>(), "posit<4,1>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<5, 0>(), "posit<5,0>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<5, 1>(), "posit<5,1>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<5, 2>(), "posit<5,2>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<6, 0>(), "posit<6,0>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<6, 1>(), "posit<6,1>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<6, 2>(), "posit<6,2>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<6, 3>(), "posit<6,3>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<7, 0>(), "posit<7,0>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<7, 1>(), "posit<7,1>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<7, 2>(), "posit<7,2>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<7, 3>(), "posit<7,3>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<8, 0>(), "posit<8,0>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<8, 1>(), "posit<8,1>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<8, 2>(), "posit<8,2>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<8, 3>(), "posit<8,3>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<3,0>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<4,0>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<4,1>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<5,0>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<5,1>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<5,2>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<6,0>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<6,1>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<6,2>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<6,3>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<7,0>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<7,1>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<7,2>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<7,3>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<8,0>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<8,1>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<8,2>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<8,3>", "!="); if (p != 0) { nrOfFailedTestCases += ReportTestResult(1, "posit<16,1> != 0", "!= int literal"); } @@ -167,24 +166,24 @@ try { } std::cout << "Logic: operator<()\n"; - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<3, 0>(), "posit<3,0>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<4, 0>(), "posit<4,0>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<4, 1>(), "posit<4,1>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<5, 0>(), "posit<5,0>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<5, 1>(), "posit<5,1>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<5, 2>(), "posit<5,2>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<6, 0>(), "posit<6,0>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<6, 1>(), "posit<6,1>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<6, 2>(), "posit<6,2>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<6, 3>(), "posit<6,3>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<7, 0>(), "posit<7,0>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<7, 1>(), "posit<7,1>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<7, 2>(), "posit<7,2>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<7, 3>(), "posit<7,3>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<8, 0>(), "posit<8,0>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<8, 1>(), "posit<8,1>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<8, 2>(), "posit<8,2>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<8, 3>(), "posit<8,3>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<3,0>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<4,0>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<4,1>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<5,0>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<5,1>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<5,2>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<6,0>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<6,1>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<6,2>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<6,3>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<7,0>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<7,1>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<7,2>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<7,3>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<8,0>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<8,1>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<8,2>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<8,3>", "<"); if (p < 0) { nrOfFailedTestCases += ReportTestResult(1, "posit<16,1> < 0", "< int literal"); } @@ -211,24 +210,24 @@ try { } std::cout << "Logic: operator<=()\n"; - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<3, 0>(), "posit<3,0>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<4, 0>(), "posit<4,0>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<4, 1>(), "posit<4,1>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<5, 0>(), "posit<5,0>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<5, 1>(), "posit<5,1>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<5, 2>(), "posit<5,2>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<6, 0>(), "posit<6,0>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<6, 1>(), "posit<6,1>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<6, 2>(), "posit<6,2>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<6, 3>(), "posit<6,3>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<7, 0>(), "posit<7,0>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<7, 1>(), "posit<7,1>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<7, 2>(), "posit<7,2>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<7, 3>(), "posit<7,3>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<8, 0>(), "posit<8,0>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<8, 1>(), "posit<8,1>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<8, 2>(), "posit<8,2>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<8, 3>(), "posit<8,3>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<3,0>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<4,0>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<4,1>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<5,0>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<5,1>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<5,2>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<6,0>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<6,1>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<6,2>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<6,3>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<7,0>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<7,1>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<7,2>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<7,3>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<8,0>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<8,1>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<8,2>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<8,3>", "<="); if (!(p <= 0)) { nrOfFailedTestCases += ReportTestResult(1, "posit<16,1> <= 0", "<= int literal"); } @@ -255,24 +254,24 @@ try { } std::cout << "Logic: operator>()\n"; - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<3, 0>(), "posit<3,0>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<4, 0>(), "posit<4,0>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<4, 1>(), "posit<4,1>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<5, 0>(), "posit<5,0>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<5, 1>(), "posit<5,1>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<5, 2>(), "posit<5,2>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<6, 0>(), "posit<6,0>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<6, 1>(), "posit<6,1>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<6, 2>(), "posit<6,2>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<6, 3>(), "posit<6,3>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<7, 0>(), "posit<7,0>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<7, 1>(), "posit<7,1>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<7, 2>(), "posit<7,2>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<7, 3>(), "posit<7,3>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<8, 0>(), "posit<8,0>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<8, 1>(), "posit<8,1>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<8, 2>(), "posit<8,2>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<8, 3>(), "posit<8,3>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<3,0>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<4,0>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<4,1>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<5,0>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<5,1>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<5,2>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<6,0>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<6,1>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<6,2>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<6,3>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<7,0>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<7,1>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<7,2>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<7,3>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<8,0>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<8,1>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<8,2>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<8,3>", ">"); if (p > 0) { nrOfFailedTestCases += ReportTestResult(1, "posit<16,1> > 0", "> int literal"); } @@ -299,24 +298,24 @@ try { } std::cout << "Logic: operator>=()\n"; - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<3, 0>(), "posit<3,0>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<4, 0>(), "posit<4,0>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<4, 1>(), "posit<4,1>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<5, 0>(), "posit<5,0>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<5, 1>(), "posit<5,1>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<5, 2>(), "posit<5,2>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<6, 0>(), "posit<6,0>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<6, 1>(), "posit<6,1>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<6, 2>(), "posit<6,2>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<6, 3>(), "posit<6,3>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<7, 0>(), "posit<7,0>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<7, 1>(), "posit<7,1>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<7, 2>(), "posit<7,2>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<7, 3>(), "posit<7,3>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<8, 0>(), "posit<8,0>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<8, 1>(), "posit<8,1>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<8, 2>(), "posit<8,2>", ">="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<8, 3>(), "posit<8,3>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<3,0>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<4,0>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<4,1>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<5,0>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<5,1>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<5,2>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<6,0>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<6,1>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<6,2>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<6,3>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<7,0>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<7,1>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<7,2>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<7,3>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<8,0>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<8,1>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<8,2>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<8,3>", ">="); if (!(p >= 0)) { nrOfFailedTestCases += ReportTestResult(1, "posit<16,1> >= 0", ">= int literal"); } @@ -352,12 +351,12 @@ try { #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual<16, 1>(), "posit<16,1>", "=="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual<16, 1>(), "posit<16,1>", "!="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan<16, 1>(), "posit<16,1>", "<"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan<16, 1>(), "posit<16,1>", "<="); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan<16, 1>(), "posit<16,1>", ">"); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<16, 1>(), "posit<16,1>", ">="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual>(reportTestCases), "posit<16,1>", "=="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual>(reportTestCases), "posit<16,1>", "!="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan>(reportTestCases), "posit<16,1>", "<"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan>(reportTestCases), "posit<16,1>", "<="); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan>(reportTestCases), "posit<16,1>", ">"); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), "posit<16,1>", ">="); #endif // REGRESSION_LEVEL_4 ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/posit/math/classify.cpp b/static/posit/math/classify.cpp index 2278b1732..81f76d831 100644 --- a/static/posit/math/classify.cpp +++ b/static/posit/math/classify.cpp @@ -1,12 +1,12 @@ // classify.cpp: test suite runner for classification functions of the Reals specialized for posits // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // use default number system library configuration #include -#include +#include // Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 1 diff --git a/static/posit/math/exponent.cpp b/static/posit/math/exponent.cpp index d3eee0d07..a6b37d051 100644 --- a/static/posit/math/exponent.cpp +++ b/static/posit/math/exponent.cpp @@ -1,6 +1,6 @@ // function_exponent.cpp: test suite runner for exponent (exp, exp2, exp10) functions // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -12,7 +12,7 @@ // use default number system library configuration #include #include -#include +#include // generate specific test case that you can trace with the trace conditions in posit.hpp // for most bugs they are traceable with _trace_conversion and _trace_add @@ -80,20 +80,20 @@ try { cout << endl; // manual exhaustive test - nrOfFailedTestCases += ReportTestResult(VerifyExp<2, 0>("Manual Testing", reportTestCases), "posit<2,0>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<2,0>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<3, 0>("Manual Testing", reportTestCases), "posit<3,0>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<3, 1>("Manual Testing", reportTestCases), "posit<3,1>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<3,0>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<3,1>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<4, 0>("Manual Testing", reportTestCases), "posit<4,0>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<4, 1>("Manual Testing", reportTestCases), "posit<4,1>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<4,0>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<4,1>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<5, 0>("Manual Testing", reportTestCases), "posit<5,0>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<5, 1>("Manual Testing", reportTestCases), "posit<5,1>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<5, 2>("Manual Testing", reportTestCases), "posit<5,2>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<5,0>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<5,1>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<5,2>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<8, 4>("Manual Testing", reportTestCases), "posit<8,4>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<8, 4>("Manual Testing", reportTestCases), "posit<8,4>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<8,4>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<8,4>", "exp2"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; // ignore errors @@ -101,108 +101,108 @@ try { std::cout << "Posit exponential function validation\n"; - nrOfFailedTestCases += ReportTestResult(VerifyExp<2, 0>(reportTestCases), "posit<2,0>", "exp"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp<3, 0>(reportTestCases), "posit<3,0>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<3, 1>(reportTestCases), "posit<3,1>", "exp"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp<4, 0>(reportTestCases), "posit<4,0>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<4, 1>(reportTestCases), "posit<4,1>", "exp"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp<5, 0>(reportTestCases), "posit<5,0>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<5, 1>(reportTestCases), "posit<5,1>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<5, 2>(reportTestCases), "posit<5,2>", "exp"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp<6, 0>(reportTestCases), "posit<6,0>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<6, 1>(reportTestCases), "posit<6,1>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<6, 2>(reportTestCases), "posit<6,2>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<6, 3>(reportTestCases), "posit<6,3>", "exp"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp<7, 0>(reportTestCases), "posit<7,0>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<7, 1>(reportTestCases), "posit<7,1>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<7, 2>(reportTestCases), "posit<7,2>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<7, 3>(reportTestCases), "posit<7,3>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<7, 4>(reportTestCases), "posit<7,4>", "exp"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp<8, 0>(reportTestCases), "posit<8,0>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<8, 1>(reportTestCases), "posit<8,1>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<8, 2>(reportTestCases), "posit<8,2>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<8, 3>(reportTestCases), "posit<8,3>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<8, 4>(reportTestCases), "posit<8,4>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<8, 5>(reportTestCases), "posit<8,5>", "exp"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp<9, 0>(reportTestCases), "posit<9,0>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<9, 1>(reportTestCases), "posit<9,1>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<9, 2>(reportTestCases), "posit<9,2>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<9, 3>(reportTestCases), "posit<9,3>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<9, 4>(reportTestCases), "posit<9,4>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<9, 5>(reportTestCases), "posit<9,5>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<9, 6>(reportTestCases), "posit<9,6>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<2,0>", "exp"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<3,0>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<3,1>", "exp"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<4,0>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<4,1>", "exp"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<5,0>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<5,1>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<5,2>", "exp"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<6,0>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<6,1>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<6,2>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<6,3>", "exp"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<7,0>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<7,1>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<7,2>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<7,3>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<7,4>", "exp"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<8,0>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<8,1>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<8,2>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<8,3>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<8,4>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<8,5>", "exp"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<9,0>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<9,1>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<9,2>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<9,3>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<9,4>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<9,5>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<9,6>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<10, 0>(reportTestCases), "posit<10,0>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<10, 1>(reportTestCases), "posit<10,1>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<10, 2>(reportTestCases), "posit<10,2>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<10, 7>(reportTestCases), "posit<10,7>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<10,0>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<10,1>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<10,2>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<10,7>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<12, 0>(reportTestCases), "posit<12,0>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<12, 1>(reportTestCases), "posit<12,1>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<12, 2>(reportTestCases), "posit<12,2>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<12,0>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<12,1>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<12,2>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<16, 0>(reportTestCases), "posit<16,0>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<16, 1>(reportTestCases), "posit<16,1>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp<16, 2>(reportTestCases), "posit<16,2>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<16,0>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<16,1>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp>(reportTestCases), "posit<16,2>", "exp"); // base-2 exponent testing - nrOfFailedTestCases += ReportTestResult(VerifyExp2<2, 0>(reportTestCases), "posit<2,0>", "exp2"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp2<3, 0>(reportTestCases), "posit<3,0>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<3, 1>(reportTestCases), "posit<3,1>", "exp2"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp2<4, 0>(reportTestCases), "posit<4,0>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<4, 1>(reportTestCases), "posit<4,1>", "exp2"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp2<5, 0>(reportTestCases), "posit<5,0>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<5, 1>(reportTestCases), "posit<5,1>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<5, 2>(reportTestCases), "posit<5,2>", "exp2"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp2<6, 0>(reportTestCases), "posit<6,0>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<6, 1>(reportTestCases), "posit<6,1>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<6, 2>(reportTestCases), "posit<6,2>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<6, 3>(reportTestCases), "posit<6,3>", "exp2"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp2<7, 0>(reportTestCases), "posit<7,0>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<7, 1>(reportTestCases), "posit<7,1>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<7, 2>(reportTestCases), "posit<7,2>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<7, 3>(reportTestCases), "posit<7,3>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<7, 4>(reportTestCases), "posit<7,4>", "exp2"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp2<8, 0>(reportTestCases), "posit<8,0>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<8, 1>(reportTestCases), "posit<8,1>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<8, 2>(reportTestCases), "posit<8,2>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<8, 3>(reportTestCases), "posit<8,3>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<8, 4>(reportTestCases), "posit<8,4>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<8, 5>(reportTestCases), "posit<8,5>", "exp2"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp2<9, 0>(reportTestCases), "posit<9,0>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<9, 1>(reportTestCases), "posit<9,1>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<9, 2>(reportTestCases), "posit<9,2>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<9, 3>(reportTestCases), "posit<9,3>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<9, 4>(reportTestCases), "posit<9,4>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<9, 5>(reportTestCases), "posit<9,5>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<9, 6>(reportTestCases), "posit<9,6>", "exp2"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp2<10, 0>(reportTestCases), "posit<10,0>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<10, 1>(reportTestCases), "posit<10,1>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<10, 2>(reportTestCases), "posit<10,2>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<10, 7>(reportTestCases), "posit<10,7>", "exp2"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp2<12, 0>(reportTestCases), "posit<12,0>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<12, 1>(reportTestCases), "posit<12,1>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<12, 2>(reportTestCases), "posit<12,2>", "exp2"); - - nrOfFailedTestCases += ReportTestResult(VerifyExp2<16, 0>(reportTestCases), "posit<16,0>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<16, 1>(reportTestCases), "posit<16,1>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2<16, 2>(reportTestCases), "posit<16,2>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<2,0>", "exp2"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<3,0>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<3,1>", "exp2"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<4,0>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<4,1>", "exp2"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<5,0>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<5,1>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<5,2>", "exp2"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<6,0>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<6,1>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<6,2>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<6,3>", "exp2"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<7,0>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<7,1>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<7,2>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<7,3>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<7,4>", "exp2"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<8,0>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<8,1>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<8,2>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<8,3>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<8,4>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<8,5>", "exp2"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<9,0>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<9,1>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<9,2>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<9,3>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<9,4>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<9,5>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<9,6>", "exp2"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<10,0>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<10,1>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<10,2>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<10,7>", "exp2"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<12,0>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<12,1>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<12,2>", "exp2"); + + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<16,0>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<16,1>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2>(reportTestCases), "posit<16,2>", "exp2"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/posit/math/hyperbolic.cpp b/static/posit/math/hyperbolic.cpp index ecd2a5e6e..9431ba737 100644 --- a/static/posit/math/hyperbolic.cpp +++ b/static/posit/math/hyperbolic.cpp @@ -1,6 +1,6 @@ // function_hyperbolic.cpp: test suite runner for hyperbolic functions (sinh/cosh/tanh/atanh/acosh/asinh) // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -11,7 +11,7 @@ // use default number system library configuration #include -#include +#include // generate specific test case that you can trace with the trace conditions in posit.hpp // for most bugs they are traceable with _trace_conversion and _trace_add @@ -143,101 +143,101 @@ try { GenerateTestCaseAtanh<16, 1, double>(pi / 4.0); // manual exhaustive test - nrOfFailedTestCases += ReportTestResult(VerifySinh<2, 0>(reportTestCases), "posit<2,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<2,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<3, 0>(true), "posit<3,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<3, 1>(true), "posit<3,1>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<3,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<3,1>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<4, 0>(true), "posit<4,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<4, 1>(true), "posit<4,1>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<4,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<4,1>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<5, 0>(true), "posit<5,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<5, 1>(true), "posit<5,1>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<5, 2>(true), "posit<5,2>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<5,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<5,1>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<5,2>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<8, 0>(true), "posit<8,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifyCosh<8, 0>(true), "posit<8,0>", "cosh"); - nrOfFailedTestCases += ReportTestResult(VerifyTanh<8, 0>(true), "posit<8,0>", "tanh"); - nrOfFailedTestCases += ReportTestResult(VerifyAtanh<8, 0>(true), "posit<8,0>", "atanh"); - nrOfFailedTestCases += ReportTestResult(VerifyAcosh<8, 0>(true), "posit<8,0>", "acosh"); - nrOfFailedTestCases += ReportTestResult(VerifyAsinh<8, 0>(true), "posit<8,0>", "asinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<8,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifyCosh< posit<8, 0>>(reportTestCases), "posit<8,0>", "cosh"); + nrOfFailedTestCases += ReportTestResult(VerifyTanh< posit<8, 0>>(reportTestCases), "posit<8,0>", "tanh"); + nrOfFailedTestCases += ReportTestResult(VerifyAtanh< posit<8, 0>>(reportTestCases), "posit<8,0>", "atanh"); + nrOfFailedTestCases += ReportTestResult(VerifyAcosh< posit<8, 0>>(reportTestCases), "posit<8,0>", "acosh"); + nrOfFailedTestCases += ReportTestResult(VerifyAsinh< posit<8, 0>>(reportTestCases), "posit<8,0>", "asinh"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; // ignore errors #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifySinh<2, 0>(reportTestCases), "posit<2,0>", "sinh"); - - nrOfFailedTestCases += ReportTestResult(VerifySinh<3, 0>(reportTestCases), "posit<3,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<3, 1>(reportTestCases), "posit<3,1>", "sinh"); - - nrOfFailedTestCases += ReportTestResult(VerifySinh<4, 0>(reportTestCases), "posit<4,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<4, 1>(reportTestCases), "posit<4,1>", "sinh"); - - nrOfFailedTestCases += ReportTestResult(VerifySinh<5, 0>(reportTestCases), "posit<5,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<5, 1>(reportTestCases), "posit<5,1>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<5, 2>(reportTestCases), "posit<5,2>", "sinh"); - - nrOfFailedTestCases += ReportTestResult(VerifySinh<6, 0>(reportTestCases), "posit<6,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<6, 1>(reportTestCases), "posit<6,1>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<6, 2>(reportTestCases), "posit<6,2>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<6, 3>(reportTestCases), "posit<6,3>", "sinh"); - - nrOfFailedTestCases += ReportTestResult(VerifySinh<7, 0>(reportTestCases), "posit<7,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<7, 1>(reportTestCases), "posit<7,1>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<7, 2>(reportTestCases), "posit<7,2>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<7, 3>(reportTestCases), "posit<7,3>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<7, 4>(reportTestCases), "posit<7,4>", "sinh"); - -// nrOfFailedTestCases += ReportTestResult(VerifySinh<8, 0>(reportTestCases), "posit<8,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<8, 1>(reportTestCases), "posit<8,1>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<8, 2>(reportTestCases), "posit<8,2>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<8, 3>(reportTestCases), "posit<8,3>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<8, 4>(reportTestCases), "posit<8,4>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<8, 5>(reportTestCases), "posit<8,5>", "sinh"); - - nrOfFailedTestCases += ReportTestResult(VerifySinh<8, 0>(reportTestCases), "posit<8,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifyCosh<8, 0>(reportTestCases), "posit<8,0>", "cosh"); - nrOfFailedTestCases += ReportTestResult(VerifyTanh<8, 0>(reportTestCases), "posit<8,0>", "tanh"); - nrOfFailedTestCases += ReportTestResult(VerifyAtanh<8, 0>(reportTestCases), "posit<8,0>", "atanh"); - nrOfFailedTestCases += ReportTestResult(VerifyAcosh<8, 0>(reportTestCases), "posit<8,0>", "acosh"); - nrOfFailedTestCases += ReportTestResult(VerifyAsinh<8, 0>(reportTestCases), "posit<8,0>", "asinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<2,0>", "sinh"); + + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<3,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<3,1>", "sinh"); + + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<4,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<4,1>", "sinh"); + + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<5,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<5,1>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<5,2>", "sinh"); + + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<6,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<6,1>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<6,2>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<6,3>", "sinh"); + + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<7,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<7,1>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<7,2>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<7,3>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<7,4>", "sinh"); + +// nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<8,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<8,1>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<8,2>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<8,3>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<8,4>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<8,5>", "sinh"); + + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<8,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifyCosh>(reportTestCases), "posit<8,0>", "cosh"); + nrOfFailedTestCases += ReportTestResult(VerifyTanh>(reportTestCases), "posit<8,0>", "tanh"); + nrOfFailedTestCases += ReportTestResult(VerifyAtanh>(reportTestCases), "posit<8,0>", "atanh"); + nrOfFailedTestCases += ReportTestResult(VerifyAcosh>(reportTestCases), "posit<8,0>", "acosh"); + nrOfFailedTestCases += ReportTestResult(VerifyAsinh>(reportTestCases), "posit<8,0>", "asinh"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifySinh<9, 0>(reportTestCases), "posit<9,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<9, 1>(reportTestCases), "posit<9,1>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<9, 2>(reportTestCases), "posit<9,2>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<9, 3>(reportTestCases), "posit<9,3>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<9, 4>(reportTestCases), "posit<9,4>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<9, 5>(reportTestCases), "posit<9,5>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<9, 6>(reportTestCases), "posit<9,6>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<9,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<9,1>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<9,2>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<9,3>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<9,4>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<9,5>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<9,6>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<10, 0>(reportTestCases), "posit<10,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<10, 1>(reportTestCases), "posit<10,1>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<10, 2>(reportTestCases), "posit<10,2>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<10, 7>(reportTestCases), "posit<10,7>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<10,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<10,1>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<10,2>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<10,7>", "sinh"); #endif #if REGRESSION_LEVEL_3 - nrOfFailedTestCases += ReportTestResult(VerifySinh<12, 0>(reportTestCases), "posit<12,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<12, 1>(reportTestCases), "posit<12,1>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<12, 2>(reportTestCases), "posit<12,2>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<12,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<12,1>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<12,2>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<16, 0>(reportTestCases), "posit<16,0>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<16, 1>(reportTestCases), "posit<16,1>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<16, 2>(reportTestCases), "posit<16,2>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<16,0>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<16,1>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<16,2>", "sinh"); #endif #if REGRESSION_LEVEL_4 // nbits=64 requires long double compiler support - // nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(reportTestCases, OPCODE_SQRT, 1000), "posit<64,2>", "sinh"); + // nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>>(reportTestCases, OPCODE_SQRT, 1000), "posit<64,2>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<10, 1>(reportTestCases), "posit<10,1>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<12, 1>(reportTestCases), "posit<12,1>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<14, 1>(reportTestCases), "posit<14,1>", "sinh"); - nrOfFailedTestCases += ReportTestResult(VerifySinh<16, 1>(reportTestCases), "posit<16,1>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<10,1>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<12,1>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<14,1>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifySinh>(reportTestCases), "posit<16,1>", "sinh"); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/posit/math/hypotenuse.cpp b/static/posit/math/hypotenuse.cpp index dffa7cb3b..cef661b4c 100644 --- a/static/posit/math/hypotenuse.cpp +++ b/static/posit/math/hypotenuse.cpp @@ -1,13 +1,13 @@ // hypotenuse.cpp: test suite runner for the hypotenuse functions (hypot, hypotf, hypotl) // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // when you define ALGORITHM_VERBOSE_OUTPUT the code will print intermediate results for selected arithmetic operations //#define ALGORITHM_VERBOSE_OUTPUT #include -#include +#include // generate specific test case that you can trace with the trace conditions in posit.hpp // for most bugs they are traceable with _trace_conversion and _trace_add @@ -60,17 +60,17 @@ try { GenerateTestCase< 8, 2, float>(3.0f, 4.0f); GenerateTestCase<16, 2, float>(3.0f, 4.0f); - nrOfFailedTestCases += ReportTestResult(VerifyHypot<2, 0>(reportTestCases), "posit<2,0>", "hypot"); + nrOfFailedTestCases += ReportTestResult(VerifyHypot(reportTestCases), "posit<2,0>", "hypot"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; // ignore errors #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyHypot<4, 0>(reportTestCases), "posit<4,0>", "hypot"); - nrOfFailedTestCases += ReportTestResult(VerifyHypot<4, 1>(reportTestCases), "posit<4,1>", "hypot"); - nrOfFailedTestCases += ReportTestResult(VerifyHypot<5, 2>(reportTestCases), "posit<5,2>", "hypot"); - nrOfFailedTestCases += ReportTestResult(VerifyHypot<6, 2>(reportTestCases), "posit<6,2>", "hypot"); + nrOfFailedTestCases += ReportTestResult(VerifyHypot>(reportTestCases), "posit<4,0>", "hypot"); + nrOfFailedTestCases += ReportTestResult(VerifyHypot>(reportTestCases), "posit<4,1>", "hypot"); + nrOfFailedTestCases += ReportTestResult(VerifyHypot>(reportTestCases), "posit<5,2>", "hypot"); + nrOfFailedTestCases += ReportTestResult(VerifyHypot>(reportTestCases), "posit<6,2>", "hypot"); #endif diff --git a/static/posit/math/logarithm.cpp b/static/posit/math/logarithm.cpp index 50f46c91f..d12ea1cca 100644 --- a/static/posit/math/logarithm.cpp +++ b/static/posit/math/logarithm.cpp @@ -1,6 +1,6 @@ // logarithm.cpp: test suite runner for the logarithm functions (log2, log10, ln) // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -11,7 +11,7 @@ // use default number system library configuration #include -#include +#include // generate specific test case that you can trace with the trace conditions in posit.hpp // for most bugs they are traceable with _trace_conversion and _trace_add @@ -78,94 +78,94 @@ try { #endif // manual exhaustive test - nrOfFailedTestCases += ReportTestResult(VerifyLog<2, 0>(reportTestCases), "posit<2,0>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<2,0>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<3, 0>(true), "posit<3,0>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<3, 1>(true), "posit<3,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<3,0>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<3,1>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<4, 0>(true), "posit<4,0>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<4, 1>(true), "posit<4,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<4,0>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<4,1>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<5, 0>(true), "posit<5,0>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<5, 1>(true), "posit<5,1>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<5, 2>(true), "posit<5,2>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<5,0>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<5,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<5,2>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<8, 4>(true), "posit<8,4>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog2<8, 4>(true), "posit<8,4>", "log2"); - nrOfFailedTestCases += ReportTestResult(VerifyLog10<8, 4>(true), "posit<8,4>", "log10"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<8,4>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog2>(reportTestCases), "posit<8,4>", "log2"); + nrOfFailedTestCases += ReportTestResult(VerifyLog10>(reportTestCases), "posit<8,4>", "log10"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; // ignore errors #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyLog<2, 0>(reportTestCases), "posit<2,0>", "log"); - - nrOfFailedTestCases += ReportTestResult(VerifyLog<3, 0>(reportTestCases), "posit<3,0>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<3, 1>(reportTestCases), "posit<3,1>", "log"); - - nrOfFailedTestCases += ReportTestResult(VerifyLog<4, 0>(reportTestCases), "posit<4,0>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<4, 1>(reportTestCases), "posit<4,1>", "log"); - - nrOfFailedTestCases += ReportTestResult(VerifyLog<5, 0>(reportTestCases), "posit<5,0>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<5, 1>(reportTestCases), "posit<5,1>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<5, 2>(reportTestCases), "posit<5,2>", "log"); - - nrOfFailedTestCases += ReportTestResult(VerifyLog<6, 0>(reportTestCases), "posit<6,0>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<6, 1>(reportTestCases), "posit<6,1>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<6, 2>(reportTestCases), "posit<6,2>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<6, 3>(reportTestCases), "posit<6,3>", "log"); - - nrOfFailedTestCases += ReportTestResult(VerifyLog<7, 0>(reportTestCases), "posit<7,0>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<7, 1>(reportTestCases), "posit<7,1>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<7, 2>(reportTestCases), "posit<7,2>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<7, 3>(reportTestCases), "posit<7,3>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<7, 4>(reportTestCases), "posit<7,4>", "log"); - - nrOfFailedTestCases += ReportTestResult(VerifyLog<8, 0>(reportTestCases), "posit<8,0>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<8, 1>(reportTestCases), "posit<8,1>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<8, 2>(reportTestCases), "posit<8,2>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<8, 3>(reportTestCases), "posit<8,3>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<8, 4>(reportTestCases), "posit<8,4>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<8, 5>(reportTestCases), "posit<8,5>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<2,0>", "log"); + + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<3,0>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<3,1>", "log"); + + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<4,0>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<4,1>", "log"); + + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<5,0>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<5,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<5,2>", "log"); + + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<6,0>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<6,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<6,2>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<6,3>", "log"); + + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<7,0>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<7,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<7,2>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<7,3>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<7,4>", "log"); + + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<8,0>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<8,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<8,2>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<8,3>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<8,4>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<8,5>", "log"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifyLog<9, 0>(reportTestCases), "posit<9,0>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<9, 1>(reportTestCases), "posit<9,1>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<9, 2>(reportTestCases), "posit<9,2>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<9, 3>(reportTestCases), "posit<9,3>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<9, 4>(reportTestCases), "posit<9,4>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<9, 5>(reportTestCases), "posit<9,5>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<9, 6>(reportTestCases), "posit<9,6>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<9,0>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<9,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<9,2>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<9,3>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<9,4>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<9,5>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<9,6>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<10, 0>(reportTestCases), "posit<10,0>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<10, 1>(reportTestCases), "posit<10,1>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<10, 2>(reportTestCases), "posit<10,2>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<10, 7>(reportTestCases), "posit<10,7>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<10,0>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<10,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<10,2>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<10,7>", "log"); #endif #if REGRESSION_LEVEL_3 - nrOfFailedTestCases += ReportTestResult(VerifyLog<12, 0>(reportTestCases), "posit<12,0>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<12, 1>(reportTestCases), "posit<12,1>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<12, 2>(reportTestCases), "posit<12,2>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<12,0>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<12,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<12,2>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<16, 0>(reportTestCases), "posit<16,0>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<16, 1>(reportTestCases), "posit<16,1>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<16, 2>(reportTestCases), "posit<16,2>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<16,0>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<16,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<16,2>", "log"); #endif #if REGRESSION_LEVEL_4 // nbits=64 requires long double compiler support - nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(reportTestCases, OPCODE_SQRT, 1000), "posit<64,2>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 3>(reportTestCases, OPCODE_SQRT, 1000), "posit<64,3>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 4>(reportTestCases, OPCODE_SQRT, 1000), "posit<64,4>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>>(reportTestCases, OPCODE_SQRT, 1000), "posit<64,2>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 3>>(reportTestCases, OPCODE_SQRT, 1000), "posit<64,3>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 4>>(reportTestCases, OPCODE_SQRT, 1000), "posit<64,4>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<10, 1>(reportTestCases), "posit<10,1>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<12, 1>(reportTestCases), "posit<12,1>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<14, 1>(reportTestCases), "posit<14,1>", "log"); - nrOfFailedTestCases += ReportTestResult(VerifyLog<16, 1>(reportTestCases), "posit<16,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<10,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<12,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<14,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog>(reportTestCases), "posit<16,1>", "log"); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/posit/math/pow.cpp b/static/posit/math/pow.cpp index a5a1789b4..4d318901a 100644 --- a/static/posit/math/pow.cpp +++ b/static/posit/math/pow.cpp @@ -1,6 +1,6 @@ // function_pow.cpp: test suite runner for pow function // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -11,7 +11,7 @@ // use default number system library configuration #include -#include +#include #include // for ipow // generate specific test case that you can trace with the trace conditions in posit.hpp @@ -113,63 +113,63 @@ try { std::cout << "1M ^ 2 = " << ipow(ipow(c, d), d) << '\n'; #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<2, 0>(reportTestCases), "posit<2,0>", "pow"); - - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<3, 0>(reportTestCases), "posit<3,0>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<3, 1>(reportTestCases), "posit<3,1>", "pow"); - - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<4, 0>(reportTestCases), "posit<4,0>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<4, 1>(reportTestCases), "posit<4,1>", "pow"); - - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<5, 0>(reportTestCases), "posit<5,0>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<5, 1>(reportTestCases), "posit<5,1>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<5, 2>(reportTestCases), "posit<5,2>", "pow"); - - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<6, 0>(reportTestCases), "posit<6,0>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<6, 1>(reportTestCases), "posit<6,1>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<6, 2>(reportTestCases), "posit<6,2>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<6, 3>(reportTestCases), "posit<6,3>", "pow"); - - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<7, 0>(reportTestCases), "posit<7,0>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<7, 1>(reportTestCases), "posit<7,1>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<7, 2>(reportTestCases), "posit<7,2>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<7, 3>(reportTestCases), "posit<7,3>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<7, 4>(reportTestCases), "posit<7,4>", "pow"); - - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<8, 0>(reportTestCases), "posit<8,0>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<8, 1>(reportTestCases), "posit<8,1>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<8, 2>(reportTestCases), "posit<8,2>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<8, 3>(reportTestCases), "posit<8,3>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<8, 4>(reportTestCases), "posit<8,4>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<8, 5>(reportTestCases), "posit<8,5>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<2,0>", "pow"); + + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<3,0>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<3,1>", "pow"); + + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<4,0>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<4,1>", "pow"); + + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<5,0>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<5,1>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<5,2>", "pow"); + + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<6,0>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<6,1>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<6,2>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<6,3>", "pow"); + + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<7,0>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<7,1>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<7,2>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<7,3>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<7,4>", "pow"); + + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<8,0>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<8,1>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<8,2>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<8,3>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<8,4>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<8,5>", "pow"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<9, 0>(reportTestCases), "posit<9,0>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<9, 1>(reportTestCases), "posit<9,1>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<9, 2>(reportTestCases), "posit<9,2>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<9, 3>(reportTestCases), "posit<9,3>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<9, 4>(reportTestCases), "posit<9,4>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<9, 5>(reportTestCases), "posit<9,5>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<9, 6>(reportTestCases), "posit<9,6>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<9,0>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<9,1>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<9,2>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<9,3>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<9,4>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<9,5>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<9,6>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<10, 0>(reportTestCases), "posit<10,0>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<10, 1>(reportTestCases), "posit<10,1>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<10, 2>(reportTestCases), "posit<10,2>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<10,0>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<10,1>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<10,2>", "pow"); // fails due to regime representation not being able to be represented by double - // nrOfFailedTestCases += ReportTestResult(VerifyPowMethod<10, 7>(reportTestCases), "posit<10,7>", "pow"); + // nrOfFailedTestCases += ReportTestResult(VerifyPowMethod>(reportTestCases), "posit<10,7>", "pow"); #endif #if REGRESSION_LEVEL_3 - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<12, 0>(reportTestCases), "posit<12,0>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<12, 1>(reportTestCases), "posit<12,1>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<12, 2>(reportTestCases), "posit<12,2>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<12,0>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<12,1>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<12,2>", "pow"); #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<16, 0>(reportTestCases), "posit<16,0>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<16, 1>(reportTestCases), "posit<16,1>", "pow"); - nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<16, 2>(reportTestCases), "posit<16,2>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<16,0>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<16,1>", "pow"); + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction>(reportTestCases), "posit<16,2>", "pow"); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/posit/math/trigonometry.cpp b/static/posit/math/trigonometry.cpp index 535025f43..56c008ed3 100644 --- a/static/posit/math/trigonometry.cpp +++ b/static/posit/math/trigonometry.cpp @@ -1,6 +1,6 @@ // function_trigonometry.cpp: test suite runner for trigonometric functions (sin/cos/tan/atan/acos/asin) // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -8,7 +8,7 @@ //#define ALGORITHM_VERBOSE_OUTPUT #define ALGORITHM_TRACE_SQRT #include -#include +#include /* Writes result sine result sin(πa) to the location pointed to by sp @@ -225,94 +225,94 @@ try { GenerateTestCase<16, 1, double>(m_pi_2); // manual exhaustive test - nrOfFailedTestCases += ReportTestResult(VerifySine<2, 0>(reportTestCases), "posit<2,0>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<2,0>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<3, 0>(reportTestCases), "posit<3,0>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<3, 1>(reportTestCases), "posit<3,1>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<3,0>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<3,1>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<4, 0>(reportTestCases), "posit<4,0>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<4, 1>(reportTestCases), "posit<4,1>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<4,0>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<4,1>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<5, 0>(reportTestCases), "posit<5,0>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<5, 1>(reportTestCases), "posit<5,1>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<5, 2>(reportTestCases), "posit<5,2>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<5,0>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<5,1>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<5,2>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<8, 0>(reportTestCases), "posit<8,0>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifyCosine<8, 0>(reportTestCases), "posit<8,0>", "cos"); - nrOfFailedTestCases += ReportTestResult(VerifyTangent<8, 0>(reportTestCases), "posit<8,0>", "tan"); - nrOfFailedTestCases += ReportTestResult(VerifyAtan<8, 0>(reportTestCases), "posit<8,0>", "atan"); - nrOfFailedTestCases += ReportTestResult(VerifyAsin<8, 0>(reportTestCases), "posit<8,0>", "asin"); - nrOfFailedTestCases += ReportTestResult(VerifyAcos<8, 0>(reportTestCases), "posit<8,0>", "acos"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<8,0>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifyCosine>(reportTestCases), "posit<8,0>", "cos"); + nrOfFailedTestCases += ReportTestResult(VerifyTangent>(reportTestCases), "posit<8,0>", "tan"); + nrOfFailedTestCases += ReportTestResult(VerifyAtan>(reportTestCases), "posit<8,0>", "atan"); + nrOfFailedTestCases += ReportTestResult(VerifyAsin>(reportTestCases), "posit<8,0>", "asin"); + nrOfFailedTestCases += ReportTestResult(VerifyAcos>(reportTestCases), "posit<8,0>", "acos"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; // ignore errors #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifySine<2, 0>(reportTestCases), "posit<2,0>", "sin"); - - nrOfFailedTestCases += ReportTestResult(VerifySine<3, 0>(reportTestCases), "posit<3,0>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<3, 1>(reportTestCases), "posit<3,1>", "sin"); - - nrOfFailedTestCases += ReportTestResult(VerifySine<4, 0>(reportTestCases), "posit<4,0>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<4, 1>(reportTestCases), "posit<4,1>", "sin"); - - nrOfFailedTestCases += ReportTestResult(VerifySine<5, 0>(reportTestCases), "posit<5,0>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<5, 1>(reportTestCases), "posit<5,1>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<5, 2>(reportTestCases), "posit<5,2>", "sin"); - - nrOfFailedTestCases += ReportTestResult(VerifySine<6, 0>(reportTestCases), "posit<6,0>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<6, 1>(reportTestCases), "posit<6,1>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<6, 2>(reportTestCases), "posit<6,2>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<6, 3>(reportTestCases), "posit<6,3>", "sin"); - - nrOfFailedTestCases += ReportTestResult(VerifySine<7, 0>(reportTestCases), "posit<7,0>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<7, 1>(reportTestCases), "posit<7,1>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<7, 2>(reportTestCases), "posit<7,2>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<7, 3>(reportTestCases), "posit<7,3>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<7, 4>(reportTestCases), "posit<7,4>", "sin"); - - nrOfFailedTestCases += ReportTestResult(VerifySine<8, 0>(reportTestCases), "posit<8,0>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<8, 1>(reportTestCases), "posit<8,1>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<8, 2>(reportTestCases), "posit<8,2>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<8, 3>(reportTestCases), "posit<8,3>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<8, 4>(reportTestCases), "posit<8,4>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<8, 5>(reportTestCases), "posit<8,5>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<2,0>", "sin"); + + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<3,0>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<3,1>", "sin"); + + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<4,0>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<4,1>", "sin"); + + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<5,0>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<5,1>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<5,2>", "sin"); + + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<6,0>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<6,1>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<6,2>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<6,3>", "sin"); + + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<7,0>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<7,1>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<7,2>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<7,3>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<7,4>", "sin"); + + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<8,0>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<8,1>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<8,2>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<8,3>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<8,4>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<8,5>", "sin"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifySine<9, 0>(reportTestCases), "posit<9,0>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<9, 1>(reportTestCases), "posit<9,1>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<9, 2>(reportTestCases), "posit<9,2>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<9, 3>(reportTestCases), "posit<9,3>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<9, 4>(reportTestCases), "posit<9,4>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<9, 5>(reportTestCases), "posit<9,5>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<9, 6>(reportTestCases), "posit<9,6>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<9,0>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<9,1>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<9,2>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<9,3>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<9,4>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<9,5>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<9,6>", "sin"); #endif #if REGRESSION_LEVEL_3 - nrOfFailedTestCases += ReportTestResult(VerifySine<10, 0>(reportTestCases), "posit<10,0>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<10, 1>(reportTestCases), "posit<10,1>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<10, 2>(reportTestCases), "posit<10,2>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<10, 7>(reportTestCases), "posit<10,7>", "sin"); - - nrOfFailedTestCases += ReportTestResult(VerifySine<12, 0>(reportTestCases), "posit<12,0>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<12, 1>(reportTestCases), "posit<12,1>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<12, 2>(reportTestCases), "posit<12,2>", "sin"); - - nrOfFailedTestCases += ReportTestResult(VerifySine<16, 0>(reportTestCases), "posit<16,0>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<16, 1>(reportTestCases), "posit<16,1>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<16, 2>(reportTestCases), "posit<16,2>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<10,0>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<10,1>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<10,2>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<10,7>", "sin"); + + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<12,0>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<12,1>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<12,2>", "sin"); + + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<16,0>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<16,1>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<16,2>", "sin"); #endif #if REGRESSION_LEVEL_4 // nbits=64 requires long double compiler support - // nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(reportTestCases, OPCODE_SIN, 1000), "posit<64,2>", "sin"); + // nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>>(reportTestCases, OPCODE_SIN, 1000), "posit<64,2>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<10, 1>(reportTestCases), "posit<10,1>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<12, 1>(reportTestCases), "posit<12,1>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<14, 1>(reportTestCases), "posit<14,1>", "sin"); - nrOfFailedTestCases += ReportTestResult(VerifySine<16, 1>(reportTestCases), "posit<16,1>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<10,1>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<12,1>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<14,1>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifySine>(reportTestCases), "posit<16,1>", "sin"); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/posit/math/truncate.cpp b/static/posit/math/truncate.cpp index f34b0edb8..d3c6adde0 100644 --- a/static/posit/math/truncate.cpp +++ b/static/posit/math/truncate.cpp @@ -1,12 +1,12 @@ // function_truncate.cpp: test suite runner for truncation functions trunc, round, floor, and ceil // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // use default number system library configuration #include -#include +#include // Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 0 diff --git a/static/posit/specialized/posit_128_2.cpp b/static/posit/specialized/posit_128_2.cpp index 51fb9a2e2..81bcbb50d 100644 --- a/static/posit/specialized/posit_128_2.cpp +++ b/static/posit/specialized/posit_128_2.cpp @@ -1,6 +1,6 @@ // posit_128_2.cpp: test suite runner for specialized 128-bit posit<128,2> // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -13,7 +13,7 @@ #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 #include #include -#include +#include /// Standard posits with nbits = 128 have 2 exponent bits. diff --git a/static/posit/specialized/posit_128_4.cpp b/static/posit/specialized/posit_128_4.cpp index 8a9e51d7d..7a38ee923 100644 --- a/static/posit/specialized/posit_128_4.cpp +++ b/static/posit/specialized/posit_128_4.cpp @@ -13,7 +13,7 @@ #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 #include #include -#include +#include /// Standard posits with nbits = 128 have 4 exponent bits. diff --git a/static/posit/specialized/posit_16_1.cpp b/static/posit/specialized/posit_16_1.cpp index 0277e732e..d0906f2e2 100644 --- a/static/posit/specialized/posit_16_1.cpp +++ b/static/posit/specialized/posit_16_1.cpp @@ -12,8 +12,9 @@ // second: enable posit arithmetic exceptions #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 #include -#include -#include +#include +#include +#include // Standard posit with nbits = 16 have es = 1 exponent bit. @@ -130,18 +131,18 @@ try { #if REGRESSION_LEVEL_2 // logic tests std::cout << "Logic operator tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicEqual (), tag, " == (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicNotEqual (), tag, " != (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicLessThan (), tag, " < (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicLessOrEqualThan (), tag, " <= (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicGreaterThan (), tag, " > (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicGreaterOrEqualThan(), tag, " >= (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicEqual >(reportTestCases), tag, " == (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicNotEqual >(reportTestCases), tag, " != (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicLessThan >(reportTestCases), tag, " < (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicLessOrEqualThan >(reportTestCases), tag, " <= (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicGreaterThan >(reportTestCases), tag, " > (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicGreaterOrEqualThan>(reportTestCases), tag, " >= (native) "); #endif #if REGRESSION_LEVEL_3 // conversion tests std::cout << "Assignment/conversion tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifyIntegerConversion (reportTestCases), tag, "integer assign (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyIntegerConversion >(reportTestCases), tag, "integer assign (native) "); // FAIL = 0.25003 did not convert to 0.250061 instead it yielded 0.25 raw 0b0.01.0.000000000000 // FAIL = 0.99994 did not convert to 0.999878 instead it yielded 1 raw 0b0.10.0.000000000000 // posit<16, 1> float assign(native) FAIL 2 failed test cases @@ -164,26 +165,26 @@ try { #if REGRESSION_LEVEL_4 // elementary function tests std::cout << "Elementary function tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifySqrt (reportTestCases), tag, "sqrt (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyExp (reportTestCases), tag, "exp "); - nrOfFailedTestCases += ReportTestResult( VerifyExp2 (reportTestCases), tag, "exp2 "); - nrOfFailedTestCases += ReportTestResult( VerifyLog (reportTestCases), tag, "log "); - nrOfFailedTestCases += ReportTestResult( VerifyLog2 (reportTestCases), tag, "log2 "); - nrOfFailedTestCases += ReportTestResult( VerifyLog10 (reportTestCases), tag, "log10 "); - nrOfFailedTestCases += ReportTestResult( VerifySine (reportTestCases), tag, "sin "); - nrOfFailedTestCases += ReportTestResult( VerifyCosine (reportTestCases), tag, "cos "); - nrOfFailedTestCases += ReportTestResult( VerifyTangent (reportTestCases), tag, "tan "); - nrOfFailedTestCases += ReportTestResult( VerifyAsin (reportTestCases), tag, "asin "); - nrOfFailedTestCases += ReportTestResult( VerifyAcos (reportTestCases), tag, "acos "); - nrOfFailedTestCases += ReportTestResult( VerifyAtan (reportTestCases), tag, "atan "); - nrOfFailedTestCases += ReportTestResult( VerifySinh (reportTestCases), tag, "sinh "); - nrOfFailedTestCases += ReportTestResult( VerifyCosh (reportTestCases), tag, "cosh "); - nrOfFailedTestCases += ReportTestResult( VerifyTanh (reportTestCases), tag, "tanh "); - nrOfFailedTestCases += ReportTestResult( VerifyAsinh (reportTestCases), tag, "asinh "); - nrOfFailedTestCases += ReportTestResult( VerifyAcosh (reportTestCases), tag, "acosh "); - nrOfFailedTestCases += ReportTestResult( VerifyAtanh (reportTestCases), tag, "atanh "); - - nrOfFailedTestCases += ReportTestResult( VerifyPowerFunction (reportTestCases), tag, "pow "); + nrOfFailedTestCases += ReportTestResult( VerifySqrt >(reportTestCases), tag, "sqrt (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyExp >(reportTestCases), tag, "exp "); + nrOfFailedTestCases += ReportTestResult( VerifyExp2 >(reportTestCases), tag, "exp2 "); + nrOfFailedTestCases += ReportTestResult( VerifyLog >(reportTestCases), tag, "log "); + nrOfFailedTestCases += ReportTestResult( VerifyLog2 >(reportTestCases), tag, "log2 "); + nrOfFailedTestCases += ReportTestResult( VerifyLog10 >(reportTestCases), tag, "log10 "); + nrOfFailedTestCases += ReportTestResult( VerifySine >(reportTestCases), tag, "sin "); + nrOfFailedTestCases += ReportTestResult( VerifyCosine >(reportTestCases), tag, "cos "); + nrOfFailedTestCases += ReportTestResult( VerifyTangent >(reportTestCases), tag, "tan "); + nrOfFailedTestCases += ReportTestResult( VerifyAsin >(reportTestCases), tag, "asin "); + nrOfFailedTestCases += ReportTestResult( VerifyAcos >(reportTestCases), tag, "acos "); + nrOfFailedTestCases += ReportTestResult( VerifyAtan >(reportTestCases), tag, "atan "); + nrOfFailedTestCases += ReportTestResult( VerifySinh >(reportTestCases), tag, "sinh "); + nrOfFailedTestCases += ReportTestResult( VerifyCosh >(reportTestCases), tag, "cosh "); + nrOfFailedTestCases += ReportTestResult( VerifyTanh >(reportTestCases), tag, "tanh "); + nrOfFailedTestCases += ReportTestResult( VerifyAsinh >(reportTestCases), tag, "asinh "); + nrOfFailedTestCases += ReportTestResult( VerifyAcosh >(reportTestCases), tag, "acosh "); + nrOfFailedTestCases += ReportTestResult( VerifyAtanh >(reportTestCases), tag, "atanh "); + + nrOfFailedTestCases += ReportTestResult( VerifyPowerFunction >(reportTestCases), tag, "pow "); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/posit/specialized/posit_16_2.cpp b/static/posit/specialized/posit_16_2.cpp index 566870596..a97c7f102 100644 --- a/static/posit/specialized/posit_16_2.cpp +++ b/static/posit/specialized/posit_16_2.cpp @@ -5,7 +5,6 @@ // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include -// // Configure the posit template environment // first: enable fast specialized posit<16,2> //#define POSIT_FAST_SPECIALIZATION @@ -13,12 +12,9 @@ // second: enable posit arithmetic exceptions #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 #include -#include -#include - -#ifdef EXHAUSTIVE #include -#endif +#include +#include // Standard posit with nbits = 16 have es = 2 exponent bit. @@ -114,10 +110,10 @@ try { goto epilog; // skip the exhaustive tests std::cout << "Exhaustive tests" << std::endl; - nrOfFailedTestCases += ReportTestResult(VerifyDivision (reportTestCases), tag, "div (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), tag, "mul (native) "); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction (reportTestCases), tag, "sub (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyAddition (reportTestCases), tag, "add (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyDivision >(reportTestCases), tag, "div (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), tag, "mul (native) "); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction >(reportTestCases), tag, "sub (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyAddition >(reportTestCases), tag, "add (native) "); epilog: ReportTestSuiteResults(test_suite, nrOfFailedTestCases); @@ -157,18 +153,18 @@ try { #if REGRESSION_LEVEL_2 // logic tests std::cout << "Logic operator tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicEqual (), tag, " == (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicNotEqual (), tag, " != (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicLessThan (), tag, " < (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicLessOrEqualThan (), tag, " <= (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicGreaterThan (), tag, " > (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicGreaterOrEqualThan(), tag, " >= (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicEqual >(reportTestCases), tag, " == (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicNotEqual >(reportTestCases), tag, " != (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicLessThan >(reportTestCases), tag, " < (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicLessOrEqualThan >(reportTestCases), tag, " <= (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicGreaterThan >(reportTestCases), tag, " > (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicGreaterOrEqualThan>(reportTestCases), tag, " >= (native) "); #endif #if REGRESSION_LEVEL_3 // conversion tests std::cout << "Assignment/conversion tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifyIntegerConversion (reportTestCases), tag, "integer assign (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyIntegerConversion >(reportTestCases), tag, "integer assign (native) "); // FAIL = 0.06251519627 did not convert to 0.06253051758 instead it yielded 0.0625 raw 0b0.01.00.00000000000 // FAIL = 0.9998789296 did not convert to 0.9997558594 instead it yielded 1 raw 0b0.10.00.00000000000 // posit< 16, 2> float assign(native) FAIL 2 failed test cases @@ -191,38 +187,38 @@ try { #if REGRESSION_LEVEL_4 // elementary function tests std::cout << "Elementary function tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifySqrt (reportTestCases), tag, "sqrt (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyExp (reportTestCases), tag, "exp "); - nrOfFailedTestCases += ReportTestResult( VerifyExp2 (reportTestCases), tag, "exp2 "); - nrOfFailedTestCases += ReportTestResult( VerifyLog (reportTestCases), tag, "log "); - nrOfFailedTestCases += ReportTestResult( VerifyLog2 (reportTestCases), tag, "log2 "); - nrOfFailedTestCases += ReportTestResult( VerifyLog10 (reportTestCases), tag, "log10 "); - nrOfFailedTestCases += ReportTestResult( VerifySine (reportTestCases), tag, "sin "); - nrOfFailedTestCases += ReportTestResult( VerifyCosine (reportTestCases), tag, "cos "); - nrOfFailedTestCases += ReportTestResult( VerifyTangent (reportTestCases), tag, "tan "); - nrOfFailedTestCases += ReportTestResult( VerifyAsin (reportTestCases), tag, "asin "); - nrOfFailedTestCases += ReportTestResult( VerifyAcos (reportTestCases), tag, "acos "); - nrOfFailedTestCases += ReportTestResult( VerifyAtan (reportTestCases), tag, "atan "); - nrOfFailedTestCases += ReportTestResult( VerifySinh (reportTestCases), tag, "sinh "); - nrOfFailedTestCases += ReportTestResult( VerifyCosh (reportTestCases), tag, "cosh "); - nrOfFailedTestCases += ReportTestResult( VerifyTanh (reportTestCases), tag, "tanh "); - nrOfFailedTestCases += ReportTestResult( VerifyAsinh (reportTestCases), tag, "asinh "); - nrOfFailedTestCases += ReportTestResult( VerifyAcosh (reportTestCases), tag, "acosh "); - nrOfFailedTestCases += ReportTestResult( VerifyAtanh (reportTestCases), tag, "atanh "); - - nrOfFailedTestCases += ReportTestResult( VerifyPowerFunction (reportTestCases), tag, "pow "); + nrOfFailedTestCases += ReportTestResult( VerifySqrt >(reportTestCases), tag, "sqrt (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyExp >(reportTestCases), tag, "exp "); + nrOfFailedTestCases += ReportTestResult( VerifyExp2 >(reportTestCases), tag, "exp2 "); + nrOfFailedTestCases += ReportTestResult( VerifyLog >(reportTestCases), tag, "log "); + nrOfFailedTestCases += ReportTestResult( VerifyLog2 >(reportTestCases), tag, "log2 "); + nrOfFailedTestCases += ReportTestResult( VerifyLog10 >(reportTestCases), tag, "log10 "); + nrOfFailedTestCases += ReportTestResult( VerifySine >(reportTestCases), tag, "sin "); + nrOfFailedTestCases += ReportTestResult( VerifyCosine >(reportTestCases), tag, "cos "); + nrOfFailedTestCases += ReportTestResult( VerifyTangent >(reportTestCases), tag, "tan "); + nrOfFailedTestCases += ReportTestResult( VerifyAsin >(reportTestCases), tag, "asin "); + nrOfFailedTestCases += ReportTestResult( VerifyAcos >(reportTestCases), tag, "acos "); + nrOfFailedTestCases += ReportTestResult( VerifyAtan >(reportTestCases), tag, "atan "); + nrOfFailedTestCases += ReportTestResult( VerifySinh >(reportTestCases), tag, "sinh "); + nrOfFailedTestCases += ReportTestResult( VerifyCosh >(reportTestCases), tag, "cosh "); + nrOfFailedTestCases += ReportTestResult( VerifyTanh >(reportTestCases), tag, "tanh "); + nrOfFailedTestCases += ReportTestResult( VerifyAsinh >(reportTestCases), tag, "asinh "); + nrOfFailedTestCases += ReportTestResult( VerifyAcosh >(reportTestCases), tag, "acosh "); + nrOfFailedTestCases += ReportTestResult( VerifyAtanh >(reportTestCases), tag, "atanh "); + + nrOfFailedTestCases += ReportTestResult( VerifyPowerFunction >(reportTestCases), tag, "pow "); #endif #ifdef EXHAUSTIVE // arithmetic tests std::cout << "Arithmetic tests\n"; - nrOfFailedTestCases += ReportTestResult(VerifyAddition (reportTestCases), tag, "add (native) "); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction (reportTestCases), tag, "subtract (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication (reportTestCases), tag, "multiply (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyDivision (reportTestCases), tag, "divide (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyNegation (reportTestCases), tag, "negate (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation (reportTestCases), tag, "reciprocate (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyAddition >(reportTestCases), tag, "add (native) "); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction >(reportTestCases), tag, "subtract (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication >(reportTestCases), tag, "multiply (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyDivision >(reportTestCases), tag, "divide (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyNegation >(reportTestCases), tag, "negate (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation >(reportTestCases), tag, "reciprocate (native) "); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/posit/specialized/posit_256_2.cpp b/static/posit/specialized/posit_256_2.cpp index 84a8dc18f..66c02ea1d 100644 --- a/static/posit/specialized/posit_256_2.cpp +++ b/static/posit/specialized/posit_256_2.cpp @@ -13,7 +13,7 @@ #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 #include #include -#include +#include // Standard posits with nbits = 256 have 2 exponent bits. diff --git a/static/posit/specialized/posit_256_5.cpp b/static/posit/specialized/posit_256_5.cpp index 61f31823c..01d1686da 100644 --- a/static/posit/specialized/posit_256_5.cpp +++ b/static/posit/specialized/posit_256_5.cpp @@ -13,7 +13,7 @@ #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 #include #include -#include +#include // Standard posits with nbits = 256 have 5 exponent bits. diff --git a/static/posit/specialized/posit_2_0.cpp b/static/posit/specialized/posit_2_0.cpp index 7ea86dada..a27e31cbf 100644 --- a/static/posit/specialized/posit_2_0.cpp +++ b/static/posit/specialized/posit_2_0.cpp @@ -1,6 +1,6 @@ // posit_2_0.cpp: test suite runner for specialized 2-bit posits based on look-up tables // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -27,7 +27,7 @@ try { constexpr size_t es = 0; int nrOfFailedTestCases = 0; - bool bReportIndividualTestCases = true; + bool reportTestCases = true; std::string tag = " posit<2,0>"; #if defined(POSIT_FAST_POSIT_2_0) @@ -61,28 +61,28 @@ try { test = "is positive"; nrOfFailedTestCases += ReportCheck(tag, test, p.ispos()); - // logic tests - std::cout << "Logic operator tests\n"; - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual (), tag, " == "); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual (), tag, " != "); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan (), tag, " < "); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan (), tag, " <= "); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan (), tag, " > "); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan(), tag, " >= "); - // conversion tests std::cout << "Assignment/conversion tests\n"; - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion(bReportIndividualTestCases), tag, "integer assign "); - nrOfFailedTestCases += ReportTestResult(VerifyConversion (bReportIndividualTestCases), tag, "float assign "); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), tag, "integer assign "); + nrOfFailedTestCases += ReportTestResult(VerifyConversion , float>(reportTestCases), tag, "float assign "); + + // logic tests + std::cout << "Logic operator tests\n"; + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual >(reportTestCases), tag, " == "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual >(reportTestCases), tag, " != "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan >(reportTestCases), tag, " < "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan >(reportTestCases), tag, " <= "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan >(reportTestCases), tag, " > "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), tag, " >= "); // arithmetic tests std::cout << "Arithmetic tests\n"; - nrOfFailedTestCases += ReportTestResult(VerifyAddition (bReportIndividualTestCases), tag, "add "); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction (bReportIndividualTestCases), tag, "subtract "); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication (bReportIndividualTestCases), tag, "multiply "); - nrOfFailedTestCases += ReportTestResult(VerifyDivision (bReportIndividualTestCases), tag, "divide "); - nrOfFailedTestCases += ReportTestResult(VerifyNegation (bReportIndividualTestCases), tag, "negate "); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation (bReportIndividualTestCases), tag, "reciprocate "); + nrOfFailedTestCases += ReportTestResult(VerifyAddition >(reportTestCases), tag, "add "); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction >(reportTestCases), tag, "subtract "); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication >(reportTestCases), tag, "multiply "); + nrOfFailedTestCases += ReportTestResult(VerifyDivision >(reportTestCases), tag, "divide "); + nrOfFailedTestCases += ReportTestResult(VerifyNegation >(reportTestCases), tag, "negate "); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation >(reportTestCases), tag, "reciprocate "); return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); } diff --git a/static/posit/specialized/posit_32_2.cpp b/static/posit/specialized/posit_32_2.cpp index ea30e6300..84083b577 100644 --- a/static/posit/specialized/posit_32_2.cpp +++ b/static/posit/specialized/posit_32_2.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include // Standard posit with nbits = 32 have es = 2 exponent bits. @@ -128,19 +128,19 @@ try { #if REGRESSION_LEVEL_2 // logic tests std::cout << "Logic operator tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicEqual (), tag, " == (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicNotEqual (), tag, " != (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicLessThan (), tag, " < (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicLessOrEqualThan (), tag, " <= (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicGreaterThan (), tag, " > (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicGreaterOrEqualThan(), tag, " >= (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicEqual >(reportTestCases), tag, " == (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicNotEqual >(reportTestCases), tag, " != (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicLessThan >(reportTestCases), tag, " < (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicLessOrEqualThan >(reportTestCases), tag, " <= (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicGreaterThan >(reportTestCases), tag, " > (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicGreaterOrEqualThan>(reportTestCases), tag, " >= (native) "); // conversion tests // internally this generators are clamped as the state space 2^33 is too big std::cout << "Assignment/conversion tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifyIntegerConversion (reportTestCases), tag, "sint32 assign (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyUintConversion (reportTestCases), tag, "uint32 assign (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyConversion (reportTestCases), tag, "float assign (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyIntegerConversion >(reportTestCases), tag, "sint32 assign (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyUintConversion >(reportTestCases), tag, "uint32 assign (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyConversion , float>(reportTestCases), tag, "float assign (native) "); // nrOfFailedTestCases += ReportTestResult( VerifyConversionThroughRandoms (tag, true, 100), tag, "float assign "); #endif diff --git a/static/posit/specialized/posit_3_0.cpp b/static/posit/specialized/posit_3_0.cpp index a8946660c..22a4c07c3 100644 --- a/static/posit/specialized/posit_3_0.cpp +++ b/static/posit/specialized/posit_3_0.cpp @@ -1,6 +1,6 @@ // posit_3_0.cpp: test suite runner for specialized 3-bit posits based on look-up tables // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -25,7 +25,7 @@ try { constexpr size_t es = 0; int nrOfFailedTestCases = 0; - bool bReportIndividualTestCases = false; + bool reportTestCases = false; std::string tag = " posit<3,0>"; #if defined(POSIT_FAST_POSIT_3_0) @@ -59,28 +59,28 @@ try { test = "is positive"; nrOfFailedTestCases += ReportCheck(tag, test, p.ispos()); + // conversion tests + std::cout << "Assignment/conversion tests\n"; + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), tag, "integer assign "); + nrOfFailedTestCases += ReportTestResult(VerifyConversion , float>(reportTestCases), tag, "float assign "); + // logic tests std::cout << "Logic operator tests\n"; - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual (), tag, " == "); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual (), tag, " != "); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan (), tag, " < "); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan (), tag, " <= "); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan (), tag, " > "); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan(), tag, " >= "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual >(reportTestCases), tag, " == "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual >(reportTestCases), tag, " != "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan >(reportTestCases), tag, " < "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan >(reportTestCases), tag, " <= "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan >(reportTestCases), tag, " > "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), tag, " >= "); - // conversion tests - std::cout << "Assignment/conversion tests\n"; - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion(bReportIndividualTestCases), tag, "integer assign "); - nrOfFailedTestCases += ReportTestResult(VerifyConversion (bReportIndividualTestCases), tag, "float assign "); - // arithmetic tests std::cout << "Arithmetic tests\n"; - nrOfFailedTestCases += ReportTestResult(VerifyAddition (bReportIndividualTestCases), tag, "add "); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction (bReportIndividualTestCases), tag, "subtract "); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication (bReportIndividualTestCases), tag, "multiply "); - nrOfFailedTestCases += ReportTestResult(VerifyDivision (bReportIndividualTestCases), tag, "divide "); - nrOfFailedTestCases += ReportTestResult(VerifyNegation (bReportIndividualTestCases), tag, "negate "); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation (bReportIndividualTestCases), tag, "reciprocate "); + nrOfFailedTestCases += ReportTestResult(VerifyAddition >(reportTestCases), tag, "add "); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction >(reportTestCases), tag, "subtract "); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication >(reportTestCases), tag, "multiply "); + nrOfFailedTestCases += ReportTestResult(VerifyDivision >(reportTestCases), tag, "divide "); + nrOfFailedTestCases += ReportTestResult(VerifyNegation >(reportTestCases), tag, "negate "); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation >(reportTestCases), tag, "reciprocate "); return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); } diff --git a/static/posit/specialized/posit_48_2.cpp b/static/posit/specialized/posit_48_2.cpp index 85454353d..ea923f96e 100644 --- a/static/posit/specialized/posit_48_2.cpp +++ b/static/posit/specialized/posit_48_2.cpp @@ -12,7 +12,7 @@ #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 #include #include -#include +#include // Extended Standard posit with nbits = 48 have es = 2 exponent bits. diff --git a/static/posit/specialized/posit_4_0.cpp b/static/posit/specialized/posit_4_0.cpp index d1f75f243..6738ccd8b 100644 --- a/static/posit/specialized/posit_4_0.cpp +++ b/static/posit/specialized/posit_4_0.cpp @@ -1,6 +1,6 @@ // posit_4_0.cpp: test suite runner for specialized 4-bit posits based on look-up tables // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -27,7 +27,7 @@ try { constexpr size_t es = 0; int nrOfFailedTestCases = 0; - bool bReportIndividualTestCases = true; + bool reportTestCases = true; std::string tag = " posit<4,0>"; #if defined(POSIT_FAST_POSIT_4_0) @@ -61,32 +61,53 @@ try { test = "is positive"; nrOfFailedTestCases += ReportCheck(tag, test, p.ispos()); - // logic tests - std::cout << "Logic operator tests\n"; - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicEqual (), tag, " == "); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicNotEqual (), tag, " != "); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessThan (), tag, " < "); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicLessOrEqualThan (), tag, " <= "); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterThan (), tag, " > "); - nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan(), tag, " >= "); - + /* + Posit Lookup table for a POSIT<4, 0> in TXT format + # Binary Decoded k sign scale value + 0 : 0000 0000 -3 0 -2 0 + 1 : 0001 0001 -2 0 -2 0.25 + 2 : 0010 0010 -1 0 -1 0.5 + 3 : 0011 0011 -1 0 -1 0.75 + 4 : 0100 0100 0 0 0 1 + 5 : 0101 0101 0 0 0 1.5 + 6 : 0110 0110 1 0 1 2 + 7 : 0111 0111 2 0 2 4 + 8 : 1000 1000 3 1 -2 nar + 9 : 1001 1111 2 1 2 -4 + 10 : 1010 1110 1 1 1 -2 + 11 : 1011 1101 0 1 0 -1.5 + 12 : 1100 1100 0 1 0 -1 + 13 : 1101 1011 -1 1 -1 -0.75 + 14 : 1110 1010 -1 1 -1 -0.5 + 15 : 1111 1001 -2 1 -2 -0.25 + */ + // conversion tests std::cout << "Assignment/conversion tests\n"; - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion(bReportIndividualTestCases), tag, "integer assign "); - nrOfFailedTestCases += ReportTestResult(VerifyConversion (bReportIndividualTestCases), tag, "float assign "); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), tag, "integer assign "); + nrOfFailedTestCases += ReportTestResult(VerifyConversion , float>(reportTestCases), tag, "float assign "); + + // logic tests + std::cout << "Logic operator tests\n"; + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual >(reportTestCases), tag, " == "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual >(reportTestCases), tag, " != "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan >(reportTestCases), tag, " < "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan >(reportTestCases), tag, " <= "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan >(reportTestCases), tag, " > "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), tag, " >= "); // arithmetic tests std::cout << "Arithmetic tests\n"; - nrOfFailedTestCases += ReportTestResult(VerifyAddition (bReportIndividualTestCases), tag, "add "); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction (bReportIndividualTestCases), tag, "subtract "); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication (bReportIndividualTestCases), tag, "multiply "); - nrOfFailedTestCases += ReportTestResult(VerifyDivision (bReportIndividualTestCases), tag, "divide "); - nrOfFailedTestCases += ReportTestResult(VerifyNegation (bReportIndividualTestCases), tag, "negate "); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation (bReportIndividualTestCases), tag, "reciprocate "); + nrOfFailedTestCases += ReportTestResult(VerifyAddition >(reportTestCases), tag, "add "); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction >(reportTestCases), tag, "subtract "); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication >(reportTestCases), tag, "multiply "); + nrOfFailedTestCases += ReportTestResult(VerifyDivision >(reportTestCases), tag, "divide "); + nrOfFailedTestCases += ReportTestResult(VerifyNegation >(reportTestCases), tag, "negate "); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation >(reportTestCases), tag, "reciprocate "); // elementary function tests std::cout << "Elementary function tests\n"; - nrOfFailedTestCases += ReportTestResult(VerifySqrt (bReportIndividualTestCases), tag, "sqrt "); + nrOfFailedTestCases += ReportTestResult(VerifySqrt >(reportTestCases), tag, "sqrt "); return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); } diff --git a/static/posit/specialized/posit_64_2.cpp b/static/posit/specialized/posit_64_2.cpp index 9ad5f0bc2..8f593aa25 100644 --- a/static/posit/specialized/posit_64_2.cpp +++ b/static/posit/specialized/posit_64_2.cpp @@ -12,7 +12,7 @@ #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 #include #include -#include +#include // Standard posit with nbits = 64 have es = 2 exponent bits. diff --git a/static/posit/specialized/posit_64_3.cpp b/static/posit/specialized/posit_64_3.cpp index 45ecce2aa..aa5869484 100644 --- a/static/posit/specialized/posit_64_3.cpp +++ b/static/posit/specialized/posit_64_3.cpp @@ -12,7 +12,7 @@ #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 #include #include -#include +#include // Standard posit with nbits = 64 have es = 3 exponent bits. diff --git a/static/posit/specialized/posit_8_0.cpp b/static/posit/specialized/posit_8_0.cpp index 8c73787dd..178f5e4c5 100644 --- a/static/posit/specialized/posit_8_0.cpp +++ b/static/posit/specialized/posit_8_0.cpp @@ -1,6 +1,6 @@ // posit_8_0.cpp: test suite runner for fast specialized posit<8,0> // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -12,7 +12,7 @@ #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 #include #include -#include +#include // Standard posits with nbits = 8 have no exponent bits, i.e. es = 0. // @@ -38,7 +38,7 @@ try { constexpr size_t es = 0; int nrOfFailedTestCases = 0; - bool bReportIndividualTestCases = false; + bool reportTestCases = false; #if POSIT_FAST_POSIT_8_0 std::cout << "Fast specialization posit<8,0> configuration tests\n"; @@ -94,66 +94,67 @@ try { test = "is positive"; nrOfFailedTestCases += ReportCheck(tag, test, p.ispos()); - nrOfFailedTestCases += ReportTestResult(VerifyAddition (bReportIndividualTestCases), tag, "add (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication (bReportIndividualTestCases), tag, "multiply (native) "); - nrOfFailedTestCases += ReportTestResult(VerifyDivision (bReportIndividualTestCases), tag, "divide (native) "); + // conversion tests + std::cout << "Assignment/conversion tests\n"; + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), tag, "integer assign (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyConversion , float>(reportTestCases), tag, "float assign (native) "); + + nrOfFailedTestCases += ReportTestResult(VerifyAddition >(reportTestCases), tag, "add (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication >(reportTestCases), tag, "multiply (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyDivision >(reportTestCases), tag, "divide (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation >(reportTestCases), tag, "reciprocate (native) "); #endif #if REGRESSION_LEVEL_2 // logic tests std::cout << "Logic operator tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicEqual (), tag, " == (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicNotEqual (), tag, " != (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicLessThan (), tag, " < (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicLessOrEqualThan (), tag, " <= (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicGreaterThan (), tag, " > (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicGreaterOrEqualThan(), tag, " >= (native) "); - - // conversion tests - std::cout << "Assignment/conversion tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifyIntegerConversion(bReportIndividualTestCases), tag, "integer assign (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyConversion (bReportIndividualTestCases), tag, "float assign (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicEqual >(reportTestCases), tag, " == (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicNotEqual >(reportTestCases), tag, " != (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicLessThan >(reportTestCases), tag, " < (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicLessOrEqualThan >(reportTestCases), tag, " <= (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicGreaterThan >(reportTestCases), tag, " > (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicGreaterOrEqualThan>(reportTestCases), tag, " >= (native) "); #endif #if REGRESSION_LEVEL_3 // arithmetic tests std::cout << "Arithmetic tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifyAddition (bReportIndividualTestCases), tag, "add (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyInPlaceAddition (bReportIndividualTestCases), tag, "+= (native) "); - nrOfFailedTestCases += ReportTestResult( VerifySubtraction (bReportIndividualTestCases), tag, "subtract (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyInPlaceSubtraction (bReportIndividualTestCases), tag, "-= (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyMultiplication (bReportIndividualTestCases), tag, "multiply (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyInPlaceMultiplication (bReportIndividualTestCases), tag, "*= (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyDivision (bReportIndividualTestCases), tag, "divide (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyInPlaceDivision (bReportIndividualTestCases), tag, "/= (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyNegation (bReportIndividualTestCases), tag, "negate (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyReciprocation (bReportIndividualTestCases), tag, "reciprocate (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyAddition >(reportTestCases), tag, "add (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyInPlaceAddition >(reportTestCases), tag, "+= (native) "); + nrOfFailedTestCases += ReportTestResult( VerifySubtraction >(reportTestCases), tag, "subtract (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyInPlaceSubtraction >(reportTestCases), tag, "-= (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyMultiplication >(reportTestCases), tag, "multiply (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyInPlaceMultiplication >(reportTestCases), tag, "*= (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyDivision >(reportTestCases), tag, "divide (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyInPlaceDivision >(reportTestCases), tag, "/= (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyNegation >(reportTestCases), tag, "negate (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyReciprocation >(reportTestCases), tag, "reciprocate (native) "); #endif #if REGRESSION_LEVEL_4 // elementary function tests std::cout << "Elementary function tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifySqrt (bReportIndividualTestCases), tag, "sqrt (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyExp (bReportIndividualTestCases), tag, "exp "); - nrOfFailedTestCases += ReportTestResult( VerifyExp2 (bReportIndividualTestCases), tag, "exp2 "); - nrOfFailedTestCases += ReportTestResult( VerifyLog (bReportIndividualTestCases), tag, "log "); - nrOfFailedTestCases += ReportTestResult( VerifyLog2 (bReportIndividualTestCases), tag, "log2 "); - nrOfFailedTestCases += ReportTestResult( VerifyLog10 (bReportIndividualTestCases), tag, "log10 "); - nrOfFailedTestCases += ReportTestResult( VerifySine (bReportIndividualTestCases), tag, "sin "); - nrOfFailedTestCases += ReportTestResult( VerifyCosine (bReportIndividualTestCases), tag, "cos "); - nrOfFailedTestCases += ReportTestResult( VerifyTangent (bReportIndividualTestCases), tag, "tan "); - nrOfFailedTestCases += ReportTestResult( VerifyAtan (bReportIndividualTestCases), tag, "atan "); - nrOfFailedTestCases += ReportTestResult( VerifyAsin (bReportIndividualTestCases), tag, "asin "); - nrOfFailedTestCases += ReportTestResult( VerifyAcos (bReportIndividualTestCases), tag, "acos "); - nrOfFailedTestCases += ReportTestResult( VerifySinh (bReportIndividualTestCases), tag, "sinh "); - nrOfFailedTestCases += ReportTestResult( VerifyCosh (bReportIndividualTestCases), tag, "cosh "); - nrOfFailedTestCases += ReportTestResult( VerifyTanh (bReportIndividualTestCases), tag, "tanh "); - nrOfFailedTestCases += ReportTestResult( VerifyAtanh (bReportIndividualTestCases), tag, "atanh "); - nrOfFailedTestCases += ReportTestResult( VerifyAcosh (bReportIndividualTestCases), tag, "acosh "); - nrOfFailedTestCases += ReportTestResult( VerifyAsinh (bReportIndividualTestCases), tag, "asinh "); - - nrOfFailedTestCases += ReportTestResult( VerifyPowerFunction (bReportIndividualTestCases), tag, "pow "); + nrOfFailedTestCases += ReportTestResult( VerifySqrt >(reportTestCases), tag, "sqrt (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyExp >(reportTestCases), tag, "exp "); + nrOfFailedTestCases += ReportTestResult( VerifyExp2 >(reportTestCases), tag, "exp2 "); + nrOfFailedTestCases += ReportTestResult( VerifyLog >(reportTestCases), tag, "log "); + nrOfFailedTestCases += ReportTestResult( VerifyLog2 >(reportTestCases), tag, "log2 "); + nrOfFailedTestCases += ReportTestResult( VerifyLog10 >(reportTestCases), tag, "log10 "); + nrOfFailedTestCases += ReportTestResult( VerifySine >(reportTestCases), tag, "sin "); + nrOfFailedTestCases += ReportTestResult( VerifyCosine >(reportTestCases), tag, "cos "); + nrOfFailedTestCases += ReportTestResult( VerifyTangent >(reportTestCases), tag, "tan "); + nrOfFailedTestCases += ReportTestResult( VerifyAtan >(reportTestCases), tag, "atan "); + nrOfFailedTestCases += ReportTestResult( VerifyAsin >(reportTestCases), tag, "asin "); + nrOfFailedTestCases += ReportTestResult( VerifyAcos >(reportTestCases), tag, "acos "); + nrOfFailedTestCases += ReportTestResult( VerifySinh >(reportTestCases), tag, "sinh "); + nrOfFailedTestCases += ReportTestResult( VerifyCosh >(reportTestCases), tag, "cosh "); + nrOfFailedTestCases += ReportTestResult( VerifyTanh >(reportTestCases), tag, "tanh "); + nrOfFailedTestCases += ReportTestResult( VerifyAtanh >(reportTestCases), tag, "atanh "); + nrOfFailedTestCases += ReportTestResult( VerifyAcosh >(reportTestCases), tag, "acosh "); + nrOfFailedTestCases += ReportTestResult( VerifyAsinh >(reportTestCases), tag, "asinh "); + + nrOfFailedTestCases += ReportTestResult( VerifyPowerFunction >(reportTestCases), tag, "pow "); #endif #endif diff --git a/static/posit/specialized/posit_8_1.cpp b/static/posit/specialized/posit_8_1.cpp index b6af3acbf..db71ad12f 100644 --- a/static/posit/specialized/posit_8_1.cpp +++ b/static/posit/specialized/posit_8_1.cpp @@ -1,6 +1,6 @@ // posit_8_1.cpp: test suite runner for fast specialized posit<8,1> // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -12,7 +12,7 @@ #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 #include #include -#include +#include /* specialized small 8-bit posit with es = 1 to increase dynamic range over standard posit<8,0>. @@ -52,10 +52,10 @@ try { // no randoms, 8-bit posits can be done exhaustively constexpr size_t nbits = 8; - constexpr size_t es = 1; + constexpr size_t es = 1; int nrOfFailedTestCases = 0; - bool bReportIndividualTestCases = false; + bool reportTestCases = false; std::string tag = " posit<8,1>"; #if POSIT_FAST_POSIT_8_1 @@ -89,51 +89,51 @@ try { test = "is positive"; nrOfFailedTestCases += ReportCheck(tag, test, p.ispos()); - // logic tests - std::cout << "Logic operator tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicEqual (), tag, " == (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicNotEqual (), tag, " != (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicLessThan (), tag, " < (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicLessOrEqualThan (), tag, " <= (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicGreaterThan (), tag, " > (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicGreaterOrEqualThan(), tag, " >= (native) "); - // conversion tests std::cout << "Assignment/conversion tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifyIntegerConversion(bReportIndividualTestCases), tag, "integer assign (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyConversion (bReportIndividualTestCases), tag, "float assign (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), tag, "integer assign (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyConversion , float>(reportTestCases), tag, "float assign (native) "); + + // logic tests + std::cout << "Logic operator tests\n"; + nrOfFailedTestCases += ReportTestResult( VerifyLogicEqual >(reportTestCases), tag, " == (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicNotEqual >(reportTestCases), tag, " != (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicLessThan >(reportTestCases), tag, " < (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicLessOrEqualThan >(reportTestCases), tag, " <= (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicGreaterThan >(reportTestCases), tag, " > (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicGreaterOrEqualThan>(reportTestCases), tag, " >= (native) "); // arithmetic tests std::cout << "Arithmetic tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifyAddition (bReportIndividualTestCases), tag, "add (native) "); - nrOfFailedTestCases += ReportTestResult( VerifySubtraction (bReportIndividualTestCases), tag, "subtract (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyMultiplication (bReportIndividualTestCases), tag, "multiply (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyDivision (bReportIndividualTestCases), tag, "divide (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyNegation (bReportIndividualTestCases), tag, "negate (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyReciprocation (bReportIndividualTestCases), tag, "reciprocate (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyAddition >(reportTestCases), tag, "add (native) "); + nrOfFailedTestCases += ReportTestResult( VerifySubtraction >(reportTestCases), tag, "subtract (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyMultiplication >(reportTestCases), tag, "multiply (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyDivision >(reportTestCases), tag, "divide (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyNegation >(reportTestCases), tag, "negate (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyReciprocation >(reportTestCases), tag, "reciprocate (native) "); // elementary function tests std::cout << "Elementary function tests\n"; -// nrOfFailedTestCases += ReportTestResult( VerifySqrt (bReportIndividualTestCases), tag, "sqrt (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyExp (bReportIndividualTestCases), tag, "exp "); - nrOfFailedTestCases += ReportTestResult( VerifyExp2 (bReportIndividualTestCases), tag, "exp2 "); - nrOfFailedTestCases += ReportTestResult( VerifyLog (bReportIndividualTestCases), tag, "log "); - nrOfFailedTestCases += ReportTestResult( VerifyLog2 (bReportIndividualTestCases), tag, "log2 "); - nrOfFailedTestCases += ReportTestResult( VerifyLog10 (bReportIndividualTestCases), tag, "log10 "); - nrOfFailedTestCases += ReportTestResult( VerifySine (bReportIndividualTestCases), tag, "sin "); - nrOfFailedTestCases += ReportTestResult( VerifyCosine (bReportIndividualTestCases), tag, "cos "); - nrOfFailedTestCases += ReportTestResult( VerifyTangent (bReportIndividualTestCases), tag, "tan "); - nrOfFailedTestCases += ReportTestResult( VerifyAtan (bReportIndividualTestCases), tag, "atan "); - nrOfFailedTestCases += ReportTestResult( VerifyAsin (bReportIndividualTestCases), tag, "asin "); - nrOfFailedTestCases += ReportTestResult( VerifyAcos (bReportIndividualTestCases), tag, "acos "); - nrOfFailedTestCases += ReportTestResult( VerifySinh (bReportIndividualTestCases), tag, "sinh "); - nrOfFailedTestCases += ReportTestResult( VerifyCosh (bReportIndividualTestCases), tag, "cosh "); - nrOfFailedTestCases += ReportTestResult( VerifyTanh (bReportIndividualTestCases), tag, "tanh "); - nrOfFailedTestCases += ReportTestResult( VerifyAtanh (bReportIndividualTestCases), tag, "atanh "); - nrOfFailedTestCases += ReportTestResult( VerifyAcosh (bReportIndividualTestCases), tag, "acosh "); - nrOfFailedTestCases += ReportTestResult( VerifyAsinh (bReportIndividualTestCases), tag, "asinh "); - - nrOfFailedTestCases += ReportTestResult( VerifyPowerFunction (bReportIndividualTestCases), tag, "pow "); +// nrOfFailedTestCases += ReportTestResult( VerifySqrt >(reportTestCases), tag, "sqrt (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyExp >(reportTestCases), tag, "exp "); + nrOfFailedTestCases += ReportTestResult( VerifyExp2 >(reportTestCases), tag, "exp2 "); + nrOfFailedTestCases += ReportTestResult( VerifyLog >(reportTestCases), tag, "log "); + nrOfFailedTestCases += ReportTestResult( VerifyLog2 >(reportTestCases), tag, "log2 "); + nrOfFailedTestCases += ReportTestResult( VerifyLog10 >(reportTestCases), tag, "log10 "); + nrOfFailedTestCases += ReportTestResult( VerifySine >(reportTestCases), tag, "sin "); + nrOfFailedTestCases += ReportTestResult( VerifyCosine >(reportTestCases), tag, "cos "); + nrOfFailedTestCases += ReportTestResult( VerifyTangent >(reportTestCases), tag, "tan "); + nrOfFailedTestCases += ReportTestResult( VerifyAtan >(reportTestCases), tag, "atan "); + nrOfFailedTestCases += ReportTestResult( VerifyAsin >(reportTestCases), tag, "asin "); + nrOfFailedTestCases += ReportTestResult( VerifyAcos >(reportTestCases), tag, "acos "); + nrOfFailedTestCases += ReportTestResult( VerifySinh >(reportTestCases), tag, "sinh "); + nrOfFailedTestCases += ReportTestResult( VerifyCosh >(reportTestCases), tag, "cosh "); + nrOfFailedTestCases += ReportTestResult( VerifyTanh >(reportTestCases), tag, "tanh "); + nrOfFailedTestCases += ReportTestResult( VerifyAtanh >(reportTestCases), tag, "atanh "); + nrOfFailedTestCases += ReportTestResult( VerifyAcosh >(reportTestCases), tag, "acosh "); + nrOfFailedTestCases += ReportTestResult( VerifyAsinh >(reportTestCases), tag, "asinh "); + + nrOfFailedTestCases += ReportTestResult( VerifyPowerFunction >(reportTestCases), tag, "pow "); return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); } diff --git a/static/posit/specialized/posit_8_2.cpp b/static/posit/specialized/posit_8_2.cpp index 3705a26ed..ac5b1d7b3 100644 --- a/static/posit/specialized/posit_8_2.cpp +++ b/static/posit/specialized/posit_8_2.cpp @@ -12,7 +12,7 @@ #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 #include #include -#include +#include /* specialized small standard 8-bit posit with es = 2 @@ -34,17 +34,6 @@ specialized small standard 8-bit posit with es = 2 #define REGRESSION_LEVEL_4 1 #endif -void GenerateValues() { - using namespace sw::universal; - constexpr unsigned int NR_POSITS = 256; - - posit<8, 1> a; - for (unsigned int i = 0; i < NR_POSITS; ++i) { - a.setbits(i); - std::cout << std::hex << i << " " << std::dec << a << '\n'; - } -} - int main() try { using namespace sw::universal; @@ -66,9 +55,41 @@ try { ReportTestSuiteHeader(test_suite, reportTestCases); - posit p; + using Scalar = posit; + Scalar p; std::cout << dynamic_range(p) << "\n\n"; + std::string tag = type_tag(p); + +#if MANUAL_TESTING + + // conversion tests + std::cout << "Assignment/conversion tests\n"; + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), test_tag, "integer assign (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyConversion , float>(reportTestCases), test_tag, "float assign (native) "); + + // logic tests + std::cout << "Logic operator tests\n"; + nrOfFailedTestCases += ReportTestResult(VerifyLogicEqual >(reportTestCases), test_tag, " == (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicNotEqual >(reportTestCases), test_tag, " != (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessThan >(reportTestCases), test_tag, " < (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicLessOrEqualThan >(reportTestCases), test_tag, " <= (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterThan >(reportTestCases), test_tag, " > (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyLogicGreaterOrEqualThan>(reportTestCases), test_tag, " >= (native) "); + // arithmetic tests + std::cout << "Arithmetic tests\n"; + nrOfFailedTestCases += ReportTestResult(VerifyAddition >(reportTestCases), test_tag, "add (native) "); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction >(reportTestCases), test_tag, "subtract (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication >(reportTestCases), test_tag, "multiply (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyDivision >(reportTestCases), test_tag, "divide (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyNegation >(reportTestCases), test_tag, "negate (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation >(reportTestCases), test_tag, "reciprocate (native) "); + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; // ignore failures +#else + +#if REGRESSION_LEVEL_1 // special cases std::cout << "Special case tests\n"; std::string test = "Initialize to zero: "; @@ -91,77 +112,68 @@ try { test = "is positive"; nrOfFailedTestCases += ReportCheck(test_tag, test, p.ispos()); - p.setbits(0x64); - std::cout << std::setw(4) << 0x64 << " : " << color_print(p) << " : " << p << '\n'; - p.setbits(0x65); - std::cout << std::setw(4) << 0x65 << " : " << color_print(p) << " : " << p << '\n'; - p.setbits(0x66); - std::cout << std::setw(4) << 0x66 << " : " << color_print(p) << " : " << p << '\n'; - - // 124: 01111100 01111100 4 0 16 111110- 0- --- 65536 8.2x7Cp - // 125: 01111101 01111101 4 0 18 111110 - 1 - -- - 262144 - p.setbits(0x7C); - std::cout << std::setw(4) << 0x7C << " : " << color_print(p) << " : " << p << '\n'; - p.setbits(0x7D); - std::cout << std::setw(4) << 0x7D << " : " << color_print(p) << " : " << p << '\n'; - -// goto epilog; - - for (unsigned i = 0; i < 128; ++i) { - p.setbits(i); - std::cout << std::setw(4) << i << " : " << color_print(p) << " : " << p << '\n'; - } - - goto epilog; + // conversion tests + std::cout << "Assignment/conversion tests\n"; + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion>(reportTestCases), test_tag, "integer assign (native) "); + nrOfFailedTestCases += ReportTestResult(VerifyConversion >(reportTestCases), test_tag, "float assign (native) "); // logic tests std::cout << "Logic operator tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicEqual (), test_tag, " == (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicNotEqual (), test_tag, " != (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicLessThan (), test_tag, " < (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicLessOrEqualThan (), test_tag, " <= (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicGreaterThan (), test_tag, " > (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyPositLogicGreaterOrEqualThan(), test_tag, " >= (native) "); - - // conversion tests - std::cout << "Assignment/conversion tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifyIntegerConversion(reportTestCases), test_tag, "integer assign (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyConversion (reportTestCases), test_tag, "float assign (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicEqual >(reportTestCases), test_tag, " == (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicNotEqual >(reportTestCases), test_tag, " != (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicLessThan >(reportTestCases), test_tag, " < (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicLessOrEqualThan >(reportTestCases), test_tag, " <= (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicGreaterThan >(reportTestCases), test_tag, " > (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyLogicGreaterOrEqualThan>(reportTestCases), test_tag, " >= (native) "); // arithmetic tests std::cout << "Arithmetic tests\n"; - nrOfFailedTestCases += ReportTestResult( VerifyAddition (reportTestCases), test_tag, "add (native) "); - nrOfFailedTestCases += ReportTestResult( VerifySubtraction (reportTestCases), test_tag, "subtract (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyMultiplication (reportTestCases), test_tag, "multiply (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyDivision (reportTestCases), test_tag, "divide (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyNegation (reportTestCases), test_tag, "negate (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyReciprocation (reportTestCases), test_tag, "reciprocate (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyAddition >(reportTestCases), test_tag, "add (native) "); + nrOfFailedTestCases += ReportTestResult( VerifySubtraction >(reportTestCases), test_tag, "subtract (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyMultiplication >(reportTestCases), test_tag, "multiply (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyDivision >(reportTestCases), test_tag, "divide (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyNegation >(reportTestCases), test_tag, "negate (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyReciprocation >(reportTestCases), test_tag, "reciprocate (native) "); // elementary function tests std::cout << "Elementary function tests\n"; -// nrOfFailedTestCases += ReportTestResult( VerifySqrt (reportTestCases), test_tag, "sqrt (native) "); - nrOfFailedTestCases += ReportTestResult( VerifyExp (reportTestCases), test_tag, "exp "); - nrOfFailedTestCases += ReportTestResult( VerifyExp2 (reportTestCases), test_tag, "exp2 "); - nrOfFailedTestCases += ReportTestResult( VerifyLog (reportTestCases), test_tag, "log "); - nrOfFailedTestCases += ReportTestResult( VerifyLog2 (reportTestCases), test_tag, "log2 "); - nrOfFailedTestCases += ReportTestResult( VerifyLog10 (reportTestCases), test_tag, "log10 "); - nrOfFailedTestCases += ReportTestResult( VerifySine (reportTestCases), test_tag, "sin "); - nrOfFailedTestCases += ReportTestResult( VerifyCosine (reportTestCases), test_tag, "cos "); - nrOfFailedTestCases += ReportTestResult( VerifyTangent (reportTestCases), test_tag, "tan "); - nrOfFailedTestCases += ReportTestResult( VerifyAtan (reportTestCases), test_tag, "atan "); - nrOfFailedTestCases += ReportTestResult( VerifyAsin (reportTestCases), test_tag, "asin "); - nrOfFailedTestCases += ReportTestResult( VerifyAcos (reportTestCases), test_tag, "acos "); - nrOfFailedTestCases += ReportTestResult( VerifySinh (reportTestCases), test_tag, "sinh "); - nrOfFailedTestCases += ReportTestResult( VerifyCosh (reportTestCases), test_tag, "cosh "); - nrOfFailedTestCases += ReportTestResult( VerifyTanh (reportTestCases), test_tag, "tanh "); - nrOfFailedTestCases += ReportTestResult( VerifyAtanh (reportTestCases), test_tag, "atanh "); - nrOfFailedTestCases += ReportTestResult( VerifyAcosh (reportTestCases), test_tag, "acosh "); - nrOfFailedTestCases += ReportTestResult( VerifyAsinh (reportTestCases), test_tag, "asinh "); - - nrOfFailedTestCases += ReportTestResult( VerifyPowerFunction (reportTestCases), test_tag, "pow "); - -epilog: +// nrOfFailedTestCases += ReportTestResult( VerifySqrt >(reportTestCases), test_tag, "sqrt (native) "); + nrOfFailedTestCases += ReportTestResult( VerifyExp >(reportTestCases), test_tag, "exp "); + nrOfFailedTestCases += ReportTestResult( VerifyExp2 >(reportTestCases), test_tag, "exp2 "); + nrOfFailedTestCases += ReportTestResult( VerifyLog >(reportTestCases), test_tag, "log "); + nrOfFailedTestCases += ReportTestResult( VerifyLog2 >(reportTestCases), test_tag, "log2 "); + nrOfFailedTestCases += ReportTestResult( VerifyLog10 >(reportTestCases), test_tag, "log10 "); + nrOfFailedTestCases += ReportTestResult( VerifySine >(reportTestCases), test_tag, "sin "); + nrOfFailedTestCases += ReportTestResult( VerifyCosine >(reportTestCases), test_tag, "cos "); + nrOfFailedTestCases += ReportTestResult( VerifyTangent >(reportTestCases), test_tag, "tan "); + nrOfFailedTestCases += ReportTestResult( VerifyAtan >(reportTestCases), test_tag, "atan "); + nrOfFailedTestCases += ReportTestResult( VerifyAsin >(reportTestCases), test_tag, "asin "); + nrOfFailedTestCases += ReportTestResult( VerifyAcos >(reportTestCases), test_tag, "acos "); + nrOfFailedTestCases += ReportTestResult( VerifySinh >(reportTestCases), test_tag, "sinh "); + nrOfFailedTestCases += ReportTestResult( VerifyCosh >(reportTestCases), test_tag, "cosh "); + nrOfFailedTestCases += ReportTestResult( VerifyTanh >(reportTestCases), test_tag, "tanh "); + nrOfFailedTestCases += ReportTestResult( VerifyAtanh >(reportTestCases), test_tag, "atanh "); + nrOfFailedTestCases += ReportTestResult( VerifyAcosh >(reportTestCases), test_tag, "acosh "); + nrOfFailedTestCases += ReportTestResult( VerifyAsinh >(reportTestCases), test_tag, "asinh "); + + nrOfFailedTestCases += ReportTestResult( VerifyPowerFunction >(reportTestCases), test_tag, "pow "); + +#endif + +#if REGRESSION_LEVEL_2 + +#endif + +#if REGRESSION_LEVEL_3 + +#endif + +#if REGRESSION_LEVEL_4 + +#endif + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); +#endif // MANUAL_TESTING } catch (char const* msg) { std::cerr << msg << std::endl; diff --git a/static/posit/specialized/quire_32_2.cpp b/static/posit/specialized/quire_32_2.cpp index 7fb3648f8..641825af1 100644 --- a/static/posit/specialized/quire_32_2.cpp +++ b/static/posit/specialized/quire_32_2.cpp @@ -1,6 +1,6 @@ // quire_32_2.cpp: test suite runner for dot product and fused dot product functionality tests for fast specialized posit<32,2> // -// Copyright (C) 2017-2023 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -13,7 +13,7 @@ #define POSIT_THROW_ARITHMETIC_EXCEPTION 1 #include #include -#include +#include /// Standard posit with nbits = 32 have es = 2 exponent bits. diff --git a/static/posit2/arithmetic/addition.cpp b/static/posit2/arithmetic/addition.cpp index ea7667aaf..7d32c32de 100644 --- a/static/posit2/arithmetic/addition.cpp +++ b/static/posit2/arithmetic/addition.cpp @@ -1,6 +1,6 @@ // addition.cpp: test suite runner for posit addition // -// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// Copyright (C) 2017 Stillwater Supercomputing, Inc. // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include @@ -14,9 +14,9 @@ //#define ALGORITHM_VERBOSE_OUTPUT #define ALGORITHM_TRACE_ADD #include -#include #include -#include +#include +#include // generate specific test case that you can trace with the trace conditions in posit.h // for most bugs they are traceable with _trace_conversion and _trace_add @@ -71,62 +71,62 @@ try { GenerateTestCase<3, 0>(0.5f, 1.0f); // manual exhaustive test - nrOfFailedTestCases += ReportTestResult(VerifyAddition<3, 0>(true), "posit<3,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<3, 1>(true), "posit<3,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<3, 2>(true), "posit<3,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<3, 3>(true), "posit<3,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<3,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<3,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<3,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<3,3>", "addition"); -// nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<16, 1>(tag, true, OPCODE_ADD, 1000), "posit<16,1>", "addition"); -// nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(tag, true, OPCODE_ADD, 1000), "posit<64,2>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<16, 1>(tag, reportTestCases, OPCODE_ADD, 1000), "posit<16,1>", "addition"); +// nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(tag, reportTestCases, OPCODE_ADD, 1000), "posit<64,2>", "addition"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyAddition<2, 0>(reportTestCases), "posit< 2,0>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<3, 0>(reportTestCases), "posit< 3,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<3, 1>(reportTestCases), "posit< 3,1>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 0>(reportTestCases), "posit< 4,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 1>(reportTestCases), "posit< 4,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 2>(reportTestCases), "posit< 4,2>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<5, 0>(reportTestCases), "posit< 5,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<5, 1>(reportTestCases), "posit< 5,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<5, 2>(reportTestCases), "posit< 5,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<5, 3>(reportTestCases), "posit< 5,3>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<6, 0>(reportTestCases), "posit< 6,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<6, 1>(reportTestCases), "posit< 6,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<6, 2>(reportTestCases), "posit< 6,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<6, 3>(reportTestCases), "posit< 6,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<6, 4>(reportTestCases), "posit< 6,4>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 0>(reportTestCases), "posit< 7,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 1>(reportTestCases), "posit< 7,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 2>(reportTestCases), "posit< 7,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 3>(reportTestCases), "posit< 7,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 4>(reportTestCases), "posit< 7,4>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 5>(reportTestCases), "posit< 7,5>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 0>(reportTestCases), "posit< 8,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 1>(reportTestCases), "posit< 8,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 2>(reportTestCases), "posit< 8,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 3>(reportTestCases), "posit< 8,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 4>(reportTestCases), "posit< 8,4>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 5>(reportTestCases), "posit< 8,5>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 6>(reportTestCases), "posit< 8,6>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 2,0>", "addition"); + + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 3,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 3,1>", "addition"); + + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 4,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 4,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 4,2>", "addition"); + + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 5,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 5,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 5,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 5,3>", "addition"); + + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 6,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 6,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 6,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 6,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 6,4>", "addition"); + + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 7,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 7,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 7,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 7,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 7,4>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 7,5>", "addition"); + + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,4>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,5>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,6>", "addition"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 0>(reportTestCases), "posit<10,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 1>(reportTestCases), "posit<10,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 2>(reportTestCases), "posit<10,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 3>(reportTestCases), "posit<10,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<10,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<10,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<10,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<10,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 2>(reportTestCases, OPCODE_ADD, 1000), "posit<16,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 2>(reportTestCases, OPCODE_ADD, 1000), "posit<16,2>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<24, 2>(reportTestCases, OPCODE_ADD, 1000), "posit<24,1>", "addition"); #endif @@ -149,9 +149,9 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(reportTestCases, OPCODE_ADD, 1000), "posit<64,4>", "addition"); #ifdef HARDWARE_ACCELERATION - nrOfFailedTestCases += ReportTestResult(VerifyAddition<12, 1>(reportTestCases), "posit<12,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<14, 1>(reportTestCases), "posit<14,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<16, 1>(reportTestCases), "posit<16,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<12,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<14,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<16,1>", "addition"); #endif // HARDWARE_ACCELERATION #endif // REGRESSION_LEVEL_4 diff --git a/static/posito/arithmetic/addition.cpp b/static/posito/arithmetic/addition.cpp index 6a12cbff5..9ded0c6fc 100644 --- a/static/posito/arithmetic/addition.cpp +++ b/static/posito/arithmetic/addition.cpp @@ -14,9 +14,8 @@ //#define ALGORITHM_VERBOSE_OUTPUT //#define ALGORITHM_TRACE_ADD #include -#include #include -#include +#include // generate specific test case that you can trace with the trace conditions in posit.h // for most bugs they are traceable with _trace_conversion and _trace_add @@ -137,28 +136,28 @@ try { // GenerateTestCase, float>(0.0f, 0.0f); // manual exhaustive test -// nrOfFailedTestCases += ReportTestResult(sw::testing::VerifyAddition< posito<3, 0> >(true), "posito<3,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(sw::testing::VerifyAddition< posit<8, 0> >(true), "posit<8,0>", "addition"); -// nrOfFailedTestCases += ReportTestResult(sw::testing::VerifyAddition< posit<16, 2> >(false), "posit<16,2>", "addition"); +// nrOfFailedTestCases += ReportTestResult(sw::testing::VerifyAddition >>(reportTestCases), "posito<3,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(sw::testing::VerifyAddition >>(reportTestCases), "posit<8,0>", "addition"); +// nrOfFailedTestCases += ReportTestResult(sw::testing::VerifyAddition >>(reportTestCases), "posit<16,2>", "addition"); - // nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(test_tag, true, OPCODE_ADD, 1000), "posit<64,2>", "addition"); + // nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(test_tag, reportTestCases, OPCODE_ADD, 1000), "posit<64,2>", "addition"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyAddition<2, 0>(reportTestCases), "posit< 2,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 2,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<3, 0>(reportTestCases), "posit< 3,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 3,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 0>(reportTestCases), "posit< 4,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 4,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 0>(reportTestCases), "posit< 8,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,0>", "addition"); // TODO: no fast posit<8,1> yet - //nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 1>(reportTestCases), "posit< 8,1>", "multiplication"); + //nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,1>", "multiplication"); // TODO: no working fast posit<8,2> yet - //nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 2>(reportTestCases), "posit< 8,2>", "multiplication"); + //nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit< 8,2>", "multiplication"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 1>(reportTestCases, OPCODE_ADD, 65536), "posit<16,1>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 2>(reportTestCases, OPCODE_ADD, 65536), "posit<16,2>", "addition"); @@ -167,10 +166,10 @@ try { #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 0>(reportTestCases), "posit<10,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 1>(reportTestCases), "posit<10,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 2>(reportTestCases), "posit<10,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 3>(reportTestCases), "posit<10,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<10,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<10,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<10,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<10,3>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 2>(reportTestCases, OPCODE_ADD, 1000), "posit<16,2>", "addition"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<24, 2>(reportTestCases, OPCODE_ADD, 1000), "posit<24,1>", "addition"); @@ -194,9 +193,9 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(reportTestCases, OPCODE_ADD, 1000), "posit<64,4>", "addition"); #ifdef HARDWARE_ACCELERATION - nrOfFailedTestCases += ReportTestResult(VerifyAddition<12, 1>(reportTestCases), "posit<12,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<14, 1>(reportTestCases), "posit<14,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<16, 1>(reportTestCases), "posit<16,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<12,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<14,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyAddition>(reportTestCases), "posit<16,1>", "addition"); #endif // HARDWARE_ACCELERATION #endif // REGRESSION_LEVEL_4 diff --git a/static/posito/arithmetic/division.cpp b/static/posito/arithmetic/division.cpp index 9f2d2cd1c..b06b8d5de 100644 --- a/static/posito/arithmetic/division.cpp +++ b/static/posito/arithmetic/division.cpp @@ -16,9 +16,9 @@ //#define ALGORITHM_VERBOSE_OUTPUT #define ALGORITHM_TRACE_DIV #include -#include +#include #include -#include +#include // generate specific test case that you can trace with the trace conditions in posit.h // for most bugs they are traceable with _trace_conversion and _trace_add @@ -223,9 +223,9 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 2>(reportTestCases, OPCODE_DIV, 65536), "posit<16,2>", "division"); -// nrOfFailedTestCases += ReportTestResult(sw::testing::VerifyDivision>(true), "posit<8,0>", "division"); -// nrOfFailedTestCases += ReportTestResult(sw::testing::VerifyDivision>(true), "posit<16,1>", "division"); -// nrOfFailedTestCases += ReportTestResult(sw::testing::VerifyDivision>(true), "posit<16,2>", "division"); +// nrOfFailedTestCases += ReportTestResult(sw::testing::VerifyDivision>(true), "posit<8,0>", "division"); +// nrOfFailedTestCases += ReportTestResult(sw::testing::VerifyDivision>(true), "posit<16,1>", "division"); +// nrOfFailedTestCases += ReportTestResult(sw::testing::VerifyDivision>(true), "posit<16,2>", "division"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; @@ -233,17 +233,17 @@ try { #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<2, 0>(reportTestCases), "posit< 2,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication2, 0>>(reportTestCases), "posit< 2,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 0>(reportTestCases), "posit< 3,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication3, 0>>(reportTestCases), "posit< 3,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 0>(reportTestCases), "posit< 4,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication4, 0>>(reportTestCases), "posit< 4,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 0>(reportTestCases), "posit< 8,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication8, 0>>(reportTestCases), "posit< 8,0>", "division"); // TODO: no fast posit<8,1> yet - //nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 1>(reportTestCases), "posit< 8,1>", "division"); + //nrOfFailedTestCases += ReportTestResult(VerifyMultiplication8, 1>>(reportTestCases), "posit< 8,1>", "division"); // TODO: no working fast posit<8,2> yet - //nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 2>(reportTestCases), "posit< 8,2>", "division"); + //nrOfFailedTestCases += ReportTestResult(VerifyMultiplication8, 2>>(reportTestCases), "posit< 8,2>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 1>(reportTestCases, OPCODE_DIV, 65536), "posit<16,1>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 2>(reportTestCases, OPCODE_DIV, 65536), "posit<16,2>", "division"); @@ -251,10 +251,10 @@ try { #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifyDivision<10, 0>(reportTestCases), "posit<10,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<10, 1>(reportTestCases), "posit<10,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<10, 2>(reportTestCases), "posit<10,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<10, 3>(reportTestCases), "posit<10,3>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<10,0>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<10,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<10,2>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<10,3>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 2>(reportTestCases, OPCODE_DIV, 1000), "posit<16,2>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<24, 2>(reportTestCases, OPCODE_DIV, 1000), "posit<24,2>", "division"); @@ -280,9 +280,9 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(reportTestCases, OPCODE_DIV, 1000), "posit<64,4>", "division"); #ifdef HARDWARE_ACCELERATION - nrOfFailedTestCases += ReportTestResult(VerifyDivision<12, 1>(reportTestCases), "posit<12,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<14, 1>(reportTestCases), "posit<14,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<16, 1>(reportTestCases), "posit<16,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<12,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<14,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyDivision>(reportTestCases), "posit<16,1>", "division"); #endif // HARDWARE_ACCELERATION #endif // REGRESSION_LEVEL_4 diff --git a/static/posito/arithmetic/multiplication.cpp b/static/posito/arithmetic/multiplication.cpp index 81452ab8a..0ca47e57e 100644 --- a/static/posito/arithmetic/multiplication.cpp +++ b/static/posito/arithmetic/multiplication.cpp @@ -14,9 +14,9 @@ //#define ALGORITHM_VERBOSE_OUTPUT #define ALGORITHM_TRACE_MUL #include -#include +#include #include -#include +#include namespace sw { namespace testing { @@ -173,24 +173,24 @@ try { //nrOfFailedTestCases += sw::testing::VerifyMultiplicationWithPosito, posito<16, 1>>(reportTestCases); //nrOfFailedTestCases += sw::testing::VerifyMultiplicationWithPosito, posito<16, 2>>(reportTestCases); - //nrOfFailedTestCases += ReportTestResult(sw::testing::VerifyMultiplication>(reportTestCases), "posit<16, 2>", "multiplication"); + //nrOfFailedTestCases += ReportTestResult(sw::testing::VerifyMultiplication>(reportTestCases), "posit<16, 2>", "multiplication"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<2, 0>(reportTestCases), "posit< 2,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 2,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 0>(reportTestCases), "posit< 3,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 3,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 0>(reportTestCases), "posit< 4,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 4,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 0>(reportTestCases), "posit< 8,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit< 8,0>", "multiplication"); // TODO: no fast posit<8,1> yet - //nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 1>(reportTestCases), "posit< 8,1>", "multiplication"); + //nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "posit< 8,1>", "multiplication"); // TODO: no working fast posit<8,2> yet - //nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 2>(reportTestCases), "posit< 8,2>", "multiplication"); + //nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "posit< 8,2>", "multiplication"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 1>(reportTestCases, OPCODE_MUL, 65536), "posit<16,1>", "multiplication"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 2>(reportTestCases, OPCODE_MUL, 65536), "posit<16,2>", "multiplication"); @@ -218,9 +218,9 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(reportTestCases, OPCODE_MUL, 1000), "posit<64,4>", "multiplication"); #ifdef HARDWARE_ACCELERATION - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<12, 1>(reportTestCases), "posit<12,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<14, 1>(reportTestCases), "posit<14,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<16, 1>(reportTestCases), "posit<16,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit<12,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit<14,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication>(reportTestCases), "posit<16,1>", "multiplication"); #endif // HARDWARE_ACCELERATION #endif // REGRESSION_LEVEL_4 diff --git a/static/posito/arithmetic/number_system.cpp b/static/posito/arithmetic/number_system.cpp index 717cdf146..278ff02b3 100644 --- a/static/posito/arithmetic/number_system.cpp +++ b/static/posito/arithmetic/number_system.cpp @@ -13,8 +13,10 @@ // when you define ALGORITHM_VERBOSE_OUTPUT executing an ADD the code will print intermediate results //#define ALGORITHM_VERBOSE_OUTPUT //#define ALGORITHM_TRACE_ADD +#include +#include #include -#include +#include // Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 1 @@ -36,8 +38,8 @@ int main() try { using namespace sw::universal; - std::string test_suite = "posit addition validation"; - std::string test_tag = "addition"; + std::string test_suite = "posit number system validation"; + std::string test_tag = "number system"; bool reportTestCases = false; int nrOfFailedTestCases = 0; @@ -45,14 +47,30 @@ try { #if MANUAL_TESTING - // TestType: posit needs RefType posit - nrOfFailedTestCases += ExhaustiveNumberSystemTest, posito<9, 0>>("posito<8,0>", reportTestCases); + // TestType: posit + nrOfFailedTestCases += ExhaustiveNumberSystemTest>("posit<2,0>", reportTestCases); + nrOfFailedTestCases += ExhaustiveNumberSystemTest>("posit<3,0>", reportTestCases); +// nrOfFailedTestCases += ExhaustiveNumberSystemTest>("posit<3,1>", true); + nrOfFailedTestCases += ExhaustiveNumberSystemTest>("posit<4,0>", reportTestCases); + nrOfFailedTestCases += ExhaustiveNumberSystemTest>("posit<5,2>", reportTestCases); + nrOfFailedTestCases += ExhaustiveNumberSystemTest>("posit<8,0>", reportTestCases); +// nrOfFailedTestCases += ExhaustiveNumberSystemTest>("posit<8,2>", reportTestCases); + +// nrOfFailedTestCases += ExhaustiveNumberSystemTest>("posit<16,1>", reportTestCases); +// nrOfFailedTestCases += ExhaustiveNumberSystemTest>("posit<16,2>", reportTestCases); + +// nrOfFailedTestCases += ExhaustiveNumberSystemTest, posito<9, 0>>("posito<8,0>", reportTestCases); + +// nrOfFailedTestCases += ExhaustiveNumberSystemTest, cfloat<9, 5>>("cfloat<8,5>", reportTestCases); +// nrOfFailedTestCases += ExhaustiveNumberSystemTest, posito<8, 0>>("posito<7,0>", reportTestCases); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 + nrOfFailedTestCases += ExhaustiveNumberSystemTest, posit<9, 0>>("posit<8,0>", reportTestCases); + nrOfFailedTestCases += ExhaustiveNumberSystemTest, posito<9, 0>>("posito<8,0>", reportTestCases); #endif #if REGRESSION_LEVEL_2 @@ -62,6 +80,8 @@ try { #endif #if REGRESSION_LEVEL_4 + nrOfFailedTestCases += ExhaustiveNumberSystemTest, posit<9, 0>>("posit<8,0>", reportTestCases); + nrOfFailedTestCases += ExhaustiveNumberSystemTest, posito<9, 0>>("posito<8,0>", reportTestCases); #endif // REGRESSION_LEVEL_4 ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/static/posito/arithmetic/subtraction.cpp b/static/posito/arithmetic/subtraction.cpp index 2737439bc..03ffcfba2 100644 --- a/static/posito/arithmetic/subtraction.cpp +++ b/static/posito/arithmetic/subtraction.cpp @@ -14,9 +14,8 @@ //#define ALGORITHM_VERBOSE_OUTPUT //#define ALGORITHM_TRACE_ADD #include -#include #include -#include +#include // generate specific test case that you can trace with the trace conditions in posit.h // for most bugs they are traceable with _trace_conversion and _trace_add @@ -118,38 +117,38 @@ try { // generate individual testcases to hand trace/debug // manual exhaustive test -// nrOfFailedTestCases += ReportTestResult(sw::testing::VerifySubtraction< posito<3, 0> >(true), "posito<3,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(sw::testing::VerifySubtraction< posit<8, 0> >(true), "posit<8,0>", "subtraction"); -// nrOfFailedTestCases += ReportTestResult(sw::testing::VerifySubtraction< posit<16, 2> >(false), "posit<16,2>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(sw::testing::VerifySubtraction< posito<3, 0> >(reportTestCases), "posito<3,0>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(sw::testing::VerifySubtraction< posit<8, 0> >(reportTestCases), "posit<8,0>", "subtraction"); +// nrOfFailedTestCases += ReportTestResult(sw::testing::VerifySubtraction< posit<16, 2> >(reportTestCases), "posit<16,2>", "subtraction"); - // nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(test_tag, true, OPCODE_SUB, 1000), "posit<64,2>", "subtraction"); + // nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(test_tag, reportTestCases, OPCODE_SUB, 1000), "posit<64,2>", "subtraction"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<2, 0>(reportTestCases), "posit< 2,0>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 2,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<3, 0>(reportTestCases), "posit< 3,0>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 3,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 0>(reportTestCases), "posit< 4,0>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 4,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<8, 0>(reportTestCases), "posit< 8,0>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 8,0>", "subtraction"); // TODO: no fast posit<8,1> yet - //nrOfFailedTestCases += ReportTestResult(VerifySubtraction<8, 1>(reportTestCases), "posit< 8,1>", "multiplication"); + //nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 8,1>", "multiplication"); // TODO: no working fast posit<8,2> yet - //nrOfFailedTestCases += ReportTestResult(VerifySubtraction<8, 2>(reportTestCases), "posit< 8,2>", "multiplication"); + //nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit< 8,2>", "multiplication"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 1>(reportTestCases, OPCODE_SUB, nrOfRandoms), "posit<16,1>", "subtraction"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 2>(reportTestCases, OPCODE_SUB, nrOfRandoms), "posit<16,2>", "subtraction"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<10, 0>(reportTestCases), "posit<10,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<10, 1>(reportTestCases), "posit<10,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<10, 2>(reportTestCases), "posit<10,2>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<10, 3>(reportTestCases), "posit<10,3>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit<10,0>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit<10,1>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit<10,2>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction>(reportTestCases), "posit<10,3>", "subtraction"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<16, 2>(reportTestCases, OPCODE_SUB, nrOfRandoms), "posit<16,2>", "subtraction"); nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<24, 2>(reportTestCases, OPCODE_SUB, nrOfRandoms), "posit<24,1>", "subtraction"); @@ -165,7 +164,7 @@ try { #if REGRESSION_LEVEL_4 // nbits=48 also shows failures - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<48, 2>(reportTestCases, OPCODE_SUB, 1nrOfRandoms000), "posit<48,2>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<48, 2>(reportTestCases, OPCODE_SUB, nrOfRandoms), "posit<48,2>", "subtraction"); // nbits=64 requires long double compiler support nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 2>(reportTestCases, OPCODE_SUB, nrOfRandoms), "posit<64,2>", "subtraction"); @@ -173,9 +172,9 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(reportTestCases, OPCODE_SUB, nrOfRandoms), "posit<64,4>", "subtraction"); #ifdef HARDWARE_ACCELERATION - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<12, 1>(reportTestCases), "posit<12,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<14, 1>(reportTestCases), "posit<14,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<16, 1>(reportTestCases), "posit<16,1>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction(reportTestCases), "posit<12,1>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction(reportTestCases), "posit<14,1>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction(reportTestCases), "posit<16,1>", "subtraction"); #endif // HARDWARE_ACCELERATION #endif // REGRESSION_LEVEL_4 diff --git a/static/posito/conversion/assignment.cpp b/static/posito/conversion/assignment.cpp index 1ec988450..7c992f6f5 100644 --- a/static/posito/conversion/assignment.cpp +++ b/static/posito/conversion/assignment.cpp @@ -8,61 +8,66 @@ #define POSIT_FAST_POSIT_8_2 1 #define POSIT_FAST_POSIT_16_2 1 #include +#include #include -#include - -namespace sw { namespace universal { - - template - int VerifyAssignment(bool reportTestCases) { - const size_t NR_POSITS = (size_t(1) << nbits); - int nrOfFailedTestCases = 0; - - // use only valid posit values - // posit_raw -> to value in Ty -> assign to posit -> compare posits - posit p, assigned; - for (size_t i = 0; i < NR_POSITS; i++) { - p.setbits(i); // std::cout << p.get() << endl; - if (p.isnar() && std::numeric_limits::is_exact) continue; // can't assign NaR for integer types - Ty value = (Ty)(p); - assigned = value; - if (p != assigned) { - nrOfFailedTestCases++; - if (reportTestCases) ReportAssignmentError("FAIL", "=", p, assigned, value); - } - else { - //if (reportTestCases) ReportAssignmentSuccess("PASS", "=", p, assigned, value); +#include + +namespace sw { + namespace universal { + + template + int VerifyAssignment(bool reportTestCases) { + const size_t NR_POSITS = (size_t(1) << nbits); + int nrOfFailedTestCases = 0; + + // use only valid posit values + // posit_raw -> to value in Ty -> assign to posit -> compare posits + posit p, assigned; + for (size_t i = 0; i < NR_POSITS; i++) { + p.setbits(i); // std::cout << p.get() << endl; + if (p.isnar() && std::numeric_limits::is_exact) continue; // can't assign NaR for integer types + Ty value = (Ty)(p); + assigned = value; + if (p != assigned) { + nrOfFailedTestCases++; + if (reportTestCases) ReportAssignmentError("FAIL", "=", p, assigned, value); + std::cout << to_binary(p) << " : " << std::setw(10) << p << " <-> " << to_binary(assigned) << " : " << value << '\n'; + } + else { + //if (reportTestCases) ReportAssignmentSuccess("PASS", "=", p, assigned, value); + } + if (nrOfFailedTestCases > 9) return 10; } + return nrOfFailedTestCases; } - return nrOfFailedTestCases; - } - template - int VerifyAssignment(bool reportTestCases) { - constexpr unsigned nbits = PositType::nbits; - const size_t NR_POSITS = (size_t(1) << nbits); - int nrOfFailedTestCases = 0; - - // use only valid posit values - // posit_raw -> to value in Ty -> assign to posit -> compare posits - PositType p, assigned; - for (size_t i = 0; i < NR_POSITS; i++) { - p.setbits(i); // std::cout << p.get() << endl; - if (p.isnar() && std::numeric_limits::is_exact) continue; // can't assign NaR for integer types - Ty value = (Ty)(p); - assigned = value; - if (p != assigned) { - nrOfFailedTestCases++; - if (reportTestCases) ReportAssignmentError("FAIL", "=", p, assigned, value); - } - else { - //if (reportTestCases) ReportAssignmentSuccess("PASS", "=", p, assigned, value); + template + int VerifyAssignment(bool reportTestCases) { + constexpr unsigned nbits = PositType::nbits; + const size_t NR_POSITS = (size_t(1) << nbits); + int nrOfFailedTestCases = 0; + + // use only valid posit values + // posit_raw -> to value in Ty -> assign to posit -> compare posits + PositType p, assigned; + for (size_t i = 0; i < NR_POSITS; i++) { + p.setbits(i); // std::cout << p.get() << endl; + if (p.isnar() && std::numeric_limits::is_exact) continue; // can't assign NaR for integer types + Ty value = (Ty)(p); + assigned = value; + if (p != assigned) { + nrOfFailedTestCases++; + if (reportTestCases) ReportAssignmentError("FAIL", "=", p, assigned, value); + } + else { + //if (reportTestCases) ReportAssignmentSuccess("PASS", "=", p, assigned, value); + } } + return nrOfFailedTestCases; } - return nrOfFailedTestCases; - } -} } // namespace sw::universal + } +} // namespace sw::universal template Ty GenerateValue(const sw::universal::posit& p) {