diff --git a/CMakeLists.txt b/CMakeLists.txt index 55681176c..c72fce1ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ if(NOT DEFINED UNIVERSAL_VERSION_MAJOR) set(UNIVERSAL_VERSION_MAJOR 3) endif() if(NOT DEFINED UNIVERSAL_VERSION_MINOR) - set(UNIVERSAL_VERSION_MINOR 58) + set(UNIVERSAL_VERSION_MINOR 59) endif() if(NOT DEFINED UNIVERSAL_VERSION_PATCH) set(UNIVERSAL_VERSION_PATCH 1) diff --git a/README.md b/README.md index d3603fa02..628d8ece1 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,15 @@ The library contains integers, decimals, fixed-points, rationals, linear floats, Please cite [our work](https://arxiv.org/abs/2012.11011) if you use _Universal_. ```bib +@inproceedings{Omtzigt:2022, + title={Universal: Reliable, Reproducible, and Energy-Efficient Numerics}, + author={E. Theodore L. Omtzigt and James Quinlan}, + booktitle={Conference on Next Generation Arithmetic}, + pages={100--116}, + year={2022}, + organization={Springer} +} + @article{Omtzigt2020, author = {E. Theodore L. Omtzigt and Peter Gottschling and Mark Seligman and William Zorn}, title = {{Universal Numbers Library}: design and implementation of a high-performance reproducible number systems library}, @@ -78,14 +87,14 @@ CTestTestfile.cmake c_api education tools universal- ## How to build -If you do want to work with the code, the universal numbers software library is built using cmake version v3.18. +If you do want to work with the code, the universal numbers software library is built using cmake version v3.23. Install the latest [cmake](https://cmake.org/download). There are interactive installers for MacOS and Windows. For Linux, a portable approach downloads the shell archive and installs it at /usr/local: ```text -> wget https://github.com/Kitware/CMake/releases/download/v3.18.2/cmake-3.18.2-Linux-x86_64.sh -> sudo sh cmake-3.18.2-Linux-x86_64.sh --prefix=/usr/local --exclude-subdir +> wget https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-Linux-x86_64.sh +> sudo sh cmake-3.23.1-Linux-x86_64.sh --prefix=/usr/local --exclude-subdir ``` For Ubuntu, snap will install the latest cmake, and would be the preferred method: diff --git a/applications/adaptive/double-double.cpp b/applications/adaptive/double-double.cpp index 1ab69e77a..916f70511 100644 --- a/applications/adaptive/double-double.cpp +++ b/applications/adaptive/double-double.cpp @@ -45,7 +45,7 @@ try { std::streamsize precision = std::cout.precision(); { - using lns = lns<16, 10, std::uint16_t>; + using lns = lns<16, 10, Saturating, std::uint16_t>; lns a, b, c; a = 0.5; @@ -57,6 +57,7 @@ try { std::cout << std::setprecision(precision); std::cout << std::endl; + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; } catch (char const* msg) { diff --git a/applications/chebyshev/chebpoly.hpp b/applications/chebyshev/chebpoly.hpp index 069b31250..f8ad657dd 100644 --- a/applications/chebyshev/chebpoly.hpp +++ b/applications/chebyshev/chebpoly.hpp @@ -23,7 +23,7 @@ namespace chebyshev { blas::vectorTn(n+1); if (n==0) Tn(0) = 1; - if (n==1) Tn(0) = 0;Tn(1) = 1; + if (n==1) { Tn(0) = 0; Tn(1) = 1; } if (n>1){ blas::vector T0(n+1); blas::vector T1(n+1); diff --git a/applications/chebyshev/chebtests.cpp b/applications/chebyshev/chebtests.cpp index 974a75e88..a57a6253d 100644 --- a/applications/chebyshev/chebtests.cpp +++ b/applications/chebyshev/chebtests.cpp @@ -59,7 +59,7 @@ try { std::cout << "\nUsing POSIT<" << nbits << "," << es << ">\n\n"; #else using Scalar = double; - std::cout << "\nUsing DOUBLE " << "\n\n"; + std::cout << "\nUsing DOUBLE " << Scalar(0.0) << "\n\n"; #endif // TESTS diff --git a/applications/numeric/limits.cpp b/applications/numeric/limits.cpp index c48e60aaf..8a2997274 100644 --- a/applications/numeric/limits.cpp +++ b/applications/numeric/limits.cpp @@ -28,7 +28,7 @@ try { using fixpnt32 = fixpnt<32, 16, Modulo, std::uint32_t>; using posit32 = posit<32, 2>; using areal32 = areal<32, 8, std::uint32_t>; - using lns32 = lns<32, 8, std::uint32_t>; + using lns32 = lns<32, 8, Saturating, std::uint32_t>; // report on precision and dynamic range of the number system diff --git a/applications/numeric/numbers.cpp b/applications/numeric/numbers.cpp index 0201534a4..82cf45b85 100644 --- a/applications/numeric/numbers.cpp +++ b/applications/numeric/numbers.cpp @@ -129,7 +129,7 @@ try { using cfloat32 = cfloat<32, 8, std::uint32_t, true, true, false>; using posit32 = posit<32, 2>; using areal32 = areal<32, 8, std::uint32_t>; - using lns32 = lns<32, 8, std::uint32_t>; + using lns32 = lns<32, 8, Saturating, std::uint32_t>; // report on precision and dynamic range of the number system diff --git a/applications/stream/stream.cpp b/applications/stream/stream.cpp index 6667a0cbe..6e85a7d70 100644 --- a/applications/stream/stream.cpp +++ b/applications/stream/stream.cpp @@ -210,7 +210,7 @@ try { Sweep< float >(startSample, endSample); Sweep< double >(startSample, endSample); Sweep< fixpnt<8, 4, Modulo, std::uint8_t> >(startSample, endSample); - Sweep< fixpnt<8, 4, Saturating, std::uint8_t> >(startSample, endSample); + Sweep< fixpnt<8, 4, Saturate, std::uint8_t> >(startSample, endSample); Sweep< cfloat<32, 8, std::uint32_t, true, false, false> >(startSample, endSample); #endif diff --git a/benchmark/performance/arithmetic/fixpnt/performance.cpp b/benchmark/performance/arithmetic/fixpnt/performance.cpp index 7251f0f52..076aefae4 100644 --- a/benchmark/performance/arithmetic/fixpnt/performance.cpp +++ b/benchmark/performance/arithmetic/fixpnt/performance.cpp @@ -1,6 +1,6 @@ -// performance.cpp : performance benchmarking for abitrary precision fixpnts +// performance.cpp : performance benchmarking for fixed-sized, abitrary precision fixpnts // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 @@ -28,52 +28,52 @@ void TestShiftOperatorPerformance() { constexpr uint64_t NR_OPS = 1000000; - PerformanceRunner("fixpnt<8,4, Saturating, uint8_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt<8, 4, Saturating, uint8_t> >, NR_OPS); - PerformanceRunner("fixpnt<16,8, Saturating, uint16_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt<16, 8, Saturating, uint16_t> >, NR_OPS); - PerformanceRunner("fixpnt<32,16, Saturating, uint32_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt<32, 16, Saturating, uint32_t> >, NR_OPS); - PerformanceRunner("fixpnt<64,32, Saturating, uint32_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt<64, 32, Saturating, uint32_t> >, NR_OPS); - PerformanceRunner("fixpnt<128,32, Saturating, uint32_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt<128, 32, Saturating, uint32_t> >, NR_OPS / 2); - PerformanceRunner("fixpnt<256,32, Saturating, uint32_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt<256, 32, Saturating, uint32_t> >, NR_OPS / 4); - PerformanceRunner("fixpnt<512,32, Saturating, uint32_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt<512, 32, Saturating, uint32_t> >, NR_OPS / 8); - PerformanceRunner("fixpnt<1024,32,Saturating, uint32_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt<1024, 32, Saturating, uint32_t> >, NR_OPS / 16); + PerformanceRunner("fixpnt< 8, 4, Saturate, uint8_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt< 8, 4, Saturate, uint8_t> >, NR_OPS); + PerformanceRunner("fixpnt< 16, 8, Saturate, uint16_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt< 16, 8, Saturate, uint16_t> >, NR_OPS); + PerformanceRunner("fixpnt< 32, 16, Saturate, uint32_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt< 32, 16, Saturate, uint32_t> >, NR_OPS); + PerformanceRunner("fixpnt< 64, 32, Saturate, uint32_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt< 64, 32, Saturate, uint32_t> >, NR_OPS); + PerformanceRunner("fixpnt< 128, 32, Saturate, uint32_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt< 128, 32, Saturate, uint32_t> >, NR_OPS / 2); + PerformanceRunner("fixpnt< 256, 32, Saturate, uint32_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt< 256, 32, Saturate, uint32_t> >, NR_OPS / 4); + PerformanceRunner("fixpnt< 512, 32, Saturate, uint32_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt< 512, 32, Saturate, uint32_t> >, NR_OPS / 8); + PerformanceRunner("fixpnt<1024, 32, Saturate, uint32_t> shifts ", ShiftPerformanceWorkload< sw::universal::fixpnt<1024, 32, Saturate, uint32_t> >, NR_OPS / 16); } // measure performance of arithmetic operations void TestArithmeticOperatorPerformance() { using namespace sw::universal; - std::cout << "\nFIXPNT Fixed-Point Saturating Arithmetic operator performance\n"; + std::cout << "\nFIXPNT Fixed-Point Saturate Arithmetic operator performance\n"; uint64_t NR_OPS = 1000000; - PerformanceRunner("fixpnt<8,4, Saturating,uint8_t> add/subtract ", AdditionSubtractionWorkload< sw::universal::fixpnt<8,4, Saturating, uint8_t> >, NR_OPS); - PerformanceRunner("fixpnt<16,8, Saturating,uint16_t> add/subtract ", AdditionSubtractionWorkload< sw::universal::fixpnt<16,8, Saturating, uint16_t> >, NR_OPS); - PerformanceRunner("fixpnt<32,16, Saturating,uint32_t> add/subtract ", AdditionSubtractionWorkload< sw::universal::fixpnt<32,16, Saturating, uint32_t> >, NR_OPS); - PerformanceRunner("fixpnt<64,32, Saturating,uint32_t> add/subtract ", AdditionSubtractionWorkload< sw::universal::fixpnt<64,32, Saturating, uint32_t> >, NR_OPS); - PerformanceRunner("fixpnt<128,32, Saturating,uint32_t> add/subtract ", AdditionSubtractionWorkload< sw::universal::fixpnt<128,32, Saturating, uint32_t> >, NR_OPS / 2); + PerformanceRunner("fixpnt< 8, 4, Saturate, uint8_t > add/subtract ", AdditionSubtractionWorkload< sw::universal::fixpnt< 8, 4, Saturate, uint8_t> >, NR_OPS); + PerformanceRunner("fixpnt< 16, 8, Saturate, uint16_t> add/subtract ", AdditionSubtractionWorkload< sw::universal::fixpnt< 16, 8, Saturate, uint16_t> >, NR_OPS); + PerformanceRunner("fixpnt< 32, 16, Saturate, uint32_t> add/subtract ", AdditionSubtractionWorkload< sw::universal::fixpnt< 32, 16, Saturate, uint32_t> >, NR_OPS); + PerformanceRunner("fixpnt< 64, 32, Saturate, uint32_t> add/subtract ", AdditionSubtractionWorkload< sw::universal::fixpnt< 64, 32, Saturate, uint32_t> >, NR_OPS); + PerformanceRunner("fixpnt<128, 32, Saturate, uint32_t> add/subtract ", AdditionSubtractionWorkload< sw::universal::fixpnt<128, 32, Saturate, uint32_t> >, NR_OPS / 2); #if 0 NR_OPS = 1024 * 32; - PerformanceRunner("fixpnt<8,4, Saturating,uint8_t> division ", DivisionWorkload< sw::universal::fixpnt<8,4, Saturating, uint8_t> >, NR_OPS); - PerformanceRunner("fixpnt<16,8, Saturating,uint16_t> division ", DivisionWorkload< sw::universal::fixpnt<16,8, Saturating, uint16_t> >, NR_OPS); - PerformanceRunner("fixpnt<32,16, Saturating,uint32_t> division ", DivisionWorkload< sw::universal::fixpnt<32,16, Saturating, uint32_t> >, NR_OPS); - PerformanceRunner("fixpnt<64,32, Saturating,uint32_t> division ", DivisionWorkload< sw::universal::fixpnt<64,32, Saturating, uint32_t> >, NR_OPS); - PerformanceRunner("fixpnt<128,32, Saturating,uint32_t> division ", DivisionWorkload< sw::universal::fixpnt<128,32, Saturating, uint32_t> >, NR_OPS / 2); + PerformanceRunner("fixpnt< 8, 4, Saturate,uint8_t > division ", DivisionWorkload< sw::universal::fixpnt< 8, 4, Saturate, uint8_t> >, NR_OPS); + PerformanceRunner("fixpnt< 16, 8, Saturate,uint16_t> division ", DivisionWorkload< sw::universal::fixpnt< 16, 8, Saturate, uint16_t> >, NR_OPS); + PerformanceRunner("fixpnt< 32, 16, Saturate,uint32_t> division ", DivisionWorkload< sw::universal::fixpnt< 32, 16, Saturate, uint32_t> >, NR_OPS); + PerformanceRunner("fixpnt< 64, 32, Saturate,uint32_t> division ", DivisionWorkload< sw::universal::fixpnt< 64, 32, Saturate, uint32_t> >, NR_OPS); + PerformanceRunner("fixpnt<128, 32, Saturate,uint32_t> division ", DivisionWorkload< sw::universal::fixpnt<128, 32, Saturate, uint32_t> >, NR_OPS / 2); NR_OPS = 1024 * 32; - PerformanceRunner("fixpnt<8,4, Saturating,uint8_t> remainder ", RemainderWorkload< sw::universal::fixpnt<8,4, Saturating, uint8_t> >, NR_OPS); - PerformanceRunner("fixpnt<16,8, Saturating,uint16_t> remainder ", RemainderWorkload< sw::universal::fixpnt<16,8, Saturating, uint16_t> >, NR_OPS); - PerformanceRunner("fixpnt<32,16, Saturating,uint32_t> remainder ", RemainderWorkload< sw::universal::fixpnt<32,16, Saturating, uint32_t> >, NR_OPS); - PerformanceRunner("fixpnt<64,32, Saturating,uint32_t> remainder ", RemainderWorkload< sw::universal::fixpnt<64,32, Saturating, uint32_t> >, NR_OPS); - PerformanceRunner("fixpnt<128,32, Saturating,uint32_t> remainder ", RemainderWorkload< sw::universal::fixpnt<128,32, Saturating, uint32_t> >, NR_OPS / 2); + PerformanceRunner("fixpnt< 8, 4, Saturate,uint8_t > remainder ", RemainderWorkload< sw::universal::fixpnt< 8, 4, Saturate, uint8_t> >, NR_OPS); + PerformanceRunner("fixpnt< 16, 8, Saturate,uint16_t> remainder ", RemainderWorkload< sw::universal::fixpnt< 16, 8, Saturate, uint16_t> >, NR_OPS); + PerformanceRunner("fixpnt< 32, 16, Saturate,uint32_t> remainder ", RemainderWorkload< sw::universal::fixpnt< 32, 16, Saturate, uint32_t> >, NR_OPS); + PerformanceRunner("fixpnt< 64, 32, Saturate,uint32_t> remainder ", RemainderWorkload< sw::universal::fixpnt< 64, 32, Saturate, uint32_t> >, NR_OPS); + PerformanceRunner("fixpnt<128, 32, Saturate,uint32_t> remainder ", RemainderWorkload< sw::universal::fixpnt<128, 32, Saturate, uint32_t> >, NR_OPS / 2); #endif // multiplication is the slowest operator NR_OPS = 1024 * 32; - PerformanceRunner("fixpnt<8,4, Saturating,uint8_t> multiplication ", MultiplicationWorkload< sw::universal::fixpnt<8,4, Saturating, uint8_t> >, NR_OPS); - PerformanceRunner("fixpnt<16,8, Saturating,uint16_t> multiplication ", MultiplicationWorkload< sw::universal::fixpnt<16,8, Saturating, uint16_t> >, NR_OPS); - PerformanceRunner("fixpnt<32,16 Saturating,,uint32_t> multiplication ", MultiplicationWorkload< sw::universal::fixpnt<32,16, Saturating, uint32_t> >, NR_OPS); - PerformanceRunner("fixpnt<64,32, Saturating,uint32_t> multiplication ", MultiplicationWorkload< sw::universal::fixpnt<64,32, Saturating, uint32_t> >, NR_OPS); - PerformanceRunner("fixpnt<128,32 Saturating,,uint32_t> multiplication ", MultiplicationWorkload< sw::universal::fixpnt<128,32, Saturating, uint32_t> >, NR_OPS / 2); + PerformanceRunner("fixpnt< 8, 4, Saturate, uint8_t > multiplication ", MultiplicationWorkload< sw::universal::fixpnt< 8, 4, Saturate, uint8_t> >, NR_OPS); + PerformanceRunner("fixpnt< 16, 8, Saturate, uint16_t> multiplication ", MultiplicationWorkload< sw::universal::fixpnt< 16, 8, Saturate, uint16_t> >, NR_OPS); + PerformanceRunner("fixpnt< 32, 16 Saturate, uint32_t> multiplication ", MultiplicationWorkload< sw::universal::fixpnt< 32, 16, Saturate, uint32_t> >, NR_OPS); + PerformanceRunner("fixpnt< 64, 32, Saturate, uint32_t> multiplication ", MultiplicationWorkload< sw::universal::fixpnt< 64, 32, Saturate, uint32_t> >, NR_OPS); + PerformanceRunner("fixpnt<128, 32, Saturate, uint32_t> multiplication ", MultiplicationWorkload< sw::universal::fixpnt<128, 32, Saturate, uint32_t> >, NR_OPS / 2); } // conditional compilation diff --git a/docker/Dockerfile.gcc10.builder b/docker/Dockerfile.gcc10.builder index 73169f038..7a2bc0cba 100644 --- a/docker/Dockerfile.gcc10.builder +++ b/docker/Dockerfile.gcc10.builder @@ -37,5 +37,5 @@ USER stillwater WORKDIR /home/stillwater # add a command that when you run the container without a command, it produces something meaningful -ENV CONTAINER_ID "Universal Numbers Library Builder V3 GCC 10.3" +ENV CONTAINER_ID "Universal Numbers Library Builder V3 GCC 10.4" CMD ["/usr/bin/env", "bash"] diff --git a/docker/Dockerfile.gcc11.builder b/docker/Dockerfile.gcc11.builder index 6117f43e7..65f0ee94e 100644 --- a/docker/Dockerfile.gcc11.builder +++ b/docker/Dockerfile.gcc11.builder @@ -37,5 +37,6 @@ USER stillwater WORKDIR /home/stillwater # add a command that when you run the container without a command, it produces something meaningful -ENV CONTAINER_ID "Universal Numbers Library Builder V3 GCC 10.3" +ENV CONTAINER_ID "Universal Numbers Library Builder V3 GCC 11.3" + CMD ["/usr/bin/env", "bash"] diff --git a/docker/Dockerfile.gcc12.builder b/docker/Dockerfile.gcc12.builder index 503f7ee30..c60a5c51c 100644 --- a/docker/Dockerfile.gcc12.builder +++ b/docker/Dockerfile.gcc12.builder @@ -37,5 +37,6 @@ USER stillwater WORKDIR /home/stillwater # add a command that when you run the container without a command, it produces something meaningful -ENV CONTAINER_ID "Universal Numbers Library Builder V3 GCC 10.3" +ENV CONTAINER_ID "Universal Numbers Library Builder V3 GCC 12.1" + CMD ["/usr/bin/env", "bash"] diff --git a/docker/Dockerfile.gcc9.builder b/docker/Dockerfile.gcc9.builder index 49e83840e..a14932e68 100644 --- a/docker/Dockerfile.gcc9.builder +++ b/docker/Dockerfile.gcc9.builder @@ -37,5 +37,5 @@ USER stillwater WORKDIR /home/stillwater # add a command that when you run the container without a command, it produces something meaningful -ENV CONTAINER_ID "Universal Numbers Library Builder V3 GCC 9.4" +ENV CONTAINER_ID "Universal Numbers Library Builder V3 GCC 9.5" CMD ["/usr/bin/env", "bash"] diff --git a/docs/tables/lns.csv b/docs/tables/lns.csv new file mode 100644 index 000000000..3b70f8198 --- /dev/null +++ b/docs/tables/lns.csv @@ -0,0 +1,4270 @@ +"Generate Value table for an LNS<4,0> in CSV format" +#, Binary, sign, scale, value +0,0b0.000,0,0,1 +1,0b0.001,0,1,2 +2,0b0.010,0,2,4 +3,0b0.011,0,3,8 +4,0b0.100,0,-4,0 +5,0b0.101,0,-3,0.125 +6,0b0.110,0,-2,0.25 +7,0b0.111,0,-1,0.5 +8,0b1.000,1,0,-1 +9,0b1.001,1,1,-2 +10,0b1.010,1,2,-4 +11,0b1.011,1,3,-8 +12,0b1.100,1,-4,-nan(ind) +13,0b1.101,1,-3,-0.125 +14,0b1.110,1,-2,-0.25 +15,0b1.111,1,-1,-0.5 + +"Generate Value table for an LNS<4,1> in CSV format" +#, Binary, sign, scale, value +0,0b0.00.0,0,0,1 +1,0b0.00.1,0,0,1.41421 +2,0b0.01.0,0,1,2 +3,0b0.01.1,0,1,2.82843 +4,0b0.10.0,0,-2,0 +5,0b0.10.1,0,-2,0.353553 +6,0b0.11.0,0,-1,0.5 +7,0b0.11.1,0,-1,0.707107 +8,0b1.00.0,1,0,-1 +9,0b1.00.1,1,0,-1.41421 +10,0b1.01.0,1,1,-2 +11,0b1.01.1,1,1,-2.82843 +12,0b1.10.0,1,-2,-nan(ind) +13,0b1.10.1,1,-2,-0.353553 +14,0b1.11.0,1,-1,-0.5 +15,0b1.11.1,1,-1,-0.707107 + +"Generate Value table for an LNS<4,2> in CSV format" +#, Binary, sign, scale, value +0,0b0.0.00,0,0,1 +1,0b0.0.01,0,0,1.18921 +2,0b0.0.10,0,0,1.41421 +3,0b0.0.11,0,0,1.68179 +4,0b0.1.00,0,-1,0 +5,0b0.1.01,0,-1,0.594604 +6,0b0.1.10,0,-1,0.707107 +7,0b0.1.11,0,-1,0.840896 +8,0b1.0.00,1,0,-1 +9,0b1.0.01,1,0,-1.18921 +10,0b1.0.10,1,0,-1.41421 +11,0b1.0.11,1,0,-1.68179 +12,0b1.1.00,1,-1,-nan(ind) +13,0b1.1.01,1,-1,-0.594604 +14,0b1.1.10,1,-1,-0.707107 +15,0b1.1.11,1,-1,-0.840896 + +"Generate Value table for an LNS<4,3> in CSV format" +#, Binary, sign, scale, value +0,0b0..000,0,0,1 +1,0b0..001,0,0,1.09051 +2,0b0..010,0,0,1.18921 +3,0b0..011,0,0,1.29684 +4,0b0..100,0,0,0 +5,0b0..101,0,0,0.771105 +6,0b0..110,0,0,0.840896 +7,0b0..111,0,0,0.917004 +8,0b1..000,1,0,-1 +9,0b1..001,1,0,-1.09051 +10,0b1..010,1,0,-1.18921 +11,0b1..011,1,0,-1.29684 +12,0b1..100,1,0,-nan(ind) +13,0b1..101,1,0,-0.771105 +14,0b1..110,1,0,-0.840896 +15,0b1..111,1,0,-0.917004 + +"Generate Value table for an LNS<5,0> in CSV format" +#, Binary, sign, scale, value +0,0b0.0000,0,0,1 +1,0b0.0001,0,1,2 +2,0b0.0010,0,2,4 +3,0b0.0011,0,3,8 +4,0b0.0100,0,4,16 +5,0b0.0101,0,5,32 +6,0b0.0110,0,6,64 +7,0b0.0111,0,7,128 +8,0b0.1000,0,-8,0 +9,0b0.1001,0,-7,0.0078125 +10,0b0.1010,0,-6,0.015625 +11,0b0.1011,0,-5,0.03125 +12,0b0.1100,0,-4,0.0625 +13,0b0.1101,0,-3,0.125 +14,0b0.1110,0,-2,0.25 +15,0b0.1111,0,-1,0.5 +16,0b1.0000,1,0,-1 +17,0b1.0001,1,1,-2 +18,0b1.0010,1,2,-4 +19,0b1.0011,1,3,-8 +20,0b1.0100,1,4,-16 +21,0b1.0101,1,5,-32 +22,0b1.0110,1,6,-64 +23,0b1.0111,1,7,-128 +24,0b1.1000,1,-8,-nan(ind) +25,0b1.1001,1,-7,-0.0078125 +26,0b1.1010,1,-6,-0.015625 +27,0b1.1011,1,-5,-0.03125 +28,0b1.1100,1,-4,-0.0625 +29,0b1.1101,1,-3,-0.125 +30,0b1.1110,1,-2,-0.25 +31,0b1.1111,1,-1,-0.5 + +"Generate Value table for an LNS<5,1> in CSV format" +#, Binary, sign, scale, value +0,0b0.000.0,0,0,1 +1,0b0.000.1,0,0,1.41421 +2,0b0.001.0,0,1,2 +3,0b0.001.1,0,1,2.82843 +4,0b0.010.0,0,2,4 +5,0b0.010.1,0,2,5.65685 +6,0b0.011.0,0,3,8 +7,0b0.011.1,0,3,11.3137 +8,0b0.100.0,0,-4,0 +9,0b0.100.1,0,-4,0.0883883 +10,0b0.101.0,0,-3,0.125 +11,0b0.101.1,0,-3,0.176777 +12,0b0.110.0,0,-2,0.25 +13,0b0.110.1,0,-2,0.353553 +14,0b0.111.0,0,-1,0.5 +15,0b0.111.1,0,-1,0.707107 +16,0b1.000.0,1,0,-1 +17,0b1.000.1,1,0,-1.41421 +18,0b1.001.0,1,1,-2 +19,0b1.001.1,1,1,-2.82843 +20,0b1.010.0,1,2,-4 +21,0b1.010.1,1,2,-5.65685 +22,0b1.011.0,1,3,-8 +23,0b1.011.1,1,3,-11.3137 +24,0b1.100.0,1,-4,-nan(ind) +25,0b1.100.1,1,-4,-0.0883883 +26,0b1.101.0,1,-3,-0.125 +27,0b1.101.1,1,-3,-0.176777 +28,0b1.110.0,1,-2,-0.25 +29,0b1.110.1,1,-2,-0.353553 +30,0b1.111.0,1,-1,-0.5 +31,0b1.111.1,1,-1,-0.707107 + +"Generate Value table for an LNS<5,2> in CSV format" +#, Binary, sign, scale, value +0,0b0.00.00,0,0,1 +1,0b0.00.01,0,0,1.18921 +2,0b0.00.10,0,0,1.41421 +3,0b0.00.11,0,0,1.68179 +4,0b0.01.00,0,1,2 +5,0b0.01.01,0,1,2.37841 +6,0b0.01.10,0,1,2.82843 +7,0b0.01.11,0,1,3.36359 +8,0b0.10.00,0,-2,0 +9,0b0.10.01,0,-2,0.297302 +10,0b0.10.10,0,-2,0.353553 +11,0b0.10.11,0,-2,0.420448 +12,0b0.11.00,0,-1,0.5 +13,0b0.11.01,0,-1,0.594604 +14,0b0.11.10,0,-1,0.707107 +15,0b0.11.11,0,-1,0.840896 +16,0b1.00.00,1,0,-1 +17,0b1.00.01,1,0,-1.18921 +18,0b1.00.10,1,0,-1.41421 +19,0b1.00.11,1,0,-1.68179 +20,0b1.01.00,1,1,-2 +21,0b1.01.01,1,1,-2.37841 +22,0b1.01.10,1,1,-2.82843 +23,0b1.01.11,1,1,-3.36359 +24,0b1.10.00,1,-2,-nan(ind) +25,0b1.10.01,1,-2,-0.297302 +26,0b1.10.10,1,-2,-0.353553 +27,0b1.10.11,1,-2,-0.420448 +28,0b1.11.00,1,-1,-0.5 +29,0b1.11.01,1,-1,-0.594604 +30,0b1.11.10,1,-1,-0.707107 +31,0b1.11.11,1,-1,-0.840896 + +"Generate Value table for an LNS<5,3> in CSV format" +#, Binary, sign, scale, value +0,0b0.0.000,0,0,1 +1,0b0.0.001,0,0,1.09051 +2,0b0.0.010,0,0,1.18921 +3,0b0.0.011,0,0,1.29684 +4,0b0.0.100,0,0,1.41421 +5,0b0.0.101,0,0,1.54221 +6,0b0.0.110,0,0,1.68179 +7,0b0.0.111,0,0,1.83401 +8,0b0.1.000,0,-1,0 +9,0b0.1.001,0,-1,0.545254 +10,0b0.1.010,0,-1,0.594604 +11,0b0.1.011,0,-1,0.64842 +12,0b0.1.100,0,-1,0.707107 +13,0b0.1.101,0,-1,0.771105 +14,0b0.1.110,0,-1,0.840896 +15,0b0.1.111,0,-1,0.917004 +16,0b1.0.000,1,0,-1 +17,0b1.0.001,1,0,-1.09051 +18,0b1.0.010,1,0,-1.18921 +19,0b1.0.011,1,0,-1.29684 +20,0b1.0.100,1,0,-1.41421 +21,0b1.0.101,1,0,-1.54221 +22,0b1.0.110,1,0,-1.68179 +23,0b1.0.111,1,0,-1.83401 +24,0b1.1.000,1,-1,-nan(ind) +25,0b1.1.001,1,-1,-0.545254 +26,0b1.1.010,1,-1,-0.594604 +27,0b1.1.011,1,-1,-0.64842 +28,0b1.1.100,1,-1,-0.707107 +29,0b1.1.101,1,-1,-0.771105 +30,0b1.1.110,1,-1,-0.840896 +31,0b1.1.111,1,-1,-0.917004 + +"Generate Value table for an LNS<5,4> in CSV format" +#, Binary, sign, scale, value +0,0b0..0000,0,0,1 +1,0b0..0001,0,0,1.04427 +2,0b0..0010,0,0,1.09051 +3,0b0..0011,0,0,1.13879 +4,0b0..0100,0,0,1.18921 +5,0b0..0101,0,0,1.24186 +6,0b0..0110,0,0,1.29684 +7,0b0..0111,0,0,1.35426 +8,0b0..1000,0,0,0 +9,0b0..1001,0,0,0.738413 +10,0b0..1010,0,0,0.771105 +11,0b0..1011,0,0,0.805245 +12,0b0..1100,0,0,0.840896 +13,0b0..1101,0,0,0.878126 +14,0b0..1110,0,0,0.917004 +15,0b0..1111,0,0,0.957603 +16,0b1..0000,1,0,-1 +17,0b1..0001,1,0,-1.04427 +18,0b1..0010,1,0,-1.09051 +19,0b1..0011,1,0,-1.13879 +20,0b1..0100,1,0,-1.18921 +21,0b1..0101,1,0,-1.24186 +22,0b1..0110,1,0,-1.29684 +23,0b1..0111,1,0,-1.35426 +24,0b1..1000,1,0,-nan(ind) +25,0b1..1001,1,0,-0.738413 +26,0b1..1010,1,0,-0.771105 +27,0b1..1011,1,0,-0.805245 +28,0b1..1100,1,0,-0.840896 +29,0b1..1101,1,0,-0.878126 +30,0b1..1110,1,0,-0.917004 +31,0b1..1111,1,0,-0.957603 + +"Generate Value table for an LNS<6,0> in CSV format" +#, Binary, sign, scale, value +0,0b0.00000,0,0,1 +1,0b0.00001,0,1,2 +2,0b0.00010,0,2,4 +3,0b0.00011,0,3,8 +4,0b0.00100,0,4,16 +5,0b0.00101,0,5,32 +6,0b0.00110,0,6,64 +7,0b0.00111,0,7,128 +8,0b0.01000,0,8,256 +9,0b0.01001,0,9,512 +10,0b0.01010,0,10,1024 +11,0b0.01011,0,11,2048 +12,0b0.01100,0,12,4096 +13,0b0.01101,0,13,8192 +14,0b0.01110,0,14,16384 +15,0b0.01111,0,15,32768 +16,0b0.10000,0,-16,0 +17,0b0.10001,0,-15,3.05176e-05 +18,0b0.10010,0,-14,6.10352e-05 +19,0b0.10011,0,-13,0.00012207 +20,0b0.10100,0,-12,0.000244141 +21,0b0.10101,0,-11,0.000488281 +22,0b0.10110,0,-10,0.000976562 +23,0b0.10111,0,-9,0.00195312 +24,0b0.11000,0,-8,0.00390625 +25,0b0.11001,0,-7,0.0078125 +26,0b0.11010,0,-6,0.015625 +27,0b0.11011,0,-5,0.03125 +28,0b0.11100,0,-4,0.0625 +29,0b0.11101,0,-3,0.125 +30,0b0.11110,0,-2,0.25 +31,0b0.11111,0,-1,0.5 +32,0b1.00000,1,0,-1 +33,0b1.00001,1,1,-2 +34,0b1.00010,1,2,-4 +35,0b1.00011,1,3,-8 +36,0b1.00100,1,4,-16 +37,0b1.00101,1,5,-32 +38,0b1.00110,1,6,-64 +39,0b1.00111,1,7,-128 +40,0b1.01000,1,8,-256 +41,0b1.01001,1,9,-512 +42,0b1.01010,1,10,-1024 +43,0b1.01011,1,11,-2048 +44,0b1.01100,1,12,-4096 +45,0b1.01101,1,13,-8192 +46,0b1.01110,1,14,-16384 +47,0b1.01111,1,15,-32768 +48,0b1.10000,1,-16,-nan(ind) +49,0b1.10001,1,-15,-3.05176e-05 +50,0b1.10010,1,-14,-6.10352e-05 +51,0b1.10011,1,-13,-0.00012207 +52,0b1.10100,1,-12,-0.000244141 +53,0b1.10101,1,-11,-0.000488281 +54,0b1.10110,1,-10,-0.000976562 +55,0b1.10111,1,-9,-0.00195312 +56,0b1.11000,1,-8,-0.00390625 +57,0b1.11001,1,-7,-0.0078125 +58,0b1.11010,1,-6,-0.015625 +59,0b1.11011,1,-5,-0.03125 +60,0b1.11100,1,-4,-0.0625 +61,0b1.11101,1,-3,-0.125 +62,0b1.11110,1,-2,-0.25 +63,0b1.11111,1,-1,-0.5 + +"Generate Value table for an LNS<6,1> in CSV format" +#, Binary, sign, scale, value +0,0b0.0000.0,0,0,1 +1,0b0.0000.1,0,0,1.41421 +2,0b0.0001.0,0,1,2 +3,0b0.0001.1,0,1,2.82843 +4,0b0.0010.0,0,2,4 +5,0b0.0010.1,0,2,5.65685 +6,0b0.0011.0,0,3,8 +7,0b0.0011.1,0,3,11.3137 +8,0b0.0100.0,0,4,16 +9,0b0.0100.1,0,4,22.6274 +10,0b0.0101.0,0,5,32 +11,0b0.0101.1,0,5,45.2548 +12,0b0.0110.0,0,6,64 +13,0b0.0110.1,0,6,90.5097 +14,0b0.0111.0,0,7,128 +15,0b0.0111.1,0,7,181.019 +16,0b0.1000.0,0,-8,0 +17,0b0.1000.1,0,-8,0.00552427 +18,0b0.1001.0,0,-7,0.0078125 +19,0b0.1001.1,0,-7,0.0110485 +20,0b0.1010.0,0,-6,0.015625 +21,0b0.1010.1,0,-6,0.0220971 +22,0b0.1011.0,0,-5,0.03125 +23,0b0.1011.1,0,-5,0.0441942 +24,0b0.1100.0,0,-4,0.0625 +25,0b0.1100.1,0,-4,0.0883883 +26,0b0.1101.0,0,-3,0.125 +27,0b0.1101.1,0,-3,0.176777 +28,0b0.1110.0,0,-2,0.25 +29,0b0.1110.1,0,-2,0.353553 +30,0b0.1111.0,0,-1,0.5 +31,0b0.1111.1,0,-1,0.707107 +32,0b1.0000.0,1,0,-1 +33,0b1.0000.1,1,0,-1.41421 +34,0b1.0001.0,1,1,-2 +35,0b1.0001.1,1,1,-2.82843 +36,0b1.0010.0,1,2,-4 +37,0b1.0010.1,1,2,-5.65685 +38,0b1.0011.0,1,3,-8 +39,0b1.0011.1,1,3,-11.3137 +40,0b1.0100.0,1,4,-16 +41,0b1.0100.1,1,4,-22.6274 +42,0b1.0101.0,1,5,-32 +43,0b1.0101.1,1,5,-45.2548 +44,0b1.0110.0,1,6,-64 +45,0b1.0110.1,1,6,-90.5097 +46,0b1.0111.0,1,7,-128 +47,0b1.0111.1,1,7,-181.019 +48,0b1.1000.0,1,-8,-nan(ind) +49,0b1.1000.1,1,-8,-0.00552427 +50,0b1.1001.0,1,-7,-0.0078125 +51,0b1.1001.1,1,-7,-0.0110485 +52,0b1.1010.0,1,-6,-0.015625 +53,0b1.1010.1,1,-6,-0.0220971 +54,0b1.1011.0,1,-5,-0.03125 +55,0b1.1011.1,1,-5,-0.0441942 +56,0b1.1100.0,1,-4,-0.0625 +57,0b1.1100.1,1,-4,-0.0883883 +58,0b1.1101.0,1,-3,-0.125 +59,0b1.1101.1,1,-3,-0.176777 +60,0b1.1110.0,1,-2,-0.25 +61,0b1.1110.1,1,-2,-0.353553 +62,0b1.1111.0,1,-1,-0.5 +63,0b1.1111.1,1,-1,-0.707107 + +"Generate Value table for an LNS<6,2> in CSV format" +#, Binary, sign, scale, value +0,0b0.000.00,0,0,1 +1,0b0.000.01,0,0,1.18921 +2,0b0.000.10,0,0,1.41421 +3,0b0.000.11,0,0,1.68179 +4,0b0.001.00,0,1,2 +5,0b0.001.01,0,1,2.37841 +6,0b0.001.10,0,1,2.82843 +7,0b0.001.11,0,1,3.36359 +8,0b0.010.00,0,2,4 +9,0b0.010.01,0,2,4.75683 +10,0b0.010.10,0,2,5.65685 +11,0b0.010.11,0,2,6.72717 +12,0b0.011.00,0,3,8 +13,0b0.011.01,0,3,9.51366 +14,0b0.011.10,0,3,11.3137 +15,0b0.011.11,0,3,13.4543 +16,0b0.100.00,0,-4,0 +17,0b0.100.01,0,-4,0.0743254 +18,0b0.100.10,0,-4,0.0883883 +19,0b0.100.11,0,-4,0.105112 +20,0b0.101.00,0,-3,0.125 +21,0b0.101.01,0,-3,0.148651 +22,0b0.101.10,0,-3,0.176777 +23,0b0.101.11,0,-3,0.210224 +24,0b0.110.00,0,-2,0.25 +25,0b0.110.01,0,-2,0.297302 +26,0b0.110.10,0,-2,0.353553 +27,0b0.110.11,0,-2,0.420448 +28,0b0.111.00,0,-1,0.5 +29,0b0.111.01,0,-1,0.594604 +30,0b0.111.10,0,-1,0.707107 +31,0b0.111.11,0,-1,0.840896 +32,0b1.000.00,1,0,-1 +33,0b1.000.01,1,0,-1.18921 +34,0b1.000.10,1,0,-1.41421 +35,0b1.000.11,1,0,-1.68179 +36,0b1.001.00,1,1,-2 +37,0b1.001.01,1,1,-2.37841 +38,0b1.001.10,1,1,-2.82843 +39,0b1.001.11,1,1,-3.36359 +40,0b1.010.00,1,2,-4 +41,0b1.010.01,1,2,-4.75683 +42,0b1.010.10,1,2,-5.65685 +43,0b1.010.11,1,2,-6.72717 +44,0b1.011.00,1,3,-8 +45,0b1.011.01,1,3,-9.51366 +46,0b1.011.10,1,3,-11.3137 +47,0b1.011.11,1,3,-13.4543 +48,0b1.100.00,1,-4,-nan(ind) +49,0b1.100.01,1,-4,-0.0743254 +50,0b1.100.10,1,-4,-0.0883883 +51,0b1.100.11,1,-4,-0.105112 +52,0b1.101.00,1,-3,-0.125 +53,0b1.101.01,1,-3,-0.148651 +54,0b1.101.10,1,-3,-0.176777 +55,0b1.101.11,1,-3,-0.210224 +56,0b1.110.00,1,-2,-0.25 +57,0b1.110.01,1,-2,-0.297302 +58,0b1.110.10,1,-2,-0.353553 +59,0b1.110.11,1,-2,-0.420448 +60,0b1.111.00,1,-1,-0.5 +61,0b1.111.01,1,-1,-0.594604 +62,0b1.111.10,1,-1,-0.707107 +63,0b1.111.11,1,-1,-0.840896 + +"Generate Value table for an LNS<6,3> in CSV format" +#, Binary, sign, scale, value +0,0b0.00.000,0,0,1 +1,0b0.00.001,0,0,1.09051 +2,0b0.00.010,0,0,1.18921 +3,0b0.00.011,0,0,1.29684 +4,0b0.00.100,0,0,1.41421 +5,0b0.00.101,0,0,1.54221 +6,0b0.00.110,0,0,1.68179 +7,0b0.00.111,0,0,1.83401 +8,0b0.01.000,0,1,2 +9,0b0.01.001,0,1,2.18102 +10,0b0.01.010,0,1,2.37841 +11,0b0.01.011,0,1,2.59368 +12,0b0.01.100,0,1,2.82843 +13,0b0.01.101,0,1,3.08442 +14,0b0.01.110,0,1,3.36359 +15,0b0.01.111,0,1,3.66802 +16,0b0.10.000,0,-2,0 +17,0b0.10.001,0,-2,0.272627 +18,0b0.10.010,0,-2,0.297302 +19,0b0.10.011,0,-2,0.32421 +20,0b0.10.100,0,-2,0.353553 +21,0b0.10.101,0,-2,0.385553 +22,0b0.10.110,0,-2,0.420448 +23,0b0.10.111,0,-2,0.458502 +24,0b0.11.000,0,-1,0.5 +25,0b0.11.001,0,-1,0.545254 +26,0b0.11.010,0,-1,0.594604 +27,0b0.11.011,0,-1,0.64842 +28,0b0.11.100,0,-1,0.707107 +29,0b0.11.101,0,-1,0.771105 +30,0b0.11.110,0,-1,0.840896 +31,0b0.11.111,0,-1,0.917004 +32,0b1.00.000,1,0,-1 +33,0b1.00.001,1,0,-1.09051 +34,0b1.00.010,1,0,-1.18921 +35,0b1.00.011,1,0,-1.29684 +36,0b1.00.100,1,0,-1.41421 +37,0b1.00.101,1,0,-1.54221 +38,0b1.00.110,1,0,-1.68179 +39,0b1.00.111,1,0,-1.83401 +40,0b1.01.000,1,1,-2 +41,0b1.01.001,1,1,-2.18102 +42,0b1.01.010,1,1,-2.37841 +43,0b1.01.011,1,1,-2.59368 +44,0b1.01.100,1,1,-2.82843 +45,0b1.01.101,1,1,-3.08442 +46,0b1.01.110,1,1,-3.36359 +47,0b1.01.111,1,1,-3.66802 +48,0b1.10.000,1,-2,-nan(ind) +49,0b1.10.001,1,-2,-0.272627 +50,0b1.10.010,1,-2,-0.297302 +51,0b1.10.011,1,-2,-0.32421 +52,0b1.10.100,1,-2,-0.353553 +53,0b1.10.101,1,-2,-0.385553 +54,0b1.10.110,1,-2,-0.420448 +55,0b1.10.111,1,-2,-0.458502 +56,0b1.11.000,1,-1,-0.5 +57,0b1.11.001,1,-1,-0.545254 +58,0b1.11.010,1,-1,-0.594604 +59,0b1.11.011,1,-1,-0.64842 +60,0b1.11.100,1,-1,-0.707107 +61,0b1.11.101,1,-1,-0.771105 +62,0b1.11.110,1,-1,-0.840896 +63,0b1.11.111,1,-1,-0.917004 + +"Generate Value table for an LNS<6,4> in CSV format" +#, Binary, sign, scale, value +0,0b0.0.0000,0,0,1 +1,0b0.0.0001,0,0,1.04427 +2,0b0.0.0010,0,0,1.09051 +3,0b0.0.0011,0,0,1.13879 +4,0b0.0.0100,0,0,1.18921 +5,0b0.0.0101,0,0,1.24186 +6,0b0.0.0110,0,0,1.29684 +7,0b0.0.0111,0,0,1.35426 +8,0b0.0.1000,0,0,1.41421 +9,0b0.0.1001,0,0,1.47683 +10,0b0.0.1010,0,0,1.54221 +11,0b0.0.1011,0,0,1.61049 +12,0b0.0.1100,0,0,1.68179 +13,0b0.0.1101,0,0,1.75625 +14,0b0.0.1110,0,0,1.83401 +15,0b0.0.1111,0,0,1.91521 +16,0b0.1.0000,0,-1,0 +17,0b0.1.0001,0,-1,0.522137 +18,0b0.1.0010,0,-1,0.545254 +19,0b0.1.0011,0,-1,0.569394 +20,0b0.1.0100,0,-1,0.594604 +21,0b0.1.0101,0,-1,0.620929 +22,0b0.1.0110,0,-1,0.64842 +23,0b0.1.0111,0,-1,0.677128 +24,0b0.1.1000,0,-1,0.707107 +25,0b0.1.1001,0,-1,0.738413 +26,0b0.1.1010,0,-1,0.771105 +27,0b0.1.1011,0,-1,0.805245 +28,0b0.1.1100,0,-1,0.840896 +29,0b0.1.1101,0,-1,0.878126 +30,0b0.1.1110,0,-1,0.917004 +31,0b0.1.1111,0,-1,0.957603 +32,0b1.0.0000,1,0,-1 +33,0b1.0.0001,1,0,-1.04427 +34,0b1.0.0010,1,0,-1.09051 +35,0b1.0.0011,1,0,-1.13879 +36,0b1.0.0100,1,0,-1.18921 +37,0b1.0.0101,1,0,-1.24186 +38,0b1.0.0110,1,0,-1.29684 +39,0b1.0.0111,1,0,-1.35426 +40,0b1.0.1000,1,0,-1.41421 +41,0b1.0.1001,1,0,-1.47683 +42,0b1.0.1010,1,0,-1.54221 +43,0b1.0.1011,1,0,-1.61049 +44,0b1.0.1100,1,0,-1.68179 +45,0b1.0.1101,1,0,-1.75625 +46,0b1.0.1110,1,0,-1.83401 +47,0b1.0.1111,1,0,-1.91521 +48,0b1.1.0000,1,-1,-nan(ind) +49,0b1.1.0001,1,-1,-0.522137 +50,0b1.1.0010,1,-1,-0.545254 +51,0b1.1.0011,1,-1,-0.569394 +52,0b1.1.0100,1,-1,-0.594604 +53,0b1.1.0101,1,-1,-0.620929 +54,0b1.1.0110,1,-1,-0.64842 +55,0b1.1.0111,1,-1,-0.677128 +56,0b1.1.1000,1,-1,-0.707107 +57,0b1.1.1001,1,-1,-0.738413 +58,0b1.1.1010,1,-1,-0.771105 +59,0b1.1.1011,1,-1,-0.805245 +60,0b1.1.1100,1,-1,-0.840896 +61,0b1.1.1101,1,-1,-0.878126 +62,0b1.1.1110,1,-1,-0.917004 +63,0b1.1.1111,1,-1,-0.957603 + +"Generate Value table for an LNS<6,5> in CSV format" +#, Binary, sign, scale, value +0,0b0..00000,0,0,1 +1,0b0..00001,0,0,1.0219 +2,0b0..00010,0,0,1.04427 +3,0b0..00011,0,0,1.06714 +4,0b0..00100,0,0,1.09051 +5,0b0..00101,0,0,1.11439 +6,0b0..00110,0,0,1.13879 +7,0b0..00111,0,0,1.16372 +8,0b0..01000,0,0,1.18921 +9,0b0..01001,0,0,1.21525 +10,0b0..01010,0,0,1.24186 +11,0b0..01011,0,0,1.26905 +12,0b0..01100,0,0,1.29684 +13,0b0..01101,0,0,1.32524 +14,0b0..01110,0,0,1.35426 +15,0b0..01111,0,0,1.38391 +16,0b0..10000,0,0,0 +17,0b0..10001,0,0,0.72259 +18,0b0..10010,0,0,0.738413 +19,0b0..10011,0,0,0.754582 +20,0b0..10100,0,0,0.771105 +21,0b0..10101,0,0,0.78799 +22,0b0..10110,0,0,0.805245 +23,0b0..10111,0,0,0.822878 +24,0b0..11000,0,0,0.840896 +25,0b0..11001,0,0,0.85931 +26,0b0..11010,0,0,0.878126 +27,0b0..11011,0,0,0.897355 +28,0b0..11100,0,0,0.917004 +29,0b0..11101,0,0,0.937084 +30,0b0..11110,0,0,0.957603 +31,0b0..11111,0,0,0.978572 +32,0b1..00000,1,0,-1 +33,0b1..00001,1,0,-1.0219 +34,0b1..00010,1,0,-1.04427 +35,0b1..00011,1,0,-1.06714 +36,0b1..00100,1,0,-1.09051 +37,0b1..00101,1,0,-1.11439 +38,0b1..00110,1,0,-1.13879 +39,0b1..00111,1,0,-1.16372 +40,0b1..01000,1,0,-1.18921 +41,0b1..01001,1,0,-1.21525 +42,0b1..01010,1,0,-1.24186 +43,0b1..01011,1,0,-1.26905 +44,0b1..01100,1,0,-1.29684 +45,0b1..01101,1,0,-1.32524 +46,0b1..01110,1,0,-1.35426 +47,0b1..01111,1,0,-1.38391 +48,0b1..10000,1,0,-nan(ind) +49,0b1..10001,1,0,-0.72259 +50,0b1..10010,1,0,-0.738413 +51,0b1..10011,1,0,-0.754582 +52,0b1..10100,1,0,-0.771105 +53,0b1..10101,1,0,-0.78799 +54,0b1..10110,1,0,-0.805245 +55,0b1..10111,1,0,-0.822878 +56,0b1..11000,1,0,-0.840896 +57,0b1..11001,1,0,-0.85931 +58,0b1..11010,1,0,-0.878126 +59,0b1..11011,1,0,-0.897355 +60,0b1..11100,1,0,-0.917004 +61,0b1..11101,1,0,-0.937084 +62,0b1..11110,1,0,-0.957603 +63,0b1..11111,1,0,-0.978572 + +"Generate Value table for an LNS<8,0> in CSV format" +#, Binary, sign, scale, value +0,0b0.0000000,0,0,1 +1,0b0.0000001,0,1,2 +2,0b0.0000010,0,2,4 +3,0b0.0000011,0,3,8 +4,0b0.0000100,0,4,16 +5,0b0.0000101,0,5,32 +6,0b0.0000110,0,6,64 +7,0b0.0000111,0,7,128 +8,0b0.0001000,0,8,256 +9,0b0.0001001,0,9,512 +10,0b0.0001010,0,10,1024 +11,0b0.0001011,0,11,2048 +12,0b0.0001100,0,12,4096 +13,0b0.0001101,0,13,8192 +14,0b0.0001110,0,14,16384 +15,0b0.0001111,0,15,32768 +16,0b0.0010000,0,16,65536 +17,0b0.0010001,0,17,131072 +18,0b0.0010010,0,18,262144 +19,0b0.0010011,0,19,524288 +20,0b0.0010100,0,20,1.04858e+06 +21,0b0.0010101,0,21,2.09715e+06 +22,0b0.0010110,0,22,4.1943e+06 +23,0b0.0010111,0,23,8.38861e+06 +24,0b0.0011000,0,24,1.67772e+07 +25,0b0.0011001,0,25,3.35544e+07 +26,0b0.0011010,0,26,6.71089e+07 +27,0b0.0011011,0,27,1.34218e+08 +28,0b0.0011100,0,28,2.68435e+08 +29,0b0.0011101,0,29,5.36871e+08 +30,0b0.0011110,0,30,1.07374e+09 +31,0b0.0011111,0,31,2.14748e+09 +32,0b0.0100000,0,32,4.29497e+09 +33,0b0.0100001,0,33,8.58993e+09 +34,0b0.0100010,0,34,1.71799e+10 +35,0b0.0100011,0,35,3.43597e+10 +36,0b0.0100100,0,36,6.87195e+10 +37,0b0.0100101,0,37,1.37439e+11 +38,0b0.0100110,0,38,2.74878e+11 +39,0b0.0100111,0,39,5.49756e+11 +40,0b0.0101000,0,40,1.09951e+12 +41,0b0.0101001,0,41,2.19902e+12 +42,0b0.0101010,0,42,4.39805e+12 +43,0b0.0101011,0,43,8.79609e+12 +44,0b0.0101100,0,44,1.75922e+13 +45,0b0.0101101,0,45,3.51844e+13 +46,0b0.0101110,0,46,7.03687e+13 +47,0b0.0101111,0,47,1.40737e+14 +48,0b0.0110000,0,48,2.81475e+14 +49,0b0.0110001,0,49,5.6295e+14 +50,0b0.0110010,0,50,1.1259e+15 +51,0b0.0110011,0,51,2.2518e+15 +52,0b0.0110100,0,52,4.5036e+15 +53,0b0.0110101,0,53,9.0072e+15 +54,0b0.0110110,0,54,1.80144e+16 +55,0b0.0110111,0,55,3.60288e+16 +56,0b0.0111000,0,56,7.20576e+16 +57,0b0.0111001,0,57,1.44115e+17 +58,0b0.0111010,0,58,2.8823e+17 +59,0b0.0111011,0,59,5.76461e+17 +60,0b0.0111100,0,60,1.15292e+18 +61,0b0.0111101,0,61,2.30584e+18 +62,0b0.0111110,0,62,4.61169e+18 +63,0b0.0111111,0,63,9.22337e+18 +64,0b0.1000000,0,-64,0 +65,0b0.1000001,0,-63,1.0842e-19 +66,0b0.1000010,0,-62,2.1684e-19 +67,0b0.1000011,0,-61,4.33681e-19 +68,0b0.1000100,0,-60,8.67362e-19 +69,0b0.1000101,0,-59,1.73472e-18 +70,0b0.1000110,0,-58,3.46945e-18 +71,0b0.1000111,0,-57,6.93889e-18 +72,0b0.1001000,0,-56,1.38778e-17 +73,0b0.1001001,0,-55,2.77556e-17 +74,0b0.1001010,0,-54,5.55112e-17 +75,0b0.1001011,0,-53,1.11022e-16 +76,0b0.1001100,0,-52,2.22045e-16 +77,0b0.1001101,0,-51,4.44089e-16 +78,0b0.1001110,0,-50,8.88178e-16 +79,0b0.1001111,0,-49,1.77636e-15 +80,0b0.1010000,0,-48,3.55271e-15 +81,0b0.1010001,0,-47,7.10543e-15 +82,0b0.1010010,0,-46,1.42109e-14 +83,0b0.1010011,0,-45,2.84217e-14 +84,0b0.1010100,0,-44,5.68434e-14 +85,0b0.1010101,0,-43,1.13687e-13 +86,0b0.1010110,0,-42,2.27374e-13 +87,0b0.1010111,0,-41,4.54747e-13 +88,0b0.1011000,0,-40,9.09495e-13 +89,0b0.1011001,0,-39,1.81899e-12 +90,0b0.1011010,0,-38,3.63798e-12 +91,0b0.1011011,0,-37,7.27596e-12 +92,0b0.1011100,0,-36,1.45519e-11 +93,0b0.1011101,0,-35,2.91038e-11 +94,0b0.1011110,0,-34,5.82077e-11 +95,0b0.1011111,0,-33,1.16415e-10 +96,0b0.1100000,0,-32,2.32831e-10 +97,0b0.1100001,0,-31,4.65661e-10 +98,0b0.1100010,0,-30,9.31323e-10 +99,0b0.1100011,0,-29,1.86265e-09 +100,0b0.1100100,0,-28,3.72529e-09 +101,0b0.1100101,0,-27,7.45058e-09 +102,0b0.1100110,0,-26,1.49012e-08 +103,0b0.1100111,0,-25,2.98023e-08 +104,0b0.1101000,0,-24,5.96046e-08 +105,0b0.1101001,0,-23,1.19209e-07 +106,0b0.1101010,0,-22,2.38419e-07 +107,0b0.1101011,0,-21,4.76837e-07 +108,0b0.1101100,0,-20,9.53674e-07 +109,0b0.1101101,0,-19,1.90735e-06 +110,0b0.1101110,0,-18,3.8147e-06 +111,0b0.1101111,0,-17,7.62939e-06 +112,0b0.1110000,0,-16,1.52588e-05 +113,0b0.1110001,0,-15,3.05176e-05 +114,0b0.1110010,0,-14,6.10352e-05 +115,0b0.1110011,0,-13,0.00012207 +116,0b0.1110100,0,-12,0.000244141 +117,0b0.1110101,0,-11,0.000488281 +118,0b0.1110110,0,-10,0.000976562 +119,0b0.1110111,0,-9,0.00195312 +120,0b0.1111000,0,-8,0.00390625 +121,0b0.1111001,0,-7,0.0078125 +122,0b0.1111010,0,-6,0.015625 +123,0b0.1111011,0,-5,0.03125 +124,0b0.1111100,0,-4,0.0625 +125,0b0.1111101,0,-3,0.125 +126,0b0.1111110,0,-2,0.25 +127,0b0.1111111,0,-1,0.5 +128,0b1.0000000,1,0,-1 +129,0b1.0000001,1,1,-2 +130,0b1.0000010,1,2,-4 +131,0b1.0000011,1,3,-8 +132,0b1.0000100,1,4,-16 +133,0b1.0000101,1,5,-32 +134,0b1.0000110,1,6,-64 +135,0b1.0000111,1,7,-128 +136,0b1.0001000,1,8,-256 +137,0b1.0001001,1,9,-512 +138,0b1.0001010,1,10,-1024 +139,0b1.0001011,1,11,-2048 +140,0b1.0001100,1,12,-4096 +141,0b1.0001101,1,13,-8192 +142,0b1.0001110,1,14,-16384 +143,0b1.0001111,1,15,-32768 +144,0b1.0010000,1,16,-65536 +145,0b1.0010001,1,17,-131072 +146,0b1.0010010,1,18,-262144 +147,0b1.0010011,1,19,-524288 +148,0b1.0010100,1,20,-1.04858e+06 +149,0b1.0010101,1,21,-2.09715e+06 +150,0b1.0010110,1,22,-4.1943e+06 +151,0b1.0010111,1,23,-8.38861e+06 +152,0b1.0011000,1,24,-1.67772e+07 +153,0b1.0011001,1,25,-3.35544e+07 +154,0b1.0011010,1,26,-6.71089e+07 +155,0b1.0011011,1,27,-1.34218e+08 +156,0b1.0011100,1,28,-2.68435e+08 +157,0b1.0011101,1,29,-5.36871e+08 +158,0b1.0011110,1,30,-1.07374e+09 +159,0b1.0011111,1,31,-2.14748e+09 +160,0b1.0100000,1,32,-4.29497e+09 +161,0b1.0100001,1,33,-8.58993e+09 +162,0b1.0100010,1,34,-1.71799e+10 +163,0b1.0100011,1,35,-3.43597e+10 +164,0b1.0100100,1,36,-6.87195e+10 +165,0b1.0100101,1,37,-1.37439e+11 +166,0b1.0100110,1,38,-2.74878e+11 +167,0b1.0100111,1,39,-5.49756e+11 +168,0b1.0101000,1,40,-1.09951e+12 +169,0b1.0101001,1,41,-2.19902e+12 +170,0b1.0101010,1,42,-4.39805e+12 +171,0b1.0101011,1,43,-8.79609e+12 +172,0b1.0101100,1,44,-1.75922e+13 +173,0b1.0101101,1,45,-3.51844e+13 +174,0b1.0101110,1,46,-7.03687e+13 +175,0b1.0101111,1,47,-1.40737e+14 +176,0b1.0110000,1,48,-2.81475e+14 +177,0b1.0110001,1,49,-5.6295e+14 +178,0b1.0110010,1,50,-1.1259e+15 +179,0b1.0110011,1,51,-2.2518e+15 +180,0b1.0110100,1,52,-4.5036e+15 +181,0b1.0110101,1,53,-9.0072e+15 +182,0b1.0110110,1,54,-1.80144e+16 +183,0b1.0110111,1,55,-3.60288e+16 +184,0b1.0111000,1,56,-7.20576e+16 +185,0b1.0111001,1,57,-1.44115e+17 +186,0b1.0111010,1,58,-2.8823e+17 +187,0b1.0111011,1,59,-5.76461e+17 +188,0b1.0111100,1,60,-1.15292e+18 +189,0b1.0111101,1,61,-2.30584e+18 +190,0b1.0111110,1,62,-4.61169e+18 +191,0b1.0111111,1,63,-9.22337e+18 +192,0b1.1000000,1,-64,-nan(ind) +193,0b1.1000001,1,-63,-1.0842e-19 +194,0b1.1000010,1,-62,-2.1684e-19 +195,0b1.1000011,1,-61,-4.33681e-19 +196,0b1.1000100,1,-60,-8.67362e-19 +197,0b1.1000101,1,-59,-1.73472e-18 +198,0b1.1000110,1,-58,-3.46945e-18 +199,0b1.1000111,1,-57,-6.93889e-18 +200,0b1.1001000,1,-56,-1.38778e-17 +201,0b1.1001001,1,-55,-2.77556e-17 +202,0b1.1001010,1,-54,-5.55112e-17 +203,0b1.1001011,1,-53,-1.11022e-16 +204,0b1.1001100,1,-52,-2.22045e-16 +205,0b1.1001101,1,-51,-4.44089e-16 +206,0b1.1001110,1,-50,-8.88178e-16 +207,0b1.1001111,1,-49,-1.77636e-15 +208,0b1.1010000,1,-48,-3.55271e-15 +209,0b1.1010001,1,-47,-7.10543e-15 +210,0b1.1010010,1,-46,-1.42109e-14 +211,0b1.1010011,1,-45,-2.84217e-14 +212,0b1.1010100,1,-44,-5.68434e-14 +213,0b1.1010101,1,-43,-1.13687e-13 +214,0b1.1010110,1,-42,-2.27374e-13 +215,0b1.1010111,1,-41,-4.54747e-13 +216,0b1.1011000,1,-40,-9.09495e-13 +217,0b1.1011001,1,-39,-1.81899e-12 +218,0b1.1011010,1,-38,-3.63798e-12 +219,0b1.1011011,1,-37,-7.27596e-12 +220,0b1.1011100,1,-36,-1.45519e-11 +221,0b1.1011101,1,-35,-2.91038e-11 +222,0b1.1011110,1,-34,-5.82077e-11 +223,0b1.1011111,1,-33,-1.16415e-10 +224,0b1.1100000,1,-32,-2.32831e-10 +225,0b1.1100001,1,-31,-4.65661e-10 +226,0b1.1100010,1,-30,-9.31323e-10 +227,0b1.1100011,1,-29,-1.86265e-09 +228,0b1.1100100,1,-28,-3.72529e-09 +229,0b1.1100101,1,-27,-7.45058e-09 +230,0b1.1100110,1,-26,-1.49012e-08 +231,0b1.1100111,1,-25,-2.98023e-08 +232,0b1.1101000,1,-24,-5.96046e-08 +233,0b1.1101001,1,-23,-1.19209e-07 +234,0b1.1101010,1,-22,-2.38419e-07 +235,0b1.1101011,1,-21,-4.76837e-07 +236,0b1.1101100,1,-20,-9.53674e-07 +237,0b1.1101101,1,-19,-1.90735e-06 +238,0b1.1101110,1,-18,-3.8147e-06 +239,0b1.1101111,1,-17,-7.62939e-06 +240,0b1.1110000,1,-16,-1.52588e-05 +241,0b1.1110001,1,-15,-3.05176e-05 +242,0b1.1110010,1,-14,-6.10352e-05 +243,0b1.1110011,1,-13,-0.00012207 +244,0b1.1110100,1,-12,-0.000244141 +245,0b1.1110101,1,-11,-0.000488281 +246,0b1.1110110,1,-10,-0.000976562 +247,0b1.1110111,1,-9,-0.00195312 +248,0b1.1111000,1,-8,-0.00390625 +249,0b1.1111001,1,-7,-0.0078125 +250,0b1.1111010,1,-6,-0.015625 +251,0b1.1111011,1,-5,-0.03125 +252,0b1.1111100,1,-4,-0.0625 +253,0b1.1111101,1,-3,-0.125 +254,0b1.1111110,1,-2,-0.25 +255,0b1.1111111,1,-1,-0.5 + +"Generate Value table for an LNS<8,1> in CSV format" +#, Binary, sign, scale, value +0,0b0.000000.0,0,0,1 +1,0b0.000000.1,0,0,1.41421 +2,0b0.000001.0,0,1,2 +3,0b0.000001.1,0,1,2.82843 +4,0b0.000010.0,0,2,4 +5,0b0.000010.1,0,2,5.65685 +6,0b0.000011.0,0,3,8 +7,0b0.000011.1,0,3,11.3137 +8,0b0.000100.0,0,4,16 +9,0b0.000100.1,0,4,22.6274 +10,0b0.000101.0,0,5,32 +11,0b0.000101.1,0,5,45.2548 +12,0b0.000110.0,0,6,64 +13,0b0.000110.1,0,6,90.5097 +14,0b0.000111.0,0,7,128 +15,0b0.000111.1,0,7,181.019 +16,0b0.001000.0,0,8,256 +17,0b0.001000.1,0,8,362.039 +18,0b0.001001.0,0,9,512 +19,0b0.001001.1,0,9,724.077 +20,0b0.001010.0,0,10,1024 +21,0b0.001010.1,0,10,1448.15 +22,0b0.001011.0,0,11,2048 +23,0b0.001011.1,0,11,2896.31 +24,0b0.001100.0,0,12,4096 +25,0b0.001100.1,0,12,5792.62 +26,0b0.001101.0,0,13,8192 +27,0b0.001101.1,0,13,11585.2 +28,0b0.001110.0,0,14,16384 +29,0b0.001110.1,0,14,23170.5 +30,0b0.001111.0,0,15,32768 +31,0b0.001111.1,0,15,46341 +32,0b0.010000.0,0,16,65536 +33,0b0.010000.1,0,16,92681.9 +34,0b0.010001.0,0,17,131072 +35,0b0.010001.1,0,17,185364 +36,0b0.010010.0,0,18,262144 +37,0b0.010010.1,0,18,370728 +38,0b0.010011.0,0,19,524288 +39,0b0.010011.1,0,19,741455 +40,0b0.010100.0,0,20,1.04858e+06 +41,0b0.010100.1,0,20,1.48291e+06 +42,0b0.010101.0,0,21,2.09715e+06 +43,0b0.010101.1,0,21,2.96582e+06 +44,0b0.010110.0,0,22,4.1943e+06 +45,0b0.010110.1,0,22,5.93164e+06 +46,0b0.010111.0,0,23,8.38861e+06 +47,0b0.010111.1,0,23,1.18633e+07 +48,0b0.011000.0,0,24,1.67772e+07 +49,0b0.011000.1,0,24,2.37266e+07 +50,0b0.011001.0,0,25,3.35544e+07 +51,0b0.011001.1,0,25,4.74531e+07 +52,0b0.011010.0,0,26,6.71089e+07 +53,0b0.011010.1,0,26,9.49063e+07 +54,0b0.011011.0,0,27,1.34218e+08 +55,0b0.011011.1,0,27,1.89813e+08 +56,0b0.011100.0,0,28,2.68435e+08 +57,0b0.011100.1,0,28,3.79625e+08 +58,0b0.011101.0,0,29,5.36871e+08 +59,0b0.011101.1,0,29,7.5925e+08 +60,0b0.011110.0,0,30,1.07374e+09 +61,0b0.011110.1,0,30,1.5185e+09 +62,0b0.011111.0,0,31,2.14748e+09 +63,0b0.011111.1,0,31,3.037e+09 +64,0b0.100000.0,0,-32,0 +65,0b0.100000.1,0,-32,3.29272e-10 +66,0b0.100001.0,0,-31,4.65661e-10 +67,0b0.100001.1,0,-31,6.58545e-10 +68,0b0.100010.0,0,-30,9.31323e-10 +69,0b0.100010.1,0,-30,1.31709e-09 +70,0b0.100011.0,0,-29,1.86265e-09 +71,0b0.100011.1,0,-29,2.63418e-09 +72,0b0.100100.0,0,-28,3.72529e-09 +73,0b0.100100.1,0,-28,5.26836e-09 +74,0b0.100101.0,0,-27,7.45058e-09 +75,0b0.100101.1,0,-27,1.05367e-08 +76,0b0.100110.0,0,-26,1.49012e-08 +77,0b0.100110.1,0,-26,2.10734e-08 +78,0b0.100111.0,0,-25,2.98023e-08 +79,0b0.100111.1,0,-25,4.21468e-08 +80,0b0.101000.0,0,-24,5.96046e-08 +81,0b0.101000.1,0,-24,8.42937e-08 +82,0b0.101001.0,0,-23,1.19209e-07 +83,0b0.101001.1,0,-23,1.68587e-07 +84,0b0.101010.0,0,-22,2.38419e-07 +85,0b0.101010.1,0,-22,3.37175e-07 +86,0b0.101011.0,0,-21,4.76837e-07 +87,0b0.101011.1,0,-21,6.7435e-07 +88,0b0.101100.0,0,-20,9.53674e-07 +89,0b0.101100.1,0,-20,1.3487e-06 +90,0b0.101101.0,0,-19,1.90735e-06 +91,0b0.101101.1,0,-19,2.6974e-06 +92,0b0.101110.0,0,-18,3.8147e-06 +93,0b0.101110.1,0,-18,5.3948e-06 +94,0b0.101111.0,0,-17,7.62939e-06 +95,0b0.101111.1,0,-17,1.07896e-05 +96,0b0.110000.0,0,-16,1.52588e-05 +97,0b0.110000.1,0,-16,2.15792e-05 +98,0b0.110001.0,0,-15,3.05176e-05 +99,0b0.110001.1,0,-15,4.31584e-05 +100,0b0.110010.0,0,-14,6.10352e-05 +101,0b0.110010.1,0,-14,8.63167e-05 +102,0b0.110011.0,0,-13,0.00012207 +103,0b0.110011.1,0,-13,0.000172633 +104,0b0.110100.0,0,-12,0.000244141 +105,0b0.110100.1,0,-12,0.000345267 +106,0b0.110101.0,0,-11,0.000488281 +107,0b0.110101.1,0,-11,0.000690534 +108,0b0.110110.0,0,-10,0.000976562 +109,0b0.110110.1,0,-10,0.00138107 +110,0b0.110111.0,0,-9,0.00195312 +111,0b0.110111.1,0,-9,0.00276214 +112,0b0.111000.0,0,-8,0.00390625 +113,0b0.111000.1,0,-8,0.00552427 +114,0b0.111001.0,0,-7,0.0078125 +115,0b0.111001.1,0,-7,0.0110485 +116,0b0.111010.0,0,-6,0.015625 +117,0b0.111010.1,0,-6,0.0220971 +118,0b0.111011.0,0,-5,0.03125 +119,0b0.111011.1,0,-5,0.0441942 +120,0b0.111100.0,0,-4,0.0625 +121,0b0.111100.1,0,-4,0.0883883 +122,0b0.111101.0,0,-3,0.125 +123,0b0.111101.1,0,-3,0.176777 +124,0b0.111110.0,0,-2,0.25 +125,0b0.111110.1,0,-2,0.353553 +126,0b0.111111.0,0,-1,0.5 +127,0b0.111111.1,0,-1,0.707107 +128,0b1.000000.0,1,0,-1 +129,0b1.000000.1,1,0,-1.41421 +130,0b1.000001.0,1,1,-2 +131,0b1.000001.1,1,1,-2.82843 +132,0b1.000010.0,1,2,-4 +133,0b1.000010.1,1,2,-5.65685 +134,0b1.000011.0,1,3,-8 +135,0b1.000011.1,1,3,-11.3137 +136,0b1.000100.0,1,4,-16 +137,0b1.000100.1,1,4,-22.6274 +138,0b1.000101.0,1,5,-32 +139,0b1.000101.1,1,5,-45.2548 +140,0b1.000110.0,1,6,-64 +141,0b1.000110.1,1,6,-90.5097 +142,0b1.000111.0,1,7,-128 +143,0b1.000111.1,1,7,-181.019 +144,0b1.001000.0,1,8,-256 +145,0b1.001000.1,1,8,-362.039 +146,0b1.001001.0,1,9,-512 +147,0b1.001001.1,1,9,-724.077 +148,0b1.001010.0,1,10,-1024 +149,0b1.001010.1,1,10,-1448.15 +150,0b1.001011.0,1,11,-2048 +151,0b1.001011.1,1,11,-2896.31 +152,0b1.001100.0,1,12,-4096 +153,0b1.001100.1,1,12,-5792.62 +154,0b1.001101.0,1,13,-8192 +155,0b1.001101.1,1,13,-11585.2 +156,0b1.001110.0,1,14,-16384 +157,0b1.001110.1,1,14,-23170.5 +158,0b1.001111.0,1,15,-32768 +159,0b1.001111.1,1,15,-46341 +160,0b1.010000.0,1,16,-65536 +161,0b1.010000.1,1,16,-92681.9 +162,0b1.010001.0,1,17,-131072 +163,0b1.010001.1,1,17,-185364 +164,0b1.010010.0,1,18,-262144 +165,0b1.010010.1,1,18,-370728 +166,0b1.010011.0,1,19,-524288 +167,0b1.010011.1,1,19,-741455 +168,0b1.010100.0,1,20,-1.04858e+06 +169,0b1.010100.1,1,20,-1.48291e+06 +170,0b1.010101.0,1,21,-2.09715e+06 +171,0b1.010101.1,1,21,-2.96582e+06 +172,0b1.010110.0,1,22,-4.1943e+06 +173,0b1.010110.1,1,22,-5.93164e+06 +174,0b1.010111.0,1,23,-8.38861e+06 +175,0b1.010111.1,1,23,-1.18633e+07 +176,0b1.011000.0,1,24,-1.67772e+07 +177,0b1.011000.1,1,24,-2.37266e+07 +178,0b1.011001.0,1,25,-3.35544e+07 +179,0b1.011001.1,1,25,-4.74531e+07 +180,0b1.011010.0,1,26,-6.71089e+07 +181,0b1.011010.1,1,26,-9.49063e+07 +182,0b1.011011.0,1,27,-1.34218e+08 +183,0b1.011011.1,1,27,-1.89813e+08 +184,0b1.011100.0,1,28,-2.68435e+08 +185,0b1.011100.1,1,28,-3.79625e+08 +186,0b1.011101.0,1,29,-5.36871e+08 +187,0b1.011101.1,1,29,-7.5925e+08 +188,0b1.011110.0,1,30,-1.07374e+09 +189,0b1.011110.1,1,30,-1.5185e+09 +190,0b1.011111.0,1,31,-2.14748e+09 +191,0b1.011111.1,1,31,-3.037e+09 +192,0b1.100000.0,1,-32,-nan(ind) +193,0b1.100000.1,1,-32,-3.29272e-10 +194,0b1.100001.0,1,-31,-4.65661e-10 +195,0b1.100001.1,1,-31,-6.58545e-10 +196,0b1.100010.0,1,-30,-9.31323e-10 +197,0b1.100010.1,1,-30,-1.31709e-09 +198,0b1.100011.0,1,-29,-1.86265e-09 +199,0b1.100011.1,1,-29,-2.63418e-09 +200,0b1.100100.0,1,-28,-3.72529e-09 +201,0b1.100100.1,1,-28,-5.26836e-09 +202,0b1.100101.0,1,-27,-7.45058e-09 +203,0b1.100101.1,1,-27,-1.05367e-08 +204,0b1.100110.0,1,-26,-1.49012e-08 +205,0b1.100110.1,1,-26,-2.10734e-08 +206,0b1.100111.0,1,-25,-2.98023e-08 +207,0b1.100111.1,1,-25,-4.21468e-08 +208,0b1.101000.0,1,-24,-5.96046e-08 +209,0b1.101000.1,1,-24,-8.42937e-08 +210,0b1.101001.0,1,-23,-1.19209e-07 +211,0b1.101001.1,1,-23,-1.68587e-07 +212,0b1.101010.0,1,-22,-2.38419e-07 +213,0b1.101010.1,1,-22,-3.37175e-07 +214,0b1.101011.0,1,-21,-4.76837e-07 +215,0b1.101011.1,1,-21,-6.7435e-07 +216,0b1.101100.0,1,-20,-9.53674e-07 +217,0b1.101100.1,1,-20,-1.3487e-06 +218,0b1.101101.0,1,-19,-1.90735e-06 +219,0b1.101101.1,1,-19,-2.6974e-06 +220,0b1.101110.0,1,-18,-3.8147e-06 +221,0b1.101110.1,1,-18,-5.3948e-06 +222,0b1.101111.0,1,-17,-7.62939e-06 +223,0b1.101111.1,1,-17,-1.07896e-05 +224,0b1.110000.0,1,-16,-1.52588e-05 +225,0b1.110000.1,1,-16,-2.15792e-05 +226,0b1.110001.0,1,-15,-3.05176e-05 +227,0b1.110001.1,1,-15,-4.31584e-05 +228,0b1.110010.0,1,-14,-6.10352e-05 +229,0b1.110010.1,1,-14,-8.63167e-05 +230,0b1.110011.0,1,-13,-0.00012207 +231,0b1.110011.1,1,-13,-0.000172633 +232,0b1.110100.0,1,-12,-0.000244141 +233,0b1.110100.1,1,-12,-0.000345267 +234,0b1.110101.0,1,-11,-0.000488281 +235,0b1.110101.1,1,-11,-0.000690534 +236,0b1.110110.0,1,-10,-0.000976562 +237,0b1.110110.1,1,-10,-0.00138107 +238,0b1.110111.0,1,-9,-0.00195312 +239,0b1.110111.1,1,-9,-0.00276214 +240,0b1.111000.0,1,-8,-0.00390625 +241,0b1.111000.1,1,-8,-0.00552427 +242,0b1.111001.0,1,-7,-0.0078125 +243,0b1.111001.1,1,-7,-0.0110485 +244,0b1.111010.0,1,-6,-0.015625 +245,0b1.111010.1,1,-6,-0.0220971 +246,0b1.111011.0,1,-5,-0.03125 +247,0b1.111011.1,1,-5,-0.0441942 +248,0b1.111100.0,1,-4,-0.0625 +249,0b1.111100.1,1,-4,-0.0883883 +250,0b1.111101.0,1,-3,-0.125 +251,0b1.111101.1,1,-3,-0.176777 +252,0b1.111110.0,1,-2,-0.25 +253,0b1.111110.1,1,-2,-0.353553 +254,0b1.111111.0,1,-1,-0.5 +255,0b1.111111.1,1,-1,-0.707107 + +"Generate Value table for an LNS<8,2> in CSV format" +#, Binary, sign, scale, value +0,0b0.00000.00,0,0,1 +1,0b0.00000.01,0,0,1.18921 +2,0b0.00000.10,0,0,1.41421 +3,0b0.00000.11,0,0,1.68179 +4,0b0.00001.00,0,1,2 +5,0b0.00001.01,0,1,2.37841 +6,0b0.00001.10,0,1,2.82843 +7,0b0.00001.11,0,1,3.36359 +8,0b0.00010.00,0,2,4 +9,0b0.00010.01,0,2,4.75683 +10,0b0.00010.10,0,2,5.65685 +11,0b0.00010.11,0,2,6.72717 +12,0b0.00011.00,0,3,8 +13,0b0.00011.01,0,3,9.51366 +14,0b0.00011.10,0,3,11.3137 +15,0b0.00011.11,0,3,13.4543 +16,0b0.00100.00,0,4,16 +17,0b0.00100.01,0,4,19.0273 +18,0b0.00100.10,0,4,22.6274 +19,0b0.00100.11,0,4,26.9087 +20,0b0.00101.00,0,5,32 +21,0b0.00101.01,0,5,38.0546 +22,0b0.00101.10,0,5,45.2548 +23,0b0.00101.11,0,5,53.8174 +24,0b0.00110.00,0,6,64 +25,0b0.00110.01,0,6,76.1093 +26,0b0.00110.10,0,6,90.5097 +27,0b0.00110.11,0,6,107.635 +28,0b0.00111.00,0,7,128 +29,0b0.00111.01,0,7,152.219 +30,0b0.00111.10,0,7,181.019 +31,0b0.00111.11,0,7,215.269 +32,0b0.01000.00,0,8,256 +33,0b0.01000.01,0,8,304.437 +34,0b0.01000.10,0,8,362.039 +35,0b0.01000.11,0,8,430.539 +36,0b0.01001.00,0,9,512 +37,0b0.01001.01,0,9,608.874 +38,0b0.01001.10,0,9,724.077 +39,0b0.01001.11,0,9,861.078 +40,0b0.01010.00,0,10,1024 +41,0b0.01010.01,0,10,1217.75 +42,0b0.01010.10,0,10,1448.15 +43,0b0.01010.11,0,10,1722.16 +44,0b0.01011.00,0,11,2048 +45,0b0.01011.01,0,11,2435.5 +46,0b0.01011.10,0,11,2896.31 +47,0b0.01011.11,0,11,3444.31 +48,0b0.01100.00,0,12,4096 +49,0b0.01100.01,0,12,4870.99 +50,0b0.01100.10,0,12,5792.62 +51,0b0.01100.11,0,12,6888.62 +52,0b0.01101.00,0,13,8192 +53,0b0.01101.01,0,13,9741.98 +54,0b0.01101.10,0,13,11585.2 +55,0b0.01101.11,0,13,13777.2 +56,0b0.01110.00,0,14,16384 +57,0b0.01110.01,0,14,19484 +58,0b0.01110.10,0,14,23170.5 +59,0b0.01110.11,0,14,27554.5 +60,0b0.01111.00,0,15,32768 +61,0b0.01111.01,0,15,38967.9 +62,0b0.01111.10,0,15,46341 +63,0b0.01111.11,0,15,55109 +64,0b0.10000.00,0,-16,0 +65,0b0.10000.01,0,-16,1.81459e-05 +66,0b0.10000.10,0,-16,2.15792e-05 +67,0b0.10000.11,0,-16,2.56621e-05 +68,0b0.10001.00,0,-15,3.05176e-05 +69,0b0.10001.01,0,-15,3.62917e-05 +70,0b0.10001.10,0,-15,4.31584e-05 +71,0b0.10001.11,0,-15,5.13242e-05 +72,0b0.10010.00,0,-14,6.10352e-05 +73,0b0.10010.01,0,-14,7.25834e-05 +74,0b0.10010.10,0,-14,8.63167e-05 +75,0b0.10010.11,0,-14,0.000102648 +76,0b0.10011.00,0,-13,0.00012207 +77,0b0.10011.01,0,-13,0.000145167 +78,0b0.10011.10,0,-13,0.000172633 +79,0b0.10011.11,0,-13,0.000205297 +80,0b0.10100.00,0,-12,0.000244141 +81,0b0.10100.01,0,-12,0.000290334 +82,0b0.10100.10,0,-12,0.000345267 +83,0b0.10100.11,0,-12,0.000410594 +84,0b0.10101.00,0,-11,0.000488281 +85,0b0.10101.01,0,-11,0.000580668 +86,0b0.10101.10,0,-11,0.000690534 +87,0b0.10101.11,0,-11,0.000821188 +88,0b0.10110.00,0,-10,0.000976562 +89,0b0.10110.01,0,-10,0.00116134 +90,0b0.10110.10,0,-10,0.00138107 +91,0b0.10110.11,0,-10,0.00164238 +92,0b0.10111.00,0,-9,0.00195312 +93,0b0.10111.01,0,-9,0.00232267 +94,0b0.10111.10,0,-9,0.00276214 +95,0b0.10111.11,0,-9,0.00328475 +96,0b0.11000.00,0,-8,0.00390625 +97,0b0.11000.01,0,-8,0.00464534 +98,0b0.11000.10,0,-8,0.00552427 +99,0b0.11000.11,0,-8,0.0065695 +100,0b0.11001.00,0,-7,0.0078125 +101,0b0.11001.01,0,-7,0.00929068 +102,0b0.11001.10,0,-7,0.0110485 +103,0b0.11001.11,0,-7,0.013139 +104,0b0.11010.00,0,-6,0.015625 +105,0b0.11010.01,0,-6,0.0185814 +106,0b0.11010.10,0,-6,0.0220971 +107,0b0.11010.11,0,-6,0.026278 +108,0b0.11011.00,0,-5,0.03125 +109,0b0.11011.01,0,-5,0.0371627 +110,0b0.11011.10,0,-5,0.0441942 +111,0b0.11011.11,0,-5,0.052556 +112,0b0.11100.00,0,-4,0.0625 +113,0b0.11100.01,0,-4,0.0743254 +114,0b0.11100.10,0,-4,0.0883883 +115,0b0.11100.11,0,-4,0.105112 +116,0b0.11101.00,0,-3,0.125 +117,0b0.11101.01,0,-3,0.148651 +118,0b0.11101.10,0,-3,0.176777 +119,0b0.11101.11,0,-3,0.210224 +120,0b0.11110.00,0,-2,0.25 +121,0b0.11110.01,0,-2,0.297302 +122,0b0.11110.10,0,-2,0.353553 +123,0b0.11110.11,0,-2,0.420448 +124,0b0.11111.00,0,-1,0.5 +125,0b0.11111.01,0,-1,0.594604 +126,0b0.11111.10,0,-1,0.707107 +127,0b0.11111.11,0,-1,0.840896 +128,0b1.00000.00,1,0,-1 +129,0b1.00000.01,1,0,-1.18921 +130,0b1.00000.10,1,0,-1.41421 +131,0b1.00000.11,1,0,-1.68179 +132,0b1.00001.00,1,1,-2 +133,0b1.00001.01,1,1,-2.37841 +134,0b1.00001.10,1,1,-2.82843 +135,0b1.00001.11,1,1,-3.36359 +136,0b1.00010.00,1,2,-4 +137,0b1.00010.01,1,2,-4.75683 +138,0b1.00010.10,1,2,-5.65685 +139,0b1.00010.11,1,2,-6.72717 +140,0b1.00011.00,1,3,-8 +141,0b1.00011.01,1,3,-9.51366 +142,0b1.00011.10,1,3,-11.3137 +143,0b1.00011.11,1,3,-13.4543 +144,0b1.00100.00,1,4,-16 +145,0b1.00100.01,1,4,-19.0273 +146,0b1.00100.10,1,4,-22.6274 +147,0b1.00100.11,1,4,-26.9087 +148,0b1.00101.00,1,5,-32 +149,0b1.00101.01,1,5,-38.0546 +150,0b1.00101.10,1,5,-45.2548 +151,0b1.00101.11,1,5,-53.8174 +152,0b1.00110.00,1,6,-64 +153,0b1.00110.01,1,6,-76.1093 +154,0b1.00110.10,1,6,-90.5097 +155,0b1.00110.11,1,6,-107.635 +156,0b1.00111.00,1,7,-128 +157,0b1.00111.01,1,7,-152.219 +158,0b1.00111.10,1,7,-181.019 +159,0b1.00111.11,1,7,-215.269 +160,0b1.01000.00,1,8,-256 +161,0b1.01000.01,1,8,-304.437 +162,0b1.01000.10,1,8,-362.039 +163,0b1.01000.11,1,8,-430.539 +164,0b1.01001.00,1,9,-512 +165,0b1.01001.01,1,9,-608.874 +166,0b1.01001.10,1,9,-724.077 +167,0b1.01001.11,1,9,-861.078 +168,0b1.01010.00,1,10,-1024 +169,0b1.01010.01,1,10,-1217.75 +170,0b1.01010.10,1,10,-1448.15 +171,0b1.01010.11,1,10,-1722.16 +172,0b1.01011.00,1,11,-2048 +173,0b1.01011.01,1,11,-2435.5 +174,0b1.01011.10,1,11,-2896.31 +175,0b1.01011.11,1,11,-3444.31 +176,0b1.01100.00,1,12,-4096 +177,0b1.01100.01,1,12,-4870.99 +178,0b1.01100.10,1,12,-5792.62 +179,0b1.01100.11,1,12,-6888.62 +180,0b1.01101.00,1,13,-8192 +181,0b1.01101.01,1,13,-9741.98 +182,0b1.01101.10,1,13,-11585.2 +183,0b1.01101.11,1,13,-13777.2 +184,0b1.01110.00,1,14,-16384 +185,0b1.01110.01,1,14,-19484 +186,0b1.01110.10,1,14,-23170.5 +187,0b1.01110.11,1,14,-27554.5 +188,0b1.01111.00,1,15,-32768 +189,0b1.01111.01,1,15,-38967.9 +190,0b1.01111.10,1,15,-46341 +191,0b1.01111.11,1,15,-55109 +192,0b1.10000.00,1,-16,-nan(ind) +193,0b1.10000.01,1,-16,-1.81459e-05 +194,0b1.10000.10,1,-16,-2.15792e-05 +195,0b1.10000.11,1,-16,-2.56621e-05 +196,0b1.10001.00,1,-15,-3.05176e-05 +197,0b1.10001.01,1,-15,-3.62917e-05 +198,0b1.10001.10,1,-15,-4.31584e-05 +199,0b1.10001.11,1,-15,-5.13242e-05 +200,0b1.10010.00,1,-14,-6.10352e-05 +201,0b1.10010.01,1,-14,-7.25834e-05 +202,0b1.10010.10,1,-14,-8.63167e-05 +203,0b1.10010.11,1,-14,-0.000102648 +204,0b1.10011.00,1,-13,-0.00012207 +205,0b1.10011.01,1,-13,-0.000145167 +206,0b1.10011.10,1,-13,-0.000172633 +207,0b1.10011.11,1,-13,-0.000205297 +208,0b1.10100.00,1,-12,-0.000244141 +209,0b1.10100.01,1,-12,-0.000290334 +210,0b1.10100.10,1,-12,-0.000345267 +211,0b1.10100.11,1,-12,-0.000410594 +212,0b1.10101.00,1,-11,-0.000488281 +213,0b1.10101.01,1,-11,-0.000580668 +214,0b1.10101.10,1,-11,-0.000690534 +215,0b1.10101.11,1,-11,-0.000821188 +216,0b1.10110.00,1,-10,-0.000976562 +217,0b1.10110.01,1,-10,-0.00116134 +218,0b1.10110.10,1,-10,-0.00138107 +219,0b1.10110.11,1,-10,-0.00164238 +220,0b1.10111.00,1,-9,-0.00195312 +221,0b1.10111.01,1,-9,-0.00232267 +222,0b1.10111.10,1,-9,-0.00276214 +223,0b1.10111.11,1,-9,-0.00328475 +224,0b1.11000.00,1,-8,-0.00390625 +225,0b1.11000.01,1,-8,-0.00464534 +226,0b1.11000.10,1,-8,-0.00552427 +227,0b1.11000.11,1,-8,-0.0065695 +228,0b1.11001.00,1,-7,-0.0078125 +229,0b1.11001.01,1,-7,-0.00929068 +230,0b1.11001.10,1,-7,-0.0110485 +231,0b1.11001.11,1,-7,-0.013139 +232,0b1.11010.00,1,-6,-0.015625 +233,0b1.11010.01,1,-6,-0.0185814 +234,0b1.11010.10,1,-6,-0.0220971 +235,0b1.11010.11,1,-6,-0.026278 +236,0b1.11011.00,1,-5,-0.03125 +237,0b1.11011.01,1,-5,-0.0371627 +238,0b1.11011.10,1,-5,-0.0441942 +239,0b1.11011.11,1,-5,-0.052556 +240,0b1.11100.00,1,-4,-0.0625 +241,0b1.11100.01,1,-4,-0.0743254 +242,0b1.11100.10,1,-4,-0.0883883 +243,0b1.11100.11,1,-4,-0.105112 +244,0b1.11101.00,1,-3,-0.125 +245,0b1.11101.01,1,-3,-0.148651 +246,0b1.11101.10,1,-3,-0.176777 +247,0b1.11101.11,1,-3,-0.210224 +248,0b1.11110.00,1,-2,-0.25 +249,0b1.11110.01,1,-2,-0.297302 +250,0b1.11110.10,1,-2,-0.353553 +251,0b1.11110.11,1,-2,-0.420448 +252,0b1.11111.00,1,-1,-0.5 +253,0b1.11111.01,1,-1,-0.594604 +254,0b1.11111.10,1,-1,-0.707107 +255,0b1.11111.11,1,-1,-0.840896 + +"Generate Value table for an LNS<8,3> in CSV format" +#, Binary, sign, scale, value +0,0b0.0000.000,0,0,1 +1,0b0.0000.001,0,0,1.09051 +2,0b0.0000.010,0,0,1.18921 +3,0b0.0000.011,0,0,1.29684 +4,0b0.0000.100,0,0,1.41421 +5,0b0.0000.101,0,0,1.54221 +6,0b0.0000.110,0,0,1.68179 +7,0b0.0000.111,0,0,1.83401 +8,0b0.0001.000,0,1,2 +9,0b0.0001.001,0,1,2.18102 +10,0b0.0001.010,0,1,2.37841 +11,0b0.0001.011,0,1,2.59368 +12,0b0.0001.100,0,1,2.82843 +13,0b0.0001.101,0,1,3.08442 +14,0b0.0001.110,0,1,3.36359 +15,0b0.0001.111,0,1,3.66802 +16,0b0.0010.000,0,2,4 +17,0b0.0010.001,0,2,4.36203 +18,0b0.0010.010,0,2,4.75683 +19,0b0.0010.011,0,2,5.18736 +20,0b0.0010.100,0,2,5.65685 +21,0b0.0010.101,0,2,6.16884 +22,0b0.0010.110,0,2,6.72717 +23,0b0.0010.111,0,2,7.33603 +24,0b0.0011.000,0,3,8 +25,0b0.0011.001,0,3,8.72406 +26,0b0.0011.010,0,3,9.51366 +27,0b0.0011.011,0,3,10.3747 +28,0b0.0011.100,0,3,11.3137 +29,0b0.0011.101,0,3,12.3377 +30,0b0.0011.110,0,3,13.4543 +31,0b0.0011.111,0,3,14.6721 +32,0b0.0100.000,0,4,16 +33,0b0.0100.001,0,4,17.4481 +34,0b0.0100.010,0,4,19.0273 +35,0b0.0100.011,0,4,20.7494 +36,0b0.0100.100,0,4,22.6274 +37,0b0.0100.101,0,4,24.6754 +38,0b0.0100.110,0,4,26.9087 +39,0b0.0100.111,0,4,29.3441 +40,0b0.0101.000,0,5,32 +41,0b0.0101.001,0,5,34.8962 +42,0b0.0101.010,0,5,38.0546 +43,0b0.0101.011,0,5,41.4989 +44,0b0.0101.100,0,5,45.2548 +45,0b0.0101.101,0,5,49.3507 +46,0b0.0101.110,0,5,53.8174 +47,0b0.0101.111,0,5,58.6883 +48,0b0.0110.000,0,6,64 +49,0b0.0110.001,0,6,69.7925 +50,0b0.0110.010,0,6,76.1093 +51,0b0.0110.011,0,6,82.9977 +52,0b0.0110.100,0,6,90.5097 +53,0b0.0110.101,0,6,98.7015 +54,0b0.0110.110,0,6,107.635 +55,0b0.0110.111,0,6,117.377 +56,0b0.0111.000,0,7,128 +57,0b0.0111.001,0,7,139.585 +58,0b0.0111.010,0,7,152.219 +59,0b0.0111.011,0,7,165.995 +60,0b0.0111.100,0,7,181.019 +61,0b0.0111.101,0,7,197.403 +62,0b0.0111.110,0,7,215.269 +63,0b0.0111.111,0,7,234.753 +64,0b0.1000.000,0,-8,0 +65,0b0.1000.001,0,-8,0.0042598 +66,0b0.1000.010,0,-8,0.00464534 +67,0b0.1000.011,0,-8,0.00506578 +68,0b0.1000.100,0,-8,0.00552427 +69,0b0.1000.101,0,-8,0.00602426 +70,0b0.1000.110,0,-8,0.0065695 +71,0b0.1000.111,0,-8,0.00716409 +72,0b0.1001.000,0,-7,0.0078125 +73,0b0.1001.001,0,-7,0.00851959 +74,0b0.1001.010,0,-7,0.00929068 +75,0b0.1001.011,0,-7,0.0101316 +76,0b0.1001.100,0,-7,0.0110485 +77,0b0.1001.101,0,-7,0.0120485 +78,0b0.1001.110,0,-7,0.013139 +79,0b0.1001.111,0,-7,0.0143282 +80,0b0.1010.000,0,-6,0.015625 +81,0b0.1010.001,0,-6,0.0170392 +82,0b0.1010.010,0,-6,0.0185814 +83,0b0.1010.011,0,-6,0.0202631 +84,0b0.1010.100,0,-6,0.0220971 +85,0b0.1010.101,0,-6,0.024097 +86,0b0.1010.110,0,-6,0.026278 +87,0b0.1010.111,0,-6,0.0286564 +88,0b0.1011.000,0,-5,0.03125 +89,0b0.1011.001,0,-5,0.0340784 +90,0b0.1011.010,0,-5,0.0371627 +91,0b0.1011.011,0,-5,0.0405262 +92,0b0.1011.100,0,-5,0.0441942 +93,0b0.1011.101,0,-5,0.0481941 +94,0b0.1011.110,0,-5,0.052556 +95,0b0.1011.111,0,-5,0.0573128 +96,0b0.1100.000,0,-4,0.0625 +97,0b0.1100.001,0,-4,0.0681567 +98,0b0.1100.010,0,-4,0.0743254 +99,0b0.1100.011,0,-4,0.0810525 +100,0b0.1100.100,0,-4,0.0883883 +101,0b0.1100.101,0,-4,0.0963882 +102,0b0.1100.110,0,-4,0.105112 +103,0b0.1100.111,0,-4,0.114626 +104,0b0.1101.000,0,-3,0.125 +105,0b0.1101.001,0,-3,0.136313 +106,0b0.1101.010,0,-3,0.148651 +107,0b0.1101.011,0,-3,0.162105 +108,0b0.1101.100,0,-3,0.176777 +109,0b0.1101.101,0,-3,0.192776 +110,0b0.1101.110,0,-3,0.210224 +111,0b0.1101.111,0,-3,0.229251 +112,0b0.1110.000,0,-2,0.25 +113,0b0.1110.001,0,-2,0.272627 +114,0b0.1110.010,0,-2,0.297302 +115,0b0.1110.011,0,-2,0.32421 +116,0b0.1110.100,0,-2,0.353553 +117,0b0.1110.101,0,-2,0.385553 +118,0b0.1110.110,0,-2,0.420448 +119,0b0.1110.111,0,-2,0.458502 +120,0b0.1111.000,0,-1,0.5 +121,0b0.1111.001,0,-1,0.545254 +122,0b0.1111.010,0,-1,0.594604 +123,0b0.1111.011,0,-1,0.64842 +124,0b0.1111.100,0,-1,0.707107 +125,0b0.1111.101,0,-1,0.771105 +126,0b0.1111.110,0,-1,0.840896 +127,0b0.1111.111,0,-1,0.917004 +128,0b1.0000.000,1,0,-1 +129,0b1.0000.001,1,0,-1.09051 +130,0b1.0000.010,1,0,-1.18921 +131,0b1.0000.011,1,0,-1.29684 +132,0b1.0000.100,1,0,-1.41421 +133,0b1.0000.101,1,0,-1.54221 +134,0b1.0000.110,1,0,-1.68179 +135,0b1.0000.111,1,0,-1.83401 +136,0b1.0001.000,1,1,-2 +137,0b1.0001.001,1,1,-2.18102 +138,0b1.0001.010,1,1,-2.37841 +139,0b1.0001.011,1,1,-2.59368 +140,0b1.0001.100,1,1,-2.82843 +141,0b1.0001.101,1,1,-3.08442 +142,0b1.0001.110,1,1,-3.36359 +143,0b1.0001.111,1,1,-3.66802 +144,0b1.0010.000,1,2,-4 +145,0b1.0010.001,1,2,-4.36203 +146,0b1.0010.010,1,2,-4.75683 +147,0b1.0010.011,1,2,-5.18736 +148,0b1.0010.100,1,2,-5.65685 +149,0b1.0010.101,1,2,-6.16884 +150,0b1.0010.110,1,2,-6.72717 +151,0b1.0010.111,1,2,-7.33603 +152,0b1.0011.000,1,3,-8 +153,0b1.0011.001,1,3,-8.72406 +154,0b1.0011.010,1,3,-9.51366 +155,0b1.0011.011,1,3,-10.3747 +156,0b1.0011.100,1,3,-11.3137 +157,0b1.0011.101,1,3,-12.3377 +158,0b1.0011.110,1,3,-13.4543 +159,0b1.0011.111,1,3,-14.6721 +160,0b1.0100.000,1,4,-16 +161,0b1.0100.001,1,4,-17.4481 +162,0b1.0100.010,1,4,-19.0273 +163,0b1.0100.011,1,4,-20.7494 +164,0b1.0100.100,1,4,-22.6274 +165,0b1.0100.101,1,4,-24.6754 +166,0b1.0100.110,1,4,-26.9087 +167,0b1.0100.111,1,4,-29.3441 +168,0b1.0101.000,1,5,-32 +169,0b1.0101.001,1,5,-34.8962 +170,0b1.0101.010,1,5,-38.0546 +171,0b1.0101.011,1,5,-41.4989 +172,0b1.0101.100,1,5,-45.2548 +173,0b1.0101.101,1,5,-49.3507 +174,0b1.0101.110,1,5,-53.8174 +175,0b1.0101.111,1,5,-58.6883 +176,0b1.0110.000,1,6,-64 +177,0b1.0110.001,1,6,-69.7925 +178,0b1.0110.010,1,6,-76.1093 +179,0b1.0110.011,1,6,-82.9977 +180,0b1.0110.100,1,6,-90.5097 +181,0b1.0110.101,1,6,-98.7015 +182,0b1.0110.110,1,6,-107.635 +183,0b1.0110.111,1,6,-117.377 +184,0b1.0111.000,1,7,-128 +185,0b1.0111.001,1,7,-139.585 +186,0b1.0111.010,1,7,-152.219 +187,0b1.0111.011,1,7,-165.995 +188,0b1.0111.100,1,7,-181.019 +189,0b1.0111.101,1,7,-197.403 +190,0b1.0111.110,1,7,-215.269 +191,0b1.0111.111,1,7,-234.753 +192,0b1.1000.000,1,-8,-nan(ind) +193,0b1.1000.001,1,-8,-0.0042598 +194,0b1.1000.010,1,-8,-0.00464534 +195,0b1.1000.011,1,-8,-0.00506578 +196,0b1.1000.100,1,-8,-0.00552427 +197,0b1.1000.101,1,-8,-0.00602426 +198,0b1.1000.110,1,-8,-0.0065695 +199,0b1.1000.111,1,-8,-0.00716409 +200,0b1.1001.000,1,-7,-0.0078125 +201,0b1.1001.001,1,-7,-0.00851959 +202,0b1.1001.010,1,-7,-0.00929068 +203,0b1.1001.011,1,-7,-0.0101316 +204,0b1.1001.100,1,-7,-0.0110485 +205,0b1.1001.101,1,-7,-0.0120485 +206,0b1.1001.110,1,-7,-0.013139 +207,0b1.1001.111,1,-7,-0.0143282 +208,0b1.1010.000,1,-6,-0.015625 +209,0b1.1010.001,1,-6,-0.0170392 +210,0b1.1010.010,1,-6,-0.0185814 +211,0b1.1010.011,1,-6,-0.0202631 +212,0b1.1010.100,1,-6,-0.0220971 +213,0b1.1010.101,1,-6,-0.024097 +214,0b1.1010.110,1,-6,-0.026278 +215,0b1.1010.111,1,-6,-0.0286564 +216,0b1.1011.000,1,-5,-0.03125 +217,0b1.1011.001,1,-5,-0.0340784 +218,0b1.1011.010,1,-5,-0.0371627 +219,0b1.1011.011,1,-5,-0.0405262 +220,0b1.1011.100,1,-5,-0.0441942 +221,0b1.1011.101,1,-5,-0.0481941 +222,0b1.1011.110,1,-5,-0.052556 +223,0b1.1011.111,1,-5,-0.0573128 +224,0b1.1100.000,1,-4,-0.0625 +225,0b1.1100.001,1,-4,-0.0681567 +226,0b1.1100.010,1,-4,-0.0743254 +227,0b1.1100.011,1,-4,-0.0810525 +228,0b1.1100.100,1,-4,-0.0883883 +229,0b1.1100.101,1,-4,-0.0963882 +230,0b1.1100.110,1,-4,-0.105112 +231,0b1.1100.111,1,-4,-0.114626 +232,0b1.1101.000,1,-3,-0.125 +233,0b1.1101.001,1,-3,-0.136313 +234,0b1.1101.010,1,-3,-0.148651 +235,0b1.1101.011,1,-3,-0.162105 +236,0b1.1101.100,1,-3,-0.176777 +237,0b1.1101.101,1,-3,-0.192776 +238,0b1.1101.110,1,-3,-0.210224 +239,0b1.1101.111,1,-3,-0.229251 +240,0b1.1110.000,1,-2,-0.25 +241,0b1.1110.001,1,-2,-0.272627 +242,0b1.1110.010,1,-2,-0.297302 +243,0b1.1110.011,1,-2,-0.32421 +244,0b1.1110.100,1,-2,-0.353553 +245,0b1.1110.101,1,-2,-0.385553 +246,0b1.1110.110,1,-2,-0.420448 +247,0b1.1110.111,1,-2,-0.458502 +248,0b1.1111.000,1,-1,-0.5 +249,0b1.1111.001,1,-1,-0.545254 +250,0b1.1111.010,1,-1,-0.594604 +251,0b1.1111.011,1,-1,-0.64842 +252,0b1.1111.100,1,-1,-0.707107 +253,0b1.1111.101,1,-1,-0.771105 +254,0b1.1111.110,1,-1,-0.840896 +255,0b1.1111.111,1,-1,-0.917004 + +"Generate Value table for an LNS<8,4> in CSV format" +#, Binary, sign, scale, value +0,0b0.000.0000,0,0,1 +1,0b0.000.0001,0,0,1.04427 +2,0b0.000.0010,0,0,1.09051 +3,0b0.000.0011,0,0,1.13879 +4,0b0.000.0100,0,0,1.18921 +5,0b0.000.0101,0,0,1.24186 +6,0b0.000.0110,0,0,1.29684 +7,0b0.000.0111,0,0,1.35426 +8,0b0.000.1000,0,0,1.41421 +9,0b0.000.1001,0,0,1.47683 +10,0b0.000.1010,0,0,1.54221 +11,0b0.000.1011,0,0,1.61049 +12,0b0.000.1100,0,0,1.68179 +13,0b0.000.1101,0,0,1.75625 +14,0b0.000.1110,0,0,1.83401 +15,0b0.000.1111,0,0,1.91521 +16,0b0.001.0000,0,1,2 +17,0b0.001.0001,0,1,2.08855 +18,0b0.001.0010,0,1,2.18102 +19,0b0.001.0011,0,1,2.27758 +20,0b0.001.0100,0,1,2.37841 +21,0b0.001.0101,0,1,2.48372 +22,0b0.001.0110,0,1,2.59368 +23,0b0.001.0111,0,1,2.70851 +24,0b0.001.1000,0,1,2.82843 +25,0b0.001.1001,0,1,2.95365 +26,0b0.001.1010,0,1,3.08442 +27,0b0.001.1011,0,1,3.22098 +28,0b0.001.1100,0,1,3.36359 +29,0b0.001.1101,0,1,3.5125 +30,0b0.001.1110,0,1,3.66802 +31,0b0.001.1111,0,1,3.83041 +32,0b0.010.0000,0,2,4 +33,0b0.010.0001,0,2,4.1771 +34,0b0.010.0010,0,2,4.36203 +35,0b0.010.0011,0,2,4.55515 +36,0b0.010.0100,0,2,4.75683 +37,0b0.010.0101,0,2,4.96743 +38,0b0.010.0110,0,2,5.18736 +39,0b0.010.0111,0,2,5.41702 +40,0b0.010.1000,0,2,5.65685 +41,0b0.010.1001,0,2,5.9073 +42,0b0.010.1010,0,2,6.16884 +43,0b0.010.1011,0,2,6.44196 +44,0b0.010.1100,0,2,6.72717 +45,0b0.010.1101,0,2,7.02501 +46,0b0.010.1110,0,2,7.33603 +47,0b0.010.1111,0,2,7.66083 +48,0b0.011.0000,0,3,8 +49,0b0.011.0001,0,3,8.35419 +50,0b0.011.0010,0,3,8.72406 +51,0b0.011.0011,0,3,9.11031 +52,0b0.011.0100,0,3,9.51366 +53,0b0.011.0101,0,3,9.93486 +54,0b0.011.0110,0,3,10.3747 +55,0b0.011.0111,0,3,10.834 +56,0b0.011.1000,0,3,11.3137 +57,0b0.011.1001,0,3,11.8146 +58,0b0.011.1010,0,3,12.3377 +59,0b0.011.1011,0,3,12.8839 +60,0b0.011.1100,0,3,13.4543 +61,0b0.011.1101,0,3,14.05 +62,0b0.011.1110,0,3,14.6721 +63,0b0.011.1111,0,3,15.3217 +64,0b0.100.0000,0,-4,0 +65,0b0.100.0001,0,-4,0.0652671 +66,0b0.100.0010,0,-4,0.0681567 +67,0b0.100.0011,0,-4,0.0711743 +68,0b0.100.0100,0,-4,0.0743254 +69,0b0.100.0101,0,-4,0.0776161 +70,0b0.100.0110,0,-4,0.0810525 +71,0b0.100.0111,0,-4,0.084641 +72,0b0.100.1000,0,-4,0.0883883 +73,0b0.100.1001,0,-4,0.0923016 +74,0b0.100.1010,0,-4,0.0963882 +75,0b0.100.1011,0,-4,0.100656 +76,0b0.100.1100,0,-4,0.105112 +77,0b0.100.1101,0,-4,0.109766 +78,0b0.100.1110,0,-4,0.114626 +79,0b0.100.1111,0,-4,0.1197 +80,0b0.101.0000,0,-3,0.125 +81,0b0.101.0001,0,-3,0.130534 +82,0b0.101.0010,0,-3,0.136313 +83,0b0.101.0011,0,-3,0.142349 +84,0b0.101.0100,0,-3,0.148651 +85,0b0.101.0101,0,-3,0.155232 +86,0b0.101.0110,0,-3,0.162105 +87,0b0.101.0111,0,-3,0.169282 +88,0b0.101.1000,0,-3,0.176777 +89,0b0.101.1001,0,-3,0.184603 +90,0b0.101.1010,0,-3,0.192776 +91,0b0.101.1011,0,-3,0.201311 +92,0b0.101.1100,0,-3,0.210224 +93,0b0.101.1101,0,-3,0.219532 +94,0b0.101.1110,0,-3,0.229251 +95,0b0.101.1111,0,-3,0.239401 +96,0b0.110.0000,0,-2,0.25 +97,0b0.110.0001,0,-2,0.261068 +98,0b0.110.0010,0,-2,0.272627 +99,0b0.110.0011,0,-2,0.284697 +100,0b0.110.0100,0,-2,0.297302 +101,0b0.110.0101,0,-2,0.310464 +102,0b0.110.0110,0,-2,0.32421 +103,0b0.110.0111,0,-2,0.338564 +104,0b0.110.1000,0,-2,0.353553 +105,0b0.110.1001,0,-2,0.369207 +106,0b0.110.1010,0,-2,0.385553 +107,0b0.110.1011,0,-2,0.402623 +108,0b0.110.1100,0,-2,0.420448 +109,0b0.110.1101,0,-2,0.439063 +110,0b0.110.1110,0,-2,0.458502 +111,0b0.110.1111,0,-2,0.478802 +112,0b0.111.0000,0,-1,0.5 +113,0b0.111.0001,0,-1,0.522137 +114,0b0.111.0010,0,-1,0.545254 +115,0b0.111.0011,0,-1,0.569394 +116,0b0.111.0100,0,-1,0.594604 +117,0b0.111.0101,0,-1,0.620929 +118,0b0.111.0110,0,-1,0.64842 +119,0b0.111.0111,0,-1,0.677128 +120,0b0.111.1000,0,-1,0.707107 +121,0b0.111.1001,0,-1,0.738413 +122,0b0.111.1010,0,-1,0.771105 +123,0b0.111.1011,0,-1,0.805245 +124,0b0.111.1100,0,-1,0.840896 +125,0b0.111.1101,0,-1,0.878126 +126,0b0.111.1110,0,-1,0.917004 +127,0b0.111.1111,0,-1,0.957603 +128,0b1.000.0000,1,0,-1 +129,0b1.000.0001,1,0,-1.04427 +130,0b1.000.0010,1,0,-1.09051 +131,0b1.000.0011,1,0,-1.13879 +132,0b1.000.0100,1,0,-1.18921 +133,0b1.000.0101,1,0,-1.24186 +134,0b1.000.0110,1,0,-1.29684 +135,0b1.000.0111,1,0,-1.35426 +136,0b1.000.1000,1,0,-1.41421 +137,0b1.000.1001,1,0,-1.47683 +138,0b1.000.1010,1,0,-1.54221 +139,0b1.000.1011,1,0,-1.61049 +140,0b1.000.1100,1,0,-1.68179 +141,0b1.000.1101,1,0,-1.75625 +142,0b1.000.1110,1,0,-1.83401 +143,0b1.000.1111,1,0,-1.91521 +144,0b1.001.0000,1,1,-2 +145,0b1.001.0001,1,1,-2.08855 +146,0b1.001.0010,1,1,-2.18102 +147,0b1.001.0011,1,1,-2.27758 +148,0b1.001.0100,1,1,-2.37841 +149,0b1.001.0101,1,1,-2.48372 +150,0b1.001.0110,1,1,-2.59368 +151,0b1.001.0111,1,1,-2.70851 +152,0b1.001.1000,1,1,-2.82843 +153,0b1.001.1001,1,1,-2.95365 +154,0b1.001.1010,1,1,-3.08442 +155,0b1.001.1011,1,1,-3.22098 +156,0b1.001.1100,1,1,-3.36359 +157,0b1.001.1101,1,1,-3.5125 +158,0b1.001.1110,1,1,-3.66802 +159,0b1.001.1111,1,1,-3.83041 +160,0b1.010.0000,1,2,-4 +161,0b1.010.0001,1,2,-4.1771 +162,0b1.010.0010,1,2,-4.36203 +163,0b1.010.0011,1,2,-4.55515 +164,0b1.010.0100,1,2,-4.75683 +165,0b1.010.0101,1,2,-4.96743 +166,0b1.010.0110,1,2,-5.18736 +167,0b1.010.0111,1,2,-5.41702 +168,0b1.010.1000,1,2,-5.65685 +169,0b1.010.1001,1,2,-5.9073 +170,0b1.010.1010,1,2,-6.16884 +171,0b1.010.1011,1,2,-6.44196 +172,0b1.010.1100,1,2,-6.72717 +173,0b1.010.1101,1,2,-7.02501 +174,0b1.010.1110,1,2,-7.33603 +175,0b1.010.1111,1,2,-7.66083 +176,0b1.011.0000,1,3,-8 +177,0b1.011.0001,1,3,-8.35419 +178,0b1.011.0010,1,3,-8.72406 +179,0b1.011.0011,1,3,-9.11031 +180,0b1.011.0100,1,3,-9.51366 +181,0b1.011.0101,1,3,-9.93486 +182,0b1.011.0110,1,3,-10.3747 +183,0b1.011.0111,1,3,-10.834 +184,0b1.011.1000,1,3,-11.3137 +185,0b1.011.1001,1,3,-11.8146 +186,0b1.011.1010,1,3,-12.3377 +187,0b1.011.1011,1,3,-12.8839 +188,0b1.011.1100,1,3,-13.4543 +189,0b1.011.1101,1,3,-14.05 +190,0b1.011.1110,1,3,-14.6721 +191,0b1.011.1111,1,3,-15.3217 +192,0b1.100.0000,1,-4,-nan(ind) +193,0b1.100.0001,1,-4,-0.0652671 +194,0b1.100.0010,1,-4,-0.0681567 +195,0b1.100.0011,1,-4,-0.0711743 +196,0b1.100.0100,1,-4,-0.0743254 +197,0b1.100.0101,1,-4,-0.0776161 +198,0b1.100.0110,1,-4,-0.0810525 +199,0b1.100.0111,1,-4,-0.084641 +200,0b1.100.1000,1,-4,-0.0883883 +201,0b1.100.1001,1,-4,-0.0923016 +202,0b1.100.1010,1,-4,-0.0963882 +203,0b1.100.1011,1,-4,-0.100656 +204,0b1.100.1100,1,-4,-0.105112 +205,0b1.100.1101,1,-4,-0.109766 +206,0b1.100.1110,1,-4,-0.114626 +207,0b1.100.1111,1,-4,-0.1197 +208,0b1.101.0000,1,-3,-0.125 +209,0b1.101.0001,1,-3,-0.130534 +210,0b1.101.0010,1,-3,-0.136313 +211,0b1.101.0011,1,-3,-0.142349 +212,0b1.101.0100,1,-3,-0.148651 +213,0b1.101.0101,1,-3,-0.155232 +214,0b1.101.0110,1,-3,-0.162105 +215,0b1.101.0111,1,-3,-0.169282 +216,0b1.101.1000,1,-3,-0.176777 +217,0b1.101.1001,1,-3,-0.184603 +218,0b1.101.1010,1,-3,-0.192776 +219,0b1.101.1011,1,-3,-0.201311 +220,0b1.101.1100,1,-3,-0.210224 +221,0b1.101.1101,1,-3,-0.219532 +222,0b1.101.1110,1,-3,-0.229251 +223,0b1.101.1111,1,-3,-0.239401 +224,0b1.110.0000,1,-2,-0.25 +225,0b1.110.0001,1,-2,-0.261068 +226,0b1.110.0010,1,-2,-0.272627 +227,0b1.110.0011,1,-2,-0.284697 +228,0b1.110.0100,1,-2,-0.297302 +229,0b1.110.0101,1,-2,-0.310464 +230,0b1.110.0110,1,-2,-0.32421 +231,0b1.110.0111,1,-2,-0.338564 +232,0b1.110.1000,1,-2,-0.353553 +233,0b1.110.1001,1,-2,-0.369207 +234,0b1.110.1010,1,-2,-0.385553 +235,0b1.110.1011,1,-2,-0.402623 +236,0b1.110.1100,1,-2,-0.420448 +237,0b1.110.1101,1,-2,-0.439063 +238,0b1.110.1110,1,-2,-0.458502 +239,0b1.110.1111,1,-2,-0.478802 +240,0b1.111.0000,1,-1,-0.5 +241,0b1.111.0001,1,-1,-0.522137 +242,0b1.111.0010,1,-1,-0.545254 +243,0b1.111.0011,1,-1,-0.569394 +244,0b1.111.0100,1,-1,-0.594604 +245,0b1.111.0101,1,-1,-0.620929 +246,0b1.111.0110,1,-1,-0.64842 +247,0b1.111.0111,1,-1,-0.677128 +248,0b1.111.1000,1,-1,-0.707107 +249,0b1.111.1001,1,-1,-0.738413 +250,0b1.111.1010,1,-1,-0.771105 +251,0b1.111.1011,1,-1,-0.805245 +252,0b1.111.1100,1,-1,-0.840896 +253,0b1.111.1101,1,-1,-0.878126 +254,0b1.111.1110,1,-1,-0.917004 +255,0b1.111.1111,1,-1,-0.957603 + +"Generate Value table for an LNS<8,5> in CSV format" +#, Binary, sign, scale, value +0,0b0.00.00000,0,0,1 +1,0b0.00.00001,0,0,1.0219 +2,0b0.00.00010,0,0,1.04427 +3,0b0.00.00011,0,0,1.06714 +4,0b0.00.00100,0,0,1.09051 +5,0b0.00.00101,0,0,1.11439 +6,0b0.00.00110,0,0,1.13879 +7,0b0.00.00111,0,0,1.16372 +8,0b0.00.01000,0,0,1.18921 +9,0b0.00.01001,0,0,1.21525 +10,0b0.00.01010,0,0,1.24186 +11,0b0.00.01011,0,0,1.26905 +12,0b0.00.01100,0,0,1.29684 +13,0b0.00.01101,0,0,1.32524 +14,0b0.00.01110,0,0,1.35426 +15,0b0.00.01111,0,0,1.38391 +16,0b0.00.10000,0,0,1.41421 +17,0b0.00.10001,0,0,1.44518 +18,0b0.00.10010,0,0,1.47683 +19,0b0.00.10011,0,0,1.50916 +20,0b0.00.10100,0,0,1.54221 +21,0b0.00.10101,0,0,1.57598 +22,0b0.00.10110,0,0,1.61049 +23,0b0.00.10111,0,0,1.64576 +24,0b0.00.11000,0,0,1.68179 +25,0b0.00.11001,0,0,1.71862 +26,0b0.00.11010,0,0,1.75625 +27,0b0.00.11011,0,0,1.79471 +28,0b0.00.11100,0,0,1.83401 +29,0b0.00.11101,0,0,1.87417 +30,0b0.00.11110,0,0,1.91521 +31,0b0.00.11111,0,0,1.95714 +32,0b0.01.00000,0,1,2 +33,0b0.01.00001,0,1,2.04379 +34,0b0.01.00010,0,1,2.08855 +35,0b0.01.00011,0,1,2.13428 +36,0b0.01.00100,0,1,2.18102 +37,0b0.01.00101,0,1,2.22877 +38,0b0.01.00110,0,1,2.27758 +39,0b0.01.00111,0,1,2.32745 +40,0b0.01.01000,0,1,2.37841 +41,0b0.01.01001,0,1,2.43049 +42,0b0.01.01010,0,1,2.48372 +43,0b0.01.01011,0,1,2.5381 +44,0b0.01.01100,0,1,2.59368 +45,0b0.01.01101,0,1,2.65047 +46,0b0.01.01110,0,1,2.70851 +47,0b0.01.01111,0,1,2.76782 +48,0b0.01.10000,0,1,2.82843 +49,0b0.01.10001,0,1,2.89036 +50,0b0.01.10010,0,1,2.95365 +51,0b0.01.10011,0,1,3.01833 +52,0b0.01.10100,0,1,3.08442 +53,0b0.01.10101,0,1,3.15196 +54,0b0.01.10110,0,1,3.22098 +55,0b0.01.10111,0,1,3.29151 +56,0b0.01.11000,0,1,3.36359 +57,0b0.01.11001,0,1,3.43724 +58,0b0.01.11010,0,1,3.5125 +59,0b0.01.11011,0,1,3.58942 +60,0b0.01.11100,0,1,3.66802 +61,0b0.01.11101,0,1,3.74834 +62,0b0.01.11110,0,1,3.83041 +63,0b0.01.11111,0,1,3.91429 +64,0b0.10.00000,0,-2,0 +65,0b0.10.00001,0,-2,0.255474 +66,0b0.10.00010,0,-2,0.261068 +67,0b0.10.00011,0,-2,0.266785 +68,0b0.10.00100,0,-2,0.272627 +69,0b0.10.00101,0,-2,0.278597 +70,0b0.10.00110,0,-2,0.284697 +71,0b0.10.00111,0,-2,0.290931 +72,0b0.10.01000,0,-2,0.297302 +73,0b0.10.01001,0,-2,0.303812 +74,0b0.10.01010,0,-2,0.310464 +75,0b0.10.01011,0,-2,0.317263 +76,0b0.10.01100,0,-2,0.32421 +77,0b0.10.01101,0,-2,0.331309 +78,0b0.10.01110,0,-2,0.338564 +79,0b0.10.01111,0,-2,0.345977 +80,0b0.10.10000,0,-2,0.353553 +81,0b0.10.10001,0,-2,0.361295 +82,0b0.10.10010,0,-2,0.369207 +83,0b0.10.10011,0,-2,0.377291 +84,0b0.10.10100,0,-2,0.385553 +85,0b0.10.10101,0,-2,0.393995 +86,0b0.10.10110,0,-2,0.402623 +87,0b0.10.10111,0,-2,0.411439 +88,0b0.10.11000,0,-2,0.420448 +89,0b0.10.11001,0,-2,0.429655 +90,0b0.10.11010,0,-2,0.439063 +91,0b0.10.11011,0,-2,0.448677 +92,0b0.10.11100,0,-2,0.458502 +93,0b0.10.11101,0,-2,0.468542 +94,0b0.10.11110,0,-2,0.478802 +95,0b0.10.11111,0,-2,0.489286 +96,0b0.11.00000,0,-1,0.5 +97,0b0.11.00001,0,-1,0.510949 +98,0b0.11.00010,0,-1,0.522137 +99,0b0.11.00011,0,-1,0.53357 +100,0b0.11.00100,0,-1,0.545254 +101,0b0.11.00101,0,-1,0.557193 +102,0b0.11.00110,0,-1,0.569394 +103,0b0.11.00111,0,-1,0.581862 +104,0b0.11.01000,0,-1,0.594604 +105,0b0.11.01001,0,-1,0.607624 +106,0b0.11.01010,0,-1,0.620929 +107,0b0.11.01011,0,-1,0.634525 +108,0b0.11.01100,0,-1,0.64842 +109,0b0.11.01101,0,-1,0.662618 +110,0b0.11.01110,0,-1,0.677128 +111,0b0.11.01111,0,-1,0.691955 +112,0b0.11.10000,0,-1,0.707107 +113,0b0.11.10001,0,-1,0.72259 +114,0b0.11.10010,0,-1,0.738413 +115,0b0.11.10011,0,-1,0.754582 +116,0b0.11.10100,0,-1,0.771105 +117,0b0.11.10101,0,-1,0.78799 +118,0b0.11.10110,0,-1,0.805245 +119,0b0.11.10111,0,-1,0.822878 +120,0b0.11.11000,0,-1,0.840896 +121,0b0.11.11001,0,-1,0.85931 +122,0b0.11.11010,0,-1,0.878126 +123,0b0.11.11011,0,-1,0.897355 +124,0b0.11.11100,0,-1,0.917004 +125,0b0.11.11101,0,-1,0.937084 +126,0b0.11.11110,0,-1,0.957603 +127,0b0.11.11111,0,-1,0.978572 +128,0b1.00.00000,1,0,-1 +129,0b1.00.00001,1,0,-1.0219 +130,0b1.00.00010,1,0,-1.04427 +131,0b1.00.00011,1,0,-1.06714 +132,0b1.00.00100,1,0,-1.09051 +133,0b1.00.00101,1,0,-1.11439 +134,0b1.00.00110,1,0,-1.13879 +135,0b1.00.00111,1,0,-1.16372 +136,0b1.00.01000,1,0,-1.18921 +137,0b1.00.01001,1,0,-1.21525 +138,0b1.00.01010,1,0,-1.24186 +139,0b1.00.01011,1,0,-1.26905 +140,0b1.00.01100,1,0,-1.29684 +141,0b1.00.01101,1,0,-1.32524 +142,0b1.00.01110,1,0,-1.35426 +143,0b1.00.01111,1,0,-1.38391 +144,0b1.00.10000,1,0,-1.41421 +145,0b1.00.10001,1,0,-1.44518 +146,0b1.00.10010,1,0,-1.47683 +147,0b1.00.10011,1,0,-1.50916 +148,0b1.00.10100,1,0,-1.54221 +149,0b1.00.10101,1,0,-1.57598 +150,0b1.00.10110,1,0,-1.61049 +151,0b1.00.10111,1,0,-1.64576 +152,0b1.00.11000,1,0,-1.68179 +153,0b1.00.11001,1,0,-1.71862 +154,0b1.00.11010,1,0,-1.75625 +155,0b1.00.11011,1,0,-1.79471 +156,0b1.00.11100,1,0,-1.83401 +157,0b1.00.11101,1,0,-1.87417 +158,0b1.00.11110,1,0,-1.91521 +159,0b1.00.11111,1,0,-1.95714 +160,0b1.01.00000,1,1,-2 +161,0b1.01.00001,1,1,-2.04379 +162,0b1.01.00010,1,1,-2.08855 +163,0b1.01.00011,1,1,-2.13428 +164,0b1.01.00100,1,1,-2.18102 +165,0b1.01.00101,1,1,-2.22877 +166,0b1.01.00110,1,1,-2.27758 +167,0b1.01.00111,1,1,-2.32745 +168,0b1.01.01000,1,1,-2.37841 +169,0b1.01.01001,1,1,-2.43049 +170,0b1.01.01010,1,1,-2.48372 +171,0b1.01.01011,1,1,-2.5381 +172,0b1.01.01100,1,1,-2.59368 +173,0b1.01.01101,1,1,-2.65047 +174,0b1.01.01110,1,1,-2.70851 +175,0b1.01.01111,1,1,-2.76782 +176,0b1.01.10000,1,1,-2.82843 +177,0b1.01.10001,1,1,-2.89036 +178,0b1.01.10010,1,1,-2.95365 +179,0b1.01.10011,1,1,-3.01833 +180,0b1.01.10100,1,1,-3.08442 +181,0b1.01.10101,1,1,-3.15196 +182,0b1.01.10110,1,1,-3.22098 +183,0b1.01.10111,1,1,-3.29151 +184,0b1.01.11000,1,1,-3.36359 +185,0b1.01.11001,1,1,-3.43724 +186,0b1.01.11010,1,1,-3.5125 +187,0b1.01.11011,1,1,-3.58942 +188,0b1.01.11100,1,1,-3.66802 +189,0b1.01.11101,1,1,-3.74834 +190,0b1.01.11110,1,1,-3.83041 +191,0b1.01.11111,1,1,-3.91429 +192,0b1.10.00000,1,-2,-nan(ind) +193,0b1.10.00001,1,-2,-0.255474 +194,0b1.10.00010,1,-2,-0.261068 +195,0b1.10.00011,1,-2,-0.266785 +196,0b1.10.00100,1,-2,-0.272627 +197,0b1.10.00101,1,-2,-0.278597 +198,0b1.10.00110,1,-2,-0.284697 +199,0b1.10.00111,1,-2,-0.290931 +200,0b1.10.01000,1,-2,-0.297302 +201,0b1.10.01001,1,-2,-0.303812 +202,0b1.10.01010,1,-2,-0.310464 +203,0b1.10.01011,1,-2,-0.317263 +204,0b1.10.01100,1,-2,-0.32421 +205,0b1.10.01101,1,-2,-0.331309 +206,0b1.10.01110,1,-2,-0.338564 +207,0b1.10.01111,1,-2,-0.345977 +208,0b1.10.10000,1,-2,-0.353553 +209,0b1.10.10001,1,-2,-0.361295 +210,0b1.10.10010,1,-2,-0.369207 +211,0b1.10.10011,1,-2,-0.377291 +212,0b1.10.10100,1,-2,-0.385553 +213,0b1.10.10101,1,-2,-0.393995 +214,0b1.10.10110,1,-2,-0.402623 +215,0b1.10.10111,1,-2,-0.411439 +216,0b1.10.11000,1,-2,-0.420448 +217,0b1.10.11001,1,-2,-0.429655 +218,0b1.10.11010,1,-2,-0.439063 +219,0b1.10.11011,1,-2,-0.448677 +220,0b1.10.11100,1,-2,-0.458502 +221,0b1.10.11101,1,-2,-0.468542 +222,0b1.10.11110,1,-2,-0.478802 +223,0b1.10.11111,1,-2,-0.489286 +224,0b1.11.00000,1,-1,-0.5 +225,0b1.11.00001,1,-1,-0.510949 +226,0b1.11.00010,1,-1,-0.522137 +227,0b1.11.00011,1,-1,-0.53357 +228,0b1.11.00100,1,-1,-0.545254 +229,0b1.11.00101,1,-1,-0.557193 +230,0b1.11.00110,1,-1,-0.569394 +231,0b1.11.00111,1,-1,-0.581862 +232,0b1.11.01000,1,-1,-0.594604 +233,0b1.11.01001,1,-1,-0.607624 +234,0b1.11.01010,1,-1,-0.620929 +235,0b1.11.01011,1,-1,-0.634525 +236,0b1.11.01100,1,-1,-0.64842 +237,0b1.11.01101,1,-1,-0.662618 +238,0b1.11.01110,1,-1,-0.677128 +239,0b1.11.01111,1,-1,-0.691955 +240,0b1.11.10000,1,-1,-0.707107 +241,0b1.11.10001,1,-1,-0.72259 +242,0b1.11.10010,1,-1,-0.738413 +243,0b1.11.10011,1,-1,-0.754582 +244,0b1.11.10100,1,-1,-0.771105 +245,0b1.11.10101,1,-1,-0.78799 +246,0b1.11.10110,1,-1,-0.805245 +247,0b1.11.10111,1,-1,-0.822878 +248,0b1.11.11000,1,-1,-0.840896 +249,0b1.11.11001,1,-1,-0.85931 +250,0b1.11.11010,1,-1,-0.878126 +251,0b1.11.11011,1,-1,-0.897355 +252,0b1.11.11100,1,-1,-0.917004 +253,0b1.11.11101,1,-1,-0.937084 +254,0b1.11.11110,1,-1,-0.957603 +255,0b1.11.11111,1,-1,-0.978572 + +"Generate Value table for an LNS<8,6> in CSV format" +#, Binary, sign, scale, value +0,0b0.0.000000,0,0,1 +1,0b0.0.000001,0,0,1.01089 +2,0b0.0.000010,0,0,1.0219 +3,0b0.0.000011,0,0,1.03302 +4,0b0.0.000100,0,0,1.04427 +5,0b0.0.000101,0,0,1.05565 +6,0b0.0.000110,0,0,1.06714 +7,0b0.0.000111,0,0,1.07876 +8,0b0.0.001000,0,0,1.09051 +9,0b0.0.001001,0,0,1.10238 +10,0b0.0.001010,0,0,1.11439 +11,0b0.0.001011,0,0,1.12652 +12,0b0.0.001100,0,0,1.13879 +13,0b0.0.001101,0,0,1.15119 +14,0b0.0.001110,0,0,1.16372 +15,0b0.0.001111,0,0,1.1764 +16,0b0.0.010000,0,0,1.18921 +17,0b0.0.010001,0,0,1.20216 +18,0b0.0.010010,0,0,1.21525 +19,0b0.0.010011,0,0,1.22848 +20,0b0.0.010100,0,0,1.24186 +21,0b0.0.010101,0,0,1.25538 +22,0b0.0.010110,0,0,1.26905 +23,0b0.0.010111,0,0,1.28287 +24,0b0.0.011000,0,0,1.29684 +25,0b0.0.011001,0,0,1.31096 +26,0b0.0.011010,0,0,1.32524 +27,0b0.0.011011,0,0,1.33967 +28,0b0.0.011100,0,0,1.35426 +29,0b0.0.011101,0,0,1.369 +30,0b0.0.011110,0,0,1.38391 +31,0b0.0.011111,0,0,1.39898 +32,0b0.0.100000,0,0,1.41421 +33,0b0.0.100001,0,0,1.42961 +34,0b0.0.100010,0,0,1.44518 +35,0b0.0.100011,0,0,1.46092 +36,0b0.0.100100,0,0,1.47683 +37,0b0.0.100101,0,0,1.49291 +38,0b0.0.100110,0,0,1.50916 +39,0b0.0.100111,0,0,1.5256 +40,0b0.0.101000,0,0,1.54221 +41,0b0.0.101001,0,0,1.559 +42,0b0.0.101010,0,0,1.57598 +43,0b0.0.101011,0,0,1.59314 +44,0b0.0.101100,0,0,1.61049 +45,0b0.0.101101,0,0,1.62803 +46,0b0.0.101110,0,0,1.64576 +47,0b0.0.101111,0,0,1.66368 +48,0b0.0.110000,0,0,1.68179 +49,0b0.0.110001,0,0,1.70011 +50,0b0.0.110010,0,0,1.71862 +51,0b0.0.110011,0,0,1.73733 +52,0b0.0.110100,0,0,1.75625 +53,0b0.0.110101,0,0,1.77538 +54,0b0.0.110110,0,0,1.79471 +55,0b0.0.110111,0,0,1.81425 +56,0b0.0.111000,0,0,1.83401 +57,0b0.0.111001,0,0,1.85398 +58,0b0.0.111010,0,0,1.87417 +59,0b0.0.111011,0,0,1.89458 +60,0b0.0.111100,0,0,1.91521 +61,0b0.0.111101,0,0,1.93606 +62,0b0.0.111110,0,0,1.95714 +63,0b0.0.111111,0,0,1.97846 +64,0b0.1.000000,0,-1,0 +65,0b0.1.000001,0,-1,0.505445 +66,0b0.1.000010,0,-1,0.510949 +67,0b0.1.000011,0,-1,0.516512 +68,0b0.1.000100,0,-1,0.522137 +69,0b0.1.000101,0,-1,0.527823 +70,0b0.1.000110,0,-1,0.53357 +71,0b0.1.000111,0,-1,0.53938 +72,0b0.1.001000,0,-1,0.545254 +73,0b0.1.001001,0,-1,0.551191 +74,0b0.1.001010,0,-1,0.557193 +75,0b0.1.001011,0,-1,0.563261 +76,0b0.1.001100,0,-1,0.569394 +77,0b0.1.001101,0,-1,0.575595 +78,0b0.1.001110,0,-1,0.581862 +79,0b0.1.001111,0,-1,0.588198 +80,0b0.1.010000,0,-1,0.594604 +81,0b0.1.010001,0,-1,0.601078 +82,0b0.1.010010,0,-1,0.607624 +83,0b0.1.010011,0,-1,0.61424 +84,0b0.1.010100,0,-1,0.620929 +85,0b0.1.010101,0,-1,0.62769 +86,0b0.1.010110,0,-1,0.634525 +87,0b0.1.010111,0,-1,0.641435 +88,0b0.1.011000,0,-1,0.64842 +89,0b0.1.011001,0,-1,0.655481 +90,0b0.1.011010,0,-1,0.662618 +91,0b0.1.011011,0,-1,0.669834 +92,0b0.1.011100,0,-1,0.677128 +93,0b0.1.011101,0,-1,0.684501 +94,0b0.1.011110,0,-1,0.691955 +95,0b0.1.011111,0,-1,0.69949 +96,0b0.1.100000,0,-1,0.707107 +97,0b0.1.100001,0,-1,0.714807 +98,0b0.1.100010,0,-1,0.72259 +99,0b0.1.100011,0,-1,0.730459 +100,0b0.1.100100,0,-1,0.738413 +101,0b0.1.100101,0,-1,0.746454 +102,0b0.1.100110,0,-1,0.754582 +103,0b0.1.100111,0,-1,0.762799 +104,0b0.1.101000,0,-1,0.771105 +105,0b0.1.101001,0,-1,0.779502 +106,0b0.1.101010,0,-1,0.78799 +107,0b0.1.101011,0,-1,0.796571 +108,0b0.1.101100,0,-1,0.805245 +109,0b0.1.101101,0,-1,0.814014 +110,0b0.1.101110,0,-1,0.822878 +111,0b0.1.101111,0,-1,0.831838 +112,0b0.1.110000,0,-1,0.840896 +113,0b0.1.110001,0,-1,0.850053 +114,0b0.1.110010,0,-1,0.85931 +115,0b0.1.110011,0,-1,0.868667 +116,0b0.1.110100,0,-1,0.878126 +117,0b0.1.110101,0,-1,0.887688 +118,0b0.1.110110,0,-1,0.897355 +119,0b0.1.110111,0,-1,0.907126 +120,0b0.1.111000,0,-1,0.917004 +121,0b0.1.111001,0,-1,0.92699 +122,0b0.1.111010,0,-1,0.937084 +123,0b0.1.111011,0,-1,0.947288 +124,0b0.1.111100,0,-1,0.957603 +125,0b0.1.111101,0,-1,0.968031 +126,0b0.1.111110,0,-1,0.978572 +127,0b0.1.111111,0,-1,0.989228 +128,0b1.0.000000,1,0,-1 +129,0b1.0.000001,1,0,-1.01089 +130,0b1.0.000010,1,0,-1.0219 +131,0b1.0.000011,1,0,-1.03302 +132,0b1.0.000100,1,0,-1.04427 +133,0b1.0.000101,1,0,-1.05565 +134,0b1.0.000110,1,0,-1.06714 +135,0b1.0.000111,1,0,-1.07876 +136,0b1.0.001000,1,0,-1.09051 +137,0b1.0.001001,1,0,-1.10238 +138,0b1.0.001010,1,0,-1.11439 +139,0b1.0.001011,1,0,-1.12652 +140,0b1.0.001100,1,0,-1.13879 +141,0b1.0.001101,1,0,-1.15119 +142,0b1.0.001110,1,0,-1.16372 +143,0b1.0.001111,1,0,-1.1764 +144,0b1.0.010000,1,0,-1.18921 +145,0b1.0.010001,1,0,-1.20216 +146,0b1.0.010010,1,0,-1.21525 +147,0b1.0.010011,1,0,-1.22848 +148,0b1.0.010100,1,0,-1.24186 +149,0b1.0.010101,1,0,-1.25538 +150,0b1.0.010110,1,0,-1.26905 +151,0b1.0.010111,1,0,-1.28287 +152,0b1.0.011000,1,0,-1.29684 +153,0b1.0.011001,1,0,-1.31096 +154,0b1.0.011010,1,0,-1.32524 +155,0b1.0.011011,1,0,-1.33967 +156,0b1.0.011100,1,0,-1.35426 +157,0b1.0.011101,1,0,-1.369 +158,0b1.0.011110,1,0,-1.38391 +159,0b1.0.011111,1,0,-1.39898 +160,0b1.0.100000,1,0,-1.41421 +161,0b1.0.100001,1,0,-1.42961 +162,0b1.0.100010,1,0,-1.44518 +163,0b1.0.100011,1,0,-1.46092 +164,0b1.0.100100,1,0,-1.47683 +165,0b1.0.100101,1,0,-1.49291 +166,0b1.0.100110,1,0,-1.50916 +167,0b1.0.100111,1,0,-1.5256 +168,0b1.0.101000,1,0,-1.54221 +169,0b1.0.101001,1,0,-1.559 +170,0b1.0.101010,1,0,-1.57598 +171,0b1.0.101011,1,0,-1.59314 +172,0b1.0.101100,1,0,-1.61049 +173,0b1.0.101101,1,0,-1.62803 +174,0b1.0.101110,1,0,-1.64576 +175,0b1.0.101111,1,0,-1.66368 +176,0b1.0.110000,1,0,-1.68179 +177,0b1.0.110001,1,0,-1.70011 +178,0b1.0.110010,1,0,-1.71862 +179,0b1.0.110011,1,0,-1.73733 +180,0b1.0.110100,1,0,-1.75625 +181,0b1.0.110101,1,0,-1.77538 +182,0b1.0.110110,1,0,-1.79471 +183,0b1.0.110111,1,0,-1.81425 +184,0b1.0.111000,1,0,-1.83401 +185,0b1.0.111001,1,0,-1.85398 +186,0b1.0.111010,1,0,-1.87417 +187,0b1.0.111011,1,0,-1.89458 +188,0b1.0.111100,1,0,-1.91521 +189,0b1.0.111101,1,0,-1.93606 +190,0b1.0.111110,1,0,-1.95714 +191,0b1.0.111111,1,0,-1.97846 +192,0b1.1.000000,1,-1,-nan(ind) +193,0b1.1.000001,1,-1,-0.505445 +194,0b1.1.000010,1,-1,-0.510949 +195,0b1.1.000011,1,-1,-0.516512 +196,0b1.1.000100,1,-1,-0.522137 +197,0b1.1.000101,1,-1,-0.527823 +198,0b1.1.000110,1,-1,-0.53357 +199,0b1.1.000111,1,-1,-0.53938 +200,0b1.1.001000,1,-1,-0.545254 +201,0b1.1.001001,1,-1,-0.551191 +202,0b1.1.001010,1,-1,-0.557193 +203,0b1.1.001011,1,-1,-0.563261 +204,0b1.1.001100,1,-1,-0.569394 +205,0b1.1.001101,1,-1,-0.575595 +206,0b1.1.001110,1,-1,-0.581862 +207,0b1.1.001111,1,-1,-0.588198 +208,0b1.1.010000,1,-1,-0.594604 +209,0b1.1.010001,1,-1,-0.601078 +210,0b1.1.010010,1,-1,-0.607624 +211,0b1.1.010011,1,-1,-0.61424 +212,0b1.1.010100,1,-1,-0.620929 +213,0b1.1.010101,1,-1,-0.62769 +214,0b1.1.010110,1,-1,-0.634525 +215,0b1.1.010111,1,-1,-0.641435 +216,0b1.1.011000,1,-1,-0.64842 +217,0b1.1.011001,1,-1,-0.655481 +218,0b1.1.011010,1,-1,-0.662618 +219,0b1.1.011011,1,-1,-0.669834 +220,0b1.1.011100,1,-1,-0.677128 +221,0b1.1.011101,1,-1,-0.684501 +222,0b1.1.011110,1,-1,-0.691955 +223,0b1.1.011111,1,-1,-0.69949 +224,0b1.1.100000,1,-1,-0.707107 +225,0b1.1.100001,1,-1,-0.714807 +226,0b1.1.100010,1,-1,-0.72259 +227,0b1.1.100011,1,-1,-0.730459 +228,0b1.1.100100,1,-1,-0.738413 +229,0b1.1.100101,1,-1,-0.746454 +230,0b1.1.100110,1,-1,-0.754582 +231,0b1.1.100111,1,-1,-0.762799 +232,0b1.1.101000,1,-1,-0.771105 +233,0b1.1.101001,1,-1,-0.779502 +234,0b1.1.101010,1,-1,-0.78799 +235,0b1.1.101011,1,-1,-0.796571 +236,0b1.1.101100,1,-1,-0.805245 +237,0b1.1.101101,1,-1,-0.814014 +238,0b1.1.101110,1,-1,-0.822878 +239,0b1.1.101111,1,-1,-0.831838 +240,0b1.1.110000,1,-1,-0.840896 +241,0b1.1.110001,1,-1,-0.850053 +242,0b1.1.110010,1,-1,-0.85931 +243,0b1.1.110011,1,-1,-0.868667 +244,0b1.1.110100,1,-1,-0.878126 +245,0b1.1.110101,1,-1,-0.887688 +246,0b1.1.110110,1,-1,-0.897355 +247,0b1.1.110111,1,-1,-0.907126 +248,0b1.1.111000,1,-1,-0.917004 +249,0b1.1.111001,1,-1,-0.92699 +250,0b1.1.111010,1,-1,-0.937084 +251,0b1.1.111011,1,-1,-0.947288 +252,0b1.1.111100,1,-1,-0.957603 +253,0b1.1.111101,1,-1,-0.968031 +254,0b1.1.111110,1,-1,-0.978572 +255,0b1.1.111111,1,-1,-0.989228 + +"Generate Value table for an LNS<8,7> in CSV format" +#, Binary, sign, scale, value +0,0b0..0000000,0,0,1 +1,0b0..0000001,0,0,1.00543 +2,0b0..0000010,0,0,1.01089 +3,0b0..0000011,0,0,1.01638 +4,0b0..0000100,0,0,1.0219 +5,0b0..0000101,0,0,1.02745 +6,0b0..0000110,0,0,1.03302 +7,0b0..0000111,0,0,1.03863 +8,0b0..0001000,0,0,1.04427 +9,0b0..0001001,0,0,1.04994 +10,0b0..0001010,0,0,1.05565 +11,0b0..0001011,0,0,1.06138 +12,0b0..0001100,0,0,1.06714 +13,0b0..0001101,0,0,1.07293 +14,0b0..0001110,0,0,1.07876 +15,0b0..0001111,0,0,1.08462 +16,0b0..0010000,0,0,1.09051 +17,0b0..0010001,0,0,1.09643 +18,0b0..0010010,0,0,1.10238 +19,0b0..0010011,0,0,1.10837 +20,0b0..0010100,0,0,1.11439 +21,0b0..0010101,0,0,1.12044 +22,0b0..0010110,0,0,1.12652 +23,0b0..0010111,0,0,1.13264 +24,0b0..0011000,0,0,1.13879 +25,0b0..0011001,0,0,1.14497 +26,0b0..0011010,0,0,1.15119 +27,0b0..0011011,0,0,1.15744 +28,0b0..0011100,0,0,1.16372 +29,0b0..0011101,0,0,1.17004 +30,0b0..0011110,0,0,1.1764 +31,0b0..0011111,0,0,1.18278 +32,0b0..0100000,0,0,1.18921 +33,0b0..0100001,0,0,1.19566 +34,0b0..0100010,0,0,1.20216 +35,0b0..0100011,0,0,1.20868 +36,0b0..0100100,0,0,1.21525 +37,0b0..0100101,0,0,1.22185 +38,0b0..0100110,0,0,1.22848 +39,0b0..0100111,0,0,1.23515 +40,0b0..0101000,0,0,1.24186 +41,0b0..0101001,0,0,1.2486 +42,0b0..0101010,0,0,1.25538 +43,0b0..0101011,0,0,1.2622 +44,0b0..0101100,0,0,1.26905 +45,0b0..0101101,0,0,1.27594 +46,0b0..0101110,0,0,1.28287 +47,0b0..0101111,0,0,1.28984 +48,0b0..0110000,0,0,1.29684 +49,0b0..0110001,0,0,1.30388 +50,0b0..0110010,0,0,1.31096 +51,0b0..0110011,0,0,1.31808 +52,0b0..0110100,0,0,1.32524 +53,0b0..0110101,0,0,1.33243 +54,0b0..0110110,0,0,1.33967 +55,0b0..0110111,0,0,1.34694 +56,0b0..0111000,0,0,1.35426 +57,0b0..0111001,0,0,1.36161 +58,0b0..0111010,0,0,1.369 +59,0b0..0111011,0,0,1.37644 +60,0b0..0111100,0,0,1.38391 +61,0b0..0111101,0,0,1.39142 +62,0b0..0111110,0,0,1.39898 +63,0b0..0111111,0,0,1.40658 +64,0b0..1000000,0,0,0 +65,0b0..1000001,0,0,0.710946 +66,0b0..1000010,0,0,0.714807 +67,0b0..1000011,0,0,0.718688 +68,0b0..1000100,0,0,0.72259 +69,0b0..1000101,0,0,0.726514 +70,0b0..1000110,0,0,0.730459 +71,0b0..1000111,0,0,0.734425 +72,0b0..1001000,0,0,0.738413 +73,0b0..1001001,0,0,0.742423 +74,0b0..1001010,0,0,0.746454 +75,0b0..1001011,0,0,0.750507 +76,0b0..1001100,0,0,0.754582 +77,0b0..1001101,0,0,0.75868 +78,0b0..1001110,0,0,0.762799 +79,0b0..1001111,0,0,0.766941 +80,0b0..1010000,0,0,0.771105 +81,0b0..1010001,0,0,0.775292 +82,0b0..1010010,0,0,0.779502 +83,0b0..1010011,0,0,0.783735 +84,0b0..1010100,0,0,0.78799 +85,0b0..1010101,0,0,0.792269 +86,0b0..1010110,0,0,0.796571 +87,0b0..1010111,0,0,0.800896 +88,0b0..1011000,0,0,0.805245 +89,0b0..1011001,0,0,0.809618 +90,0b0..1011010,0,0,0.814014 +91,0b0..1011011,0,0,0.818434 +92,0b0..1011100,0,0,0.822878 +93,0b0..1011101,0,0,0.827346 +94,0b0..1011110,0,0,0.831838 +95,0b0..1011111,0,0,0.836355 +96,0b0..1100000,0,0,0.840896 +97,0b0..1100001,0,0,0.845462 +98,0b0..1100010,0,0,0.850053 +99,0b0..1100011,0,0,0.854669 +100,0b0..1100100,0,0,0.85931 +101,0b0..1100101,0,0,0.863976 +102,0b0..1100110,0,0,0.868667 +103,0b0..1100111,0,0,0.873384 +104,0b0..1101000,0,0,0.878126 +105,0b0..1101001,0,0,0.882894 +106,0b0..1101010,0,0,0.887688 +107,0b0..1101011,0,0,0.892508 +108,0b0..1101100,0,0,0.897355 +109,0b0..1101101,0,0,0.902227 +110,0b0..1101110,0,0,0.907126 +111,0b0..1101111,0,0,0.912052 +112,0b0..1110000,0,0,0.917004 +113,0b0..1110001,0,0,0.921983 +114,0b0..1110010,0,0,0.92699 +115,0b0..1110011,0,0,0.932023 +116,0b0..1110100,0,0,0.937084 +117,0b0..1110101,0,0,0.942172 +118,0b0..1110110,0,0,0.947288 +119,0b0..1110111,0,0,0.952432 +120,0b0..1111000,0,0,0.957603 +121,0b0..1111001,0,0,0.962803 +122,0b0..1111010,0,0,0.968031 +123,0b0..1111011,0,0,0.973287 +124,0b0..1111100,0,0,0.978572 +125,0b0..1111101,0,0,0.983886 +126,0b0..1111110,0,0,0.989228 +127,0b0..1111111,0,0,0.994599 +128,0b1..0000000,1,0,-1 +129,0b1..0000001,1,0,-1.00543 +130,0b1..0000010,1,0,-1.01089 +131,0b1..0000011,1,0,-1.01638 +132,0b1..0000100,1,0,-1.0219 +133,0b1..0000101,1,0,-1.02745 +134,0b1..0000110,1,0,-1.03302 +135,0b1..0000111,1,0,-1.03863 +136,0b1..0001000,1,0,-1.04427 +137,0b1..0001001,1,0,-1.04994 +138,0b1..0001010,1,0,-1.05565 +139,0b1..0001011,1,0,-1.06138 +140,0b1..0001100,1,0,-1.06714 +141,0b1..0001101,1,0,-1.07293 +142,0b1..0001110,1,0,-1.07876 +143,0b1..0001111,1,0,-1.08462 +144,0b1..0010000,1,0,-1.09051 +145,0b1..0010001,1,0,-1.09643 +146,0b1..0010010,1,0,-1.10238 +147,0b1..0010011,1,0,-1.10837 +148,0b1..0010100,1,0,-1.11439 +149,0b1..0010101,1,0,-1.12044 +150,0b1..0010110,1,0,-1.12652 +151,0b1..0010111,1,0,-1.13264 +152,0b1..0011000,1,0,-1.13879 +153,0b1..0011001,1,0,-1.14497 +154,0b1..0011010,1,0,-1.15119 +155,0b1..0011011,1,0,-1.15744 +156,0b1..0011100,1,0,-1.16372 +157,0b1..0011101,1,0,-1.17004 +158,0b1..0011110,1,0,-1.1764 +159,0b1..0011111,1,0,-1.18278 +160,0b1..0100000,1,0,-1.18921 +161,0b1..0100001,1,0,-1.19566 +162,0b1..0100010,1,0,-1.20216 +163,0b1..0100011,1,0,-1.20868 +164,0b1..0100100,1,0,-1.21525 +165,0b1..0100101,1,0,-1.22185 +166,0b1..0100110,1,0,-1.22848 +167,0b1..0100111,1,0,-1.23515 +168,0b1..0101000,1,0,-1.24186 +169,0b1..0101001,1,0,-1.2486 +170,0b1..0101010,1,0,-1.25538 +171,0b1..0101011,1,0,-1.2622 +172,0b1..0101100,1,0,-1.26905 +173,0b1..0101101,1,0,-1.27594 +174,0b1..0101110,1,0,-1.28287 +175,0b1..0101111,1,0,-1.28984 +176,0b1..0110000,1,0,-1.29684 +177,0b1..0110001,1,0,-1.30388 +178,0b1..0110010,1,0,-1.31096 +179,0b1..0110011,1,0,-1.31808 +180,0b1..0110100,1,0,-1.32524 +181,0b1..0110101,1,0,-1.33243 +182,0b1..0110110,1,0,-1.33967 +183,0b1..0110111,1,0,-1.34694 +184,0b1..0111000,1,0,-1.35426 +185,0b1..0111001,1,0,-1.36161 +186,0b1..0111010,1,0,-1.369 +187,0b1..0111011,1,0,-1.37644 +188,0b1..0111100,1,0,-1.38391 +189,0b1..0111101,1,0,-1.39142 +190,0b1..0111110,1,0,-1.39898 +191,0b1..0111111,1,0,-1.40658 +192,0b1..1000000,1,0,-nan(ind) +193,0b1..1000001,1,0,-0.710946 +194,0b1..1000010,1,0,-0.714807 +195,0b1..1000011,1,0,-0.718688 +196,0b1..1000100,1,0,-0.72259 +197,0b1..1000101,1,0,-0.726514 +198,0b1..1000110,1,0,-0.730459 +199,0b1..1000111,1,0,-0.734425 +200,0b1..1001000,1,0,-0.738413 +201,0b1..1001001,1,0,-0.742423 +202,0b1..1001010,1,0,-0.746454 +203,0b1..1001011,1,0,-0.750507 +204,0b1..1001100,1,0,-0.754582 +205,0b1..1001101,1,0,-0.75868 +206,0b1..1001110,1,0,-0.762799 +207,0b1..1001111,1,0,-0.766941 +208,0b1..1010000,1,0,-0.771105 +209,0b1..1010001,1,0,-0.775292 +210,0b1..1010010,1,0,-0.779502 +211,0b1..1010011,1,0,-0.783735 +212,0b1..1010100,1,0,-0.78799 +213,0b1..1010101,1,0,-0.792269 +214,0b1..1010110,1,0,-0.796571 +215,0b1..1010111,1,0,-0.800896 +216,0b1..1011000,1,0,-0.805245 +217,0b1..1011001,1,0,-0.809618 +218,0b1..1011010,1,0,-0.814014 +219,0b1..1011011,1,0,-0.818434 +220,0b1..1011100,1,0,-0.822878 +221,0b1..1011101,1,0,-0.827346 +222,0b1..1011110,1,0,-0.831838 +223,0b1..1011111,1,0,-0.836355 +224,0b1..1100000,1,0,-0.840896 +225,0b1..1100001,1,0,-0.845462 +226,0b1..1100010,1,0,-0.850053 +227,0b1..1100011,1,0,-0.854669 +228,0b1..1100100,1,0,-0.85931 +229,0b1..1100101,1,0,-0.863976 +230,0b1..1100110,1,0,-0.868667 +231,0b1..1100111,1,0,-0.873384 +232,0b1..1101000,1,0,-0.878126 +233,0b1..1101001,1,0,-0.882894 +234,0b1..1101010,1,0,-0.887688 +235,0b1..1101011,1,0,-0.892508 +236,0b1..1101100,1,0,-0.897355 +237,0b1..1101101,1,0,-0.902227 +238,0b1..1101110,1,0,-0.907126 +239,0b1..1101111,1,0,-0.912052 +240,0b1..1110000,1,0,-0.917004 +241,0b1..1110001,1,0,-0.921983 +242,0b1..1110010,1,0,-0.92699 +243,0b1..1110011,1,0,-0.932023 +244,0b1..1110100,1,0,-0.937084 +245,0b1..1110101,1,0,-0.942172 +246,0b1..1110110,1,0,-0.947288 +247,0b1..1110111,1,0,-0.952432 +248,0b1..1111000,1,0,-0.957603 +249,0b1..1111001,1,0,-0.962803 +250,0b1..1111010,1,0,-0.968031 +251,0b1..1111011,1,0,-0.973287 +252,0b1..1111100,1,0,-0.978572 +253,0b1..1111101,1,0,-0.983886 +254,0b1..1111110,1,0,-0.989228 +255,0b1..1111111,1,0,-0.994599 + +"Generate Value table for an LNS<9,2> in CSV format" +#, Binary, sign, scale, value +0,0b0.000000.00,0,0,1 +1,0b0.000000.01,0,0,1.18921 +2,0b0.000000.10,0,0,1.41421 +3,0b0.000000.11,0,0,1.68179 +4,0b0.000001.00,0,1,2 +5,0b0.000001.01,0,1,2.37841 +6,0b0.000001.10,0,1,2.82843 +7,0b0.000001.11,0,1,3.36359 +8,0b0.000010.00,0,2,4 +9,0b0.000010.01,0,2,4.75683 +10,0b0.000010.10,0,2,5.65685 +11,0b0.000010.11,0,2,6.72717 +12,0b0.000011.00,0,3,8 +13,0b0.000011.01,0,3,9.51366 +14,0b0.000011.10,0,3,11.3137 +15,0b0.000011.11,0,3,13.4543 +16,0b0.000100.00,0,4,16 +17,0b0.000100.01,0,4,19.0273 +18,0b0.000100.10,0,4,22.6274 +19,0b0.000100.11,0,4,26.9087 +20,0b0.000101.00,0,5,32 +21,0b0.000101.01,0,5,38.0546 +22,0b0.000101.10,0,5,45.2548 +23,0b0.000101.11,0,5,53.8174 +24,0b0.000110.00,0,6,64 +25,0b0.000110.01,0,6,76.1093 +26,0b0.000110.10,0,6,90.5097 +27,0b0.000110.11,0,6,107.635 +28,0b0.000111.00,0,7,128 +29,0b0.000111.01,0,7,152.219 +30,0b0.000111.10,0,7,181.019 +31,0b0.000111.11,0,7,215.269 +32,0b0.001000.00,0,8,256 +33,0b0.001000.01,0,8,304.437 +34,0b0.001000.10,0,8,362.039 +35,0b0.001000.11,0,8,430.539 +36,0b0.001001.00,0,9,512 +37,0b0.001001.01,0,9,608.874 +38,0b0.001001.10,0,9,724.077 +39,0b0.001001.11,0,9,861.078 +40,0b0.001010.00,0,10,1024 +41,0b0.001010.01,0,10,1217.75 +42,0b0.001010.10,0,10,1448.15 +43,0b0.001010.11,0,10,1722.16 +44,0b0.001011.00,0,11,2048 +45,0b0.001011.01,0,11,2435.5 +46,0b0.001011.10,0,11,2896.31 +47,0b0.001011.11,0,11,3444.31 +48,0b0.001100.00,0,12,4096 +49,0b0.001100.01,0,12,4870.99 +50,0b0.001100.10,0,12,5792.62 +51,0b0.001100.11,0,12,6888.62 +52,0b0.001101.00,0,13,8192 +53,0b0.001101.01,0,13,9741.98 +54,0b0.001101.10,0,13,11585.2 +55,0b0.001101.11,0,13,13777.2 +56,0b0.001110.00,0,14,16384 +57,0b0.001110.01,0,14,19484 +58,0b0.001110.10,0,14,23170.5 +59,0b0.001110.11,0,14,27554.5 +60,0b0.001111.00,0,15,32768 +61,0b0.001111.01,0,15,38967.9 +62,0b0.001111.10,0,15,46341 +63,0b0.001111.11,0,15,55109 +64,0b0.010000.00,0,16,65536 +65,0b0.010000.01,0,16,77935.9 +66,0b0.010000.10,0,16,92681.9 +67,0b0.010000.11,0,16,110218 +68,0b0.010001.00,0,17,131072 +69,0b0.010001.01,0,17,155872 +70,0b0.010001.10,0,17,185364 +71,0b0.010001.11,0,17,220436 +72,0b0.010010.00,0,18,262144 +73,0b0.010010.01,0,18,311744 +74,0b0.010010.10,0,18,370728 +75,0b0.010010.11,0,18,440872 +76,0b0.010011.00,0,19,524288 +77,0b0.010011.01,0,19,623487 +78,0b0.010011.10,0,19,741455 +79,0b0.010011.11,0,19,881744 +80,0b0.010100.00,0,20,1.04858e+06 +81,0b0.010100.01,0,20,1.24697e+06 +82,0b0.010100.10,0,20,1.48291e+06 +83,0b0.010100.11,0,20,1.76349e+06 +84,0b0.010101.00,0,21,2.09715e+06 +85,0b0.010101.01,0,21,2.49395e+06 +86,0b0.010101.10,0,21,2.96582e+06 +87,0b0.010101.11,0,21,3.52698e+06 +88,0b0.010110.00,0,22,4.1943e+06 +89,0b0.010110.01,0,22,4.9879e+06 +90,0b0.010110.10,0,22,5.93164e+06 +91,0b0.010110.11,0,22,7.05395e+06 +92,0b0.010111.00,0,23,8.38861e+06 +93,0b0.010111.01,0,23,9.97579e+06 +94,0b0.010111.10,0,23,1.18633e+07 +95,0b0.010111.11,0,23,1.41079e+07 +96,0b0.011000.00,0,24,1.67772e+07 +97,0b0.011000.01,0,24,1.99516e+07 +98,0b0.011000.10,0,24,2.37266e+07 +99,0b0.011000.11,0,24,2.82158e+07 +100,0b0.011001.00,0,25,3.35544e+07 +101,0b0.011001.01,0,25,3.99032e+07 +102,0b0.011001.10,0,25,4.74531e+07 +103,0b0.011001.11,0,25,5.64316e+07 +104,0b0.011010.00,0,26,6.71089e+07 +105,0b0.011010.01,0,26,7.98063e+07 +106,0b0.011010.10,0,26,9.49063e+07 +107,0b0.011010.11,0,26,1.12863e+08 +108,0b0.011011.00,0,27,1.34218e+08 +109,0b0.011011.01,0,27,1.59613e+08 +110,0b0.011011.10,0,27,1.89813e+08 +111,0b0.011011.11,0,27,2.25726e+08 +112,0b0.011100.00,0,28,2.68435e+08 +113,0b0.011100.01,0,28,3.19225e+08 +114,0b0.011100.10,0,28,3.79625e+08 +115,0b0.011100.11,0,28,4.51453e+08 +116,0b0.011101.00,0,29,5.36871e+08 +117,0b0.011101.01,0,29,6.38451e+08 +118,0b0.011101.10,0,29,7.5925e+08 +119,0b0.011101.11,0,29,9.02906e+08 +120,0b0.011110.00,0,30,1.07374e+09 +121,0b0.011110.01,0,30,1.2769e+09 +122,0b0.011110.10,0,30,1.5185e+09 +123,0b0.011110.11,0,30,1.80581e+09 +124,0b0.011111.00,0,31,2.14748e+09 +125,0b0.011111.01,0,31,2.5538e+09 +126,0b0.011111.10,0,31,3.037e+09 +127,0b0.011111.11,0,31,3.61162e+09 +128,0b0.100000.00,0,-32,0 +129,0b0.100000.01,0,-32,2.76884e-10 +130,0b0.100000.10,0,-32,3.29272e-10 +131,0b0.100000.11,0,-32,3.91573e-10 +132,0b0.100001.00,0,-31,4.65661e-10 +133,0b0.100001.01,0,-31,5.53768e-10 +134,0b0.100001.10,0,-31,6.58545e-10 +135,0b0.100001.11,0,-31,7.83146e-10 +136,0b0.100010.00,0,-30,9.31323e-10 +137,0b0.100010.01,0,-30,1.10754e-09 +138,0b0.100010.10,0,-30,1.31709e-09 +139,0b0.100010.11,0,-30,1.56629e-09 +140,0b0.100011.00,0,-29,1.86265e-09 +141,0b0.100011.01,0,-29,2.21507e-09 +142,0b0.100011.10,0,-29,2.63418e-09 +143,0b0.100011.11,0,-29,3.13258e-09 +144,0b0.100100.00,0,-28,3.72529e-09 +145,0b0.100100.01,0,-28,4.43014e-09 +146,0b0.100100.10,0,-28,5.26836e-09 +147,0b0.100100.11,0,-28,6.26517e-09 +148,0b0.100101.00,0,-27,7.45058e-09 +149,0b0.100101.01,0,-27,8.86028e-09 +150,0b0.100101.10,0,-27,1.05367e-08 +151,0b0.100101.11,0,-27,1.25303e-08 +152,0b0.100110.00,0,-26,1.49012e-08 +153,0b0.100110.01,0,-26,1.77206e-08 +154,0b0.100110.10,0,-26,2.10734e-08 +155,0b0.100110.11,0,-26,2.50607e-08 +156,0b0.100111.00,0,-25,2.98023e-08 +157,0b0.100111.01,0,-25,3.54411e-08 +158,0b0.100111.10,0,-25,4.21468e-08 +159,0b0.100111.11,0,-25,5.01213e-08 +160,0b0.101000.00,0,-24,5.96046e-08 +161,0b0.101000.01,0,-24,7.08823e-08 +162,0b0.101000.10,0,-24,8.42937e-08 +163,0b0.101000.11,0,-24,1.00243e-07 +164,0b0.101001.00,0,-23,1.19209e-07 +165,0b0.101001.01,0,-23,1.41765e-07 +166,0b0.101001.10,0,-23,1.68587e-07 +167,0b0.101001.11,0,-23,2.00485e-07 +168,0b0.101010.00,0,-22,2.38419e-07 +169,0b0.101010.01,0,-22,2.83529e-07 +170,0b0.101010.10,0,-22,3.37175e-07 +171,0b0.101010.11,0,-22,4.00971e-07 +172,0b0.101011.00,0,-21,4.76837e-07 +173,0b0.101011.01,0,-21,5.67058e-07 +174,0b0.101011.10,0,-21,6.7435e-07 +175,0b0.101011.11,0,-21,8.01941e-07 +176,0b0.101100.00,0,-20,9.53674e-07 +177,0b0.101100.01,0,-20,1.13412e-06 +178,0b0.101100.10,0,-20,1.3487e-06 +179,0b0.101100.11,0,-20,1.60388e-06 +180,0b0.101101.00,0,-19,1.90735e-06 +181,0b0.101101.01,0,-19,2.26823e-06 +182,0b0.101101.10,0,-19,2.6974e-06 +183,0b0.101101.11,0,-19,3.20777e-06 +184,0b0.101110.00,0,-18,3.8147e-06 +185,0b0.101110.01,0,-18,4.53647e-06 +186,0b0.101110.10,0,-18,5.3948e-06 +187,0b0.101110.11,0,-18,6.41553e-06 +188,0b0.101111.00,0,-17,7.62939e-06 +189,0b0.101111.01,0,-17,9.07293e-06 +190,0b0.101111.10,0,-17,1.07896e-05 +191,0b0.101111.11,0,-17,1.28311e-05 +192,0b0.110000.00,0,-16,1.52588e-05 +193,0b0.110000.01,0,-16,1.81459e-05 +194,0b0.110000.10,0,-16,2.15792e-05 +195,0b0.110000.11,0,-16,2.56621e-05 +196,0b0.110001.00,0,-15,3.05176e-05 +197,0b0.110001.01,0,-15,3.62917e-05 +198,0b0.110001.10,0,-15,4.31584e-05 +199,0b0.110001.11,0,-15,5.13242e-05 +200,0b0.110010.00,0,-14,6.10352e-05 +201,0b0.110010.01,0,-14,7.25834e-05 +202,0b0.110010.10,0,-14,8.63167e-05 +203,0b0.110010.11,0,-14,0.000102648 +204,0b0.110011.00,0,-13,0.00012207 +205,0b0.110011.01,0,-13,0.000145167 +206,0b0.110011.10,0,-13,0.000172633 +207,0b0.110011.11,0,-13,0.000205297 +208,0b0.110100.00,0,-12,0.000244141 +209,0b0.110100.01,0,-12,0.000290334 +210,0b0.110100.10,0,-12,0.000345267 +211,0b0.110100.11,0,-12,0.000410594 +212,0b0.110101.00,0,-11,0.000488281 +213,0b0.110101.01,0,-11,0.000580668 +214,0b0.110101.10,0,-11,0.000690534 +215,0b0.110101.11,0,-11,0.000821188 +216,0b0.110110.00,0,-10,0.000976562 +217,0b0.110110.01,0,-10,0.00116134 +218,0b0.110110.10,0,-10,0.00138107 +219,0b0.110110.11,0,-10,0.00164238 +220,0b0.110111.00,0,-9,0.00195312 +221,0b0.110111.01,0,-9,0.00232267 +222,0b0.110111.10,0,-9,0.00276214 +223,0b0.110111.11,0,-9,0.00328475 +224,0b0.111000.00,0,-8,0.00390625 +225,0b0.111000.01,0,-8,0.00464534 +226,0b0.111000.10,0,-8,0.00552427 +227,0b0.111000.11,0,-8,0.0065695 +228,0b0.111001.00,0,-7,0.0078125 +229,0b0.111001.01,0,-7,0.00929068 +230,0b0.111001.10,0,-7,0.0110485 +231,0b0.111001.11,0,-7,0.013139 +232,0b0.111010.00,0,-6,0.015625 +233,0b0.111010.01,0,-6,0.0185814 +234,0b0.111010.10,0,-6,0.0220971 +235,0b0.111010.11,0,-6,0.026278 +236,0b0.111011.00,0,-5,0.03125 +237,0b0.111011.01,0,-5,0.0371627 +238,0b0.111011.10,0,-5,0.0441942 +239,0b0.111011.11,0,-5,0.052556 +240,0b0.111100.00,0,-4,0.0625 +241,0b0.111100.01,0,-4,0.0743254 +242,0b0.111100.10,0,-4,0.0883883 +243,0b0.111100.11,0,-4,0.105112 +244,0b0.111101.00,0,-3,0.125 +245,0b0.111101.01,0,-3,0.148651 +246,0b0.111101.10,0,-3,0.176777 +247,0b0.111101.11,0,-3,0.210224 +248,0b0.111110.00,0,-2,0.25 +249,0b0.111110.01,0,-2,0.297302 +250,0b0.111110.10,0,-2,0.353553 +251,0b0.111110.11,0,-2,0.420448 +252,0b0.111111.00,0,-1,0.5 +253,0b0.111111.01,0,-1,0.594604 +254,0b0.111111.10,0,-1,0.707107 +255,0b0.111111.11,0,-1,0.840896 +256,0b1.000000.00,1,0,-1 +257,0b1.000000.01,1,0,-1.18921 +258,0b1.000000.10,1,0,-1.41421 +259,0b1.000000.11,1,0,-1.68179 +260,0b1.000001.00,1,1,-2 +261,0b1.000001.01,1,1,-2.37841 +262,0b1.000001.10,1,1,-2.82843 +263,0b1.000001.11,1,1,-3.36359 +264,0b1.000010.00,1,2,-4 +265,0b1.000010.01,1,2,-4.75683 +266,0b1.000010.10,1,2,-5.65685 +267,0b1.000010.11,1,2,-6.72717 +268,0b1.000011.00,1,3,-8 +269,0b1.000011.01,1,3,-9.51366 +270,0b1.000011.10,1,3,-11.3137 +271,0b1.000011.11,1,3,-13.4543 +272,0b1.000100.00,1,4,-16 +273,0b1.000100.01,1,4,-19.0273 +274,0b1.000100.10,1,4,-22.6274 +275,0b1.000100.11,1,4,-26.9087 +276,0b1.000101.00,1,5,-32 +277,0b1.000101.01,1,5,-38.0546 +278,0b1.000101.10,1,5,-45.2548 +279,0b1.000101.11,1,5,-53.8174 +280,0b1.000110.00,1,6,-64 +281,0b1.000110.01,1,6,-76.1093 +282,0b1.000110.10,1,6,-90.5097 +283,0b1.000110.11,1,6,-107.635 +284,0b1.000111.00,1,7,-128 +285,0b1.000111.01,1,7,-152.219 +286,0b1.000111.10,1,7,-181.019 +287,0b1.000111.11,1,7,-215.269 +288,0b1.001000.00,1,8,-256 +289,0b1.001000.01,1,8,-304.437 +290,0b1.001000.10,1,8,-362.039 +291,0b1.001000.11,1,8,-430.539 +292,0b1.001001.00,1,9,-512 +293,0b1.001001.01,1,9,-608.874 +294,0b1.001001.10,1,9,-724.077 +295,0b1.001001.11,1,9,-861.078 +296,0b1.001010.00,1,10,-1024 +297,0b1.001010.01,1,10,-1217.75 +298,0b1.001010.10,1,10,-1448.15 +299,0b1.001010.11,1,10,-1722.16 +300,0b1.001011.00,1,11,-2048 +301,0b1.001011.01,1,11,-2435.5 +302,0b1.001011.10,1,11,-2896.31 +303,0b1.001011.11,1,11,-3444.31 +304,0b1.001100.00,1,12,-4096 +305,0b1.001100.01,1,12,-4870.99 +306,0b1.001100.10,1,12,-5792.62 +307,0b1.001100.11,1,12,-6888.62 +308,0b1.001101.00,1,13,-8192 +309,0b1.001101.01,1,13,-9741.98 +310,0b1.001101.10,1,13,-11585.2 +311,0b1.001101.11,1,13,-13777.2 +312,0b1.001110.00,1,14,-16384 +313,0b1.001110.01,1,14,-19484 +314,0b1.001110.10,1,14,-23170.5 +315,0b1.001110.11,1,14,-27554.5 +316,0b1.001111.00,1,15,-32768 +317,0b1.001111.01,1,15,-38967.9 +318,0b1.001111.10,1,15,-46341 +319,0b1.001111.11,1,15,-55109 +320,0b1.010000.00,1,16,-65536 +321,0b1.010000.01,1,16,-77935.9 +322,0b1.010000.10,1,16,-92681.9 +323,0b1.010000.11,1,16,-110218 +324,0b1.010001.00,1,17,-131072 +325,0b1.010001.01,1,17,-155872 +326,0b1.010001.10,1,17,-185364 +327,0b1.010001.11,1,17,-220436 +328,0b1.010010.00,1,18,-262144 +329,0b1.010010.01,1,18,-311744 +330,0b1.010010.10,1,18,-370728 +331,0b1.010010.11,1,18,-440872 +332,0b1.010011.00,1,19,-524288 +333,0b1.010011.01,1,19,-623487 +334,0b1.010011.10,1,19,-741455 +335,0b1.010011.11,1,19,-881744 +336,0b1.010100.00,1,20,-1.04858e+06 +337,0b1.010100.01,1,20,-1.24697e+06 +338,0b1.010100.10,1,20,-1.48291e+06 +339,0b1.010100.11,1,20,-1.76349e+06 +340,0b1.010101.00,1,21,-2.09715e+06 +341,0b1.010101.01,1,21,-2.49395e+06 +342,0b1.010101.10,1,21,-2.96582e+06 +343,0b1.010101.11,1,21,-3.52698e+06 +344,0b1.010110.00,1,22,-4.1943e+06 +345,0b1.010110.01,1,22,-4.9879e+06 +346,0b1.010110.10,1,22,-5.93164e+06 +347,0b1.010110.11,1,22,-7.05395e+06 +348,0b1.010111.00,1,23,-8.38861e+06 +349,0b1.010111.01,1,23,-9.97579e+06 +350,0b1.010111.10,1,23,-1.18633e+07 +351,0b1.010111.11,1,23,-1.41079e+07 +352,0b1.011000.00,1,24,-1.67772e+07 +353,0b1.011000.01,1,24,-1.99516e+07 +354,0b1.011000.10,1,24,-2.37266e+07 +355,0b1.011000.11,1,24,-2.82158e+07 +356,0b1.011001.00,1,25,-3.35544e+07 +357,0b1.011001.01,1,25,-3.99032e+07 +358,0b1.011001.10,1,25,-4.74531e+07 +359,0b1.011001.11,1,25,-5.64316e+07 +360,0b1.011010.00,1,26,-6.71089e+07 +361,0b1.011010.01,1,26,-7.98063e+07 +362,0b1.011010.10,1,26,-9.49063e+07 +363,0b1.011010.11,1,26,-1.12863e+08 +364,0b1.011011.00,1,27,-1.34218e+08 +365,0b1.011011.01,1,27,-1.59613e+08 +366,0b1.011011.10,1,27,-1.89813e+08 +367,0b1.011011.11,1,27,-2.25726e+08 +368,0b1.011100.00,1,28,-2.68435e+08 +369,0b1.011100.01,1,28,-3.19225e+08 +370,0b1.011100.10,1,28,-3.79625e+08 +371,0b1.011100.11,1,28,-4.51453e+08 +372,0b1.011101.00,1,29,-5.36871e+08 +373,0b1.011101.01,1,29,-6.38451e+08 +374,0b1.011101.10,1,29,-7.5925e+08 +375,0b1.011101.11,1,29,-9.02906e+08 +376,0b1.011110.00,1,30,-1.07374e+09 +377,0b1.011110.01,1,30,-1.2769e+09 +378,0b1.011110.10,1,30,-1.5185e+09 +379,0b1.011110.11,1,30,-1.80581e+09 +380,0b1.011111.00,1,31,-2.14748e+09 +381,0b1.011111.01,1,31,-2.5538e+09 +382,0b1.011111.10,1,31,-3.037e+09 +383,0b1.011111.11,1,31,-3.61162e+09 +384,0b1.100000.00,1,-32,-nan(ind) +385,0b1.100000.01,1,-32,-2.76884e-10 +386,0b1.100000.10,1,-32,-3.29272e-10 +387,0b1.100000.11,1,-32,-3.91573e-10 +388,0b1.100001.00,1,-31,-4.65661e-10 +389,0b1.100001.01,1,-31,-5.53768e-10 +390,0b1.100001.10,1,-31,-6.58545e-10 +391,0b1.100001.11,1,-31,-7.83146e-10 +392,0b1.100010.00,1,-30,-9.31323e-10 +393,0b1.100010.01,1,-30,-1.10754e-09 +394,0b1.100010.10,1,-30,-1.31709e-09 +395,0b1.100010.11,1,-30,-1.56629e-09 +396,0b1.100011.00,1,-29,-1.86265e-09 +397,0b1.100011.01,1,-29,-2.21507e-09 +398,0b1.100011.10,1,-29,-2.63418e-09 +399,0b1.100011.11,1,-29,-3.13258e-09 +400,0b1.100100.00,1,-28,-3.72529e-09 +401,0b1.100100.01,1,-28,-4.43014e-09 +402,0b1.100100.10,1,-28,-5.26836e-09 +403,0b1.100100.11,1,-28,-6.26517e-09 +404,0b1.100101.00,1,-27,-7.45058e-09 +405,0b1.100101.01,1,-27,-8.86028e-09 +406,0b1.100101.10,1,-27,-1.05367e-08 +407,0b1.100101.11,1,-27,-1.25303e-08 +408,0b1.100110.00,1,-26,-1.49012e-08 +409,0b1.100110.01,1,-26,-1.77206e-08 +410,0b1.100110.10,1,-26,-2.10734e-08 +411,0b1.100110.11,1,-26,-2.50607e-08 +412,0b1.100111.00,1,-25,-2.98023e-08 +413,0b1.100111.01,1,-25,-3.54411e-08 +414,0b1.100111.10,1,-25,-4.21468e-08 +415,0b1.100111.11,1,-25,-5.01213e-08 +416,0b1.101000.00,1,-24,-5.96046e-08 +417,0b1.101000.01,1,-24,-7.08823e-08 +418,0b1.101000.10,1,-24,-8.42937e-08 +419,0b1.101000.11,1,-24,-1.00243e-07 +420,0b1.101001.00,1,-23,-1.19209e-07 +421,0b1.101001.01,1,-23,-1.41765e-07 +422,0b1.101001.10,1,-23,-1.68587e-07 +423,0b1.101001.11,1,-23,-2.00485e-07 +424,0b1.101010.00,1,-22,-2.38419e-07 +425,0b1.101010.01,1,-22,-2.83529e-07 +426,0b1.101010.10,1,-22,-3.37175e-07 +427,0b1.101010.11,1,-22,-4.00971e-07 +428,0b1.101011.00,1,-21,-4.76837e-07 +429,0b1.101011.01,1,-21,-5.67058e-07 +430,0b1.101011.10,1,-21,-6.7435e-07 +431,0b1.101011.11,1,-21,-8.01941e-07 +432,0b1.101100.00,1,-20,-9.53674e-07 +433,0b1.101100.01,1,-20,-1.13412e-06 +434,0b1.101100.10,1,-20,-1.3487e-06 +435,0b1.101100.11,1,-20,-1.60388e-06 +436,0b1.101101.00,1,-19,-1.90735e-06 +437,0b1.101101.01,1,-19,-2.26823e-06 +438,0b1.101101.10,1,-19,-2.6974e-06 +439,0b1.101101.11,1,-19,-3.20777e-06 +440,0b1.101110.00,1,-18,-3.8147e-06 +441,0b1.101110.01,1,-18,-4.53647e-06 +442,0b1.101110.10,1,-18,-5.3948e-06 +443,0b1.101110.11,1,-18,-6.41553e-06 +444,0b1.101111.00,1,-17,-7.62939e-06 +445,0b1.101111.01,1,-17,-9.07293e-06 +446,0b1.101111.10,1,-17,-1.07896e-05 +447,0b1.101111.11,1,-17,-1.28311e-05 +448,0b1.110000.00,1,-16,-1.52588e-05 +449,0b1.110000.01,1,-16,-1.81459e-05 +450,0b1.110000.10,1,-16,-2.15792e-05 +451,0b1.110000.11,1,-16,-2.56621e-05 +452,0b1.110001.00,1,-15,-3.05176e-05 +453,0b1.110001.01,1,-15,-3.62917e-05 +454,0b1.110001.10,1,-15,-4.31584e-05 +455,0b1.110001.11,1,-15,-5.13242e-05 +456,0b1.110010.00,1,-14,-6.10352e-05 +457,0b1.110010.01,1,-14,-7.25834e-05 +458,0b1.110010.10,1,-14,-8.63167e-05 +459,0b1.110010.11,1,-14,-0.000102648 +460,0b1.110011.00,1,-13,-0.00012207 +461,0b1.110011.01,1,-13,-0.000145167 +462,0b1.110011.10,1,-13,-0.000172633 +463,0b1.110011.11,1,-13,-0.000205297 +464,0b1.110100.00,1,-12,-0.000244141 +465,0b1.110100.01,1,-12,-0.000290334 +466,0b1.110100.10,1,-12,-0.000345267 +467,0b1.110100.11,1,-12,-0.000410594 +468,0b1.110101.00,1,-11,-0.000488281 +469,0b1.110101.01,1,-11,-0.000580668 +470,0b1.110101.10,1,-11,-0.000690534 +471,0b1.110101.11,1,-11,-0.000821188 +472,0b1.110110.00,1,-10,-0.000976562 +473,0b1.110110.01,1,-10,-0.00116134 +474,0b1.110110.10,1,-10,-0.00138107 +475,0b1.110110.11,1,-10,-0.00164238 +476,0b1.110111.00,1,-9,-0.00195312 +477,0b1.110111.01,1,-9,-0.00232267 +478,0b1.110111.10,1,-9,-0.00276214 +479,0b1.110111.11,1,-9,-0.00328475 +480,0b1.111000.00,1,-8,-0.00390625 +481,0b1.111000.01,1,-8,-0.00464534 +482,0b1.111000.10,1,-8,-0.00552427 +483,0b1.111000.11,1,-8,-0.0065695 +484,0b1.111001.00,1,-7,-0.0078125 +485,0b1.111001.01,1,-7,-0.00929068 +486,0b1.111001.10,1,-7,-0.0110485 +487,0b1.111001.11,1,-7,-0.013139 +488,0b1.111010.00,1,-6,-0.015625 +489,0b1.111010.01,1,-6,-0.0185814 +490,0b1.111010.10,1,-6,-0.0220971 +491,0b1.111010.11,1,-6,-0.026278 +492,0b1.111011.00,1,-5,-0.03125 +493,0b1.111011.01,1,-5,-0.0371627 +494,0b1.111011.10,1,-5,-0.0441942 +495,0b1.111011.11,1,-5,-0.052556 +496,0b1.111100.00,1,-4,-0.0625 +497,0b1.111100.01,1,-4,-0.0743254 +498,0b1.111100.10,1,-4,-0.0883883 +499,0b1.111100.11,1,-4,-0.105112 +500,0b1.111101.00,1,-3,-0.125 +501,0b1.111101.01,1,-3,-0.148651 +502,0b1.111101.10,1,-3,-0.176777 +503,0b1.111101.11,1,-3,-0.210224 +504,0b1.111110.00,1,-2,-0.25 +505,0b1.111110.01,1,-2,-0.297302 +506,0b1.111110.10,1,-2,-0.353553 +507,0b1.111110.11,1,-2,-0.420448 +508,0b1.111111.00,1,-1,-0.5 +509,0b1.111111.01,1,-1,-0.594604 +510,0b1.111111.10,1,-1,-0.707107 +511,0b1.111111.11,1,-1,-0.840896 + +"Generate Value table for an LNS<9,4> in CSV format" +#, Binary, sign, scale, value +0,0b0.0000.0000,0,0,1 +1,0b0.0000.0001,0,0,1.04427 +2,0b0.0000.0010,0,0,1.09051 +3,0b0.0000.0011,0,0,1.13879 +4,0b0.0000.0100,0,0,1.18921 +5,0b0.0000.0101,0,0,1.24186 +6,0b0.0000.0110,0,0,1.29684 +7,0b0.0000.0111,0,0,1.35426 +8,0b0.0000.1000,0,0,1.41421 +9,0b0.0000.1001,0,0,1.47683 +10,0b0.0000.1010,0,0,1.54221 +11,0b0.0000.1011,0,0,1.61049 +12,0b0.0000.1100,0,0,1.68179 +13,0b0.0000.1101,0,0,1.75625 +14,0b0.0000.1110,0,0,1.83401 +15,0b0.0000.1111,0,0,1.91521 +16,0b0.0001.0000,0,1,2 +17,0b0.0001.0001,0,1,2.08855 +18,0b0.0001.0010,0,1,2.18102 +19,0b0.0001.0011,0,1,2.27758 +20,0b0.0001.0100,0,1,2.37841 +21,0b0.0001.0101,0,1,2.48372 +22,0b0.0001.0110,0,1,2.59368 +23,0b0.0001.0111,0,1,2.70851 +24,0b0.0001.1000,0,1,2.82843 +25,0b0.0001.1001,0,1,2.95365 +26,0b0.0001.1010,0,1,3.08442 +27,0b0.0001.1011,0,1,3.22098 +28,0b0.0001.1100,0,1,3.36359 +29,0b0.0001.1101,0,1,3.5125 +30,0b0.0001.1110,0,1,3.66802 +31,0b0.0001.1111,0,1,3.83041 +32,0b0.0010.0000,0,2,4 +33,0b0.0010.0001,0,2,4.1771 +34,0b0.0010.0010,0,2,4.36203 +35,0b0.0010.0011,0,2,4.55515 +36,0b0.0010.0100,0,2,4.75683 +37,0b0.0010.0101,0,2,4.96743 +38,0b0.0010.0110,0,2,5.18736 +39,0b0.0010.0111,0,2,5.41702 +40,0b0.0010.1000,0,2,5.65685 +41,0b0.0010.1001,0,2,5.9073 +42,0b0.0010.1010,0,2,6.16884 +43,0b0.0010.1011,0,2,6.44196 +44,0b0.0010.1100,0,2,6.72717 +45,0b0.0010.1101,0,2,7.02501 +46,0b0.0010.1110,0,2,7.33603 +47,0b0.0010.1111,0,2,7.66083 +48,0b0.0011.0000,0,3,8 +49,0b0.0011.0001,0,3,8.35419 +50,0b0.0011.0010,0,3,8.72406 +51,0b0.0011.0011,0,3,9.11031 +52,0b0.0011.0100,0,3,9.51366 +53,0b0.0011.0101,0,3,9.93486 +54,0b0.0011.0110,0,3,10.3747 +55,0b0.0011.0111,0,3,10.834 +56,0b0.0011.1000,0,3,11.3137 +57,0b0.0011.1001,0,3,11.8146 +58,0b0.0011.1010,0,3,12.3377 +59,0b0.0011.1011,0,3,12.8839 +60,0b0.0011.1100,0,3,13.4543 +61,0b0.0011.1101,0,3,14.05 +62,0b0.0011.1110,0,3,14.6721 +63,0b0.0011.1111,0,3,15.3217 +64,0b0.0100.0000,0,4,16 +65,0b0.0100.0001,0,4,16.7084 +66,0b0.0100.0010,0,4,17.4481 +67,0b0.0100.0011,0,4,18.2206 +68,0b0.0100.0100,0,4,19.0273 +69,0b0.0100.0101,0,4,19.8697 +70,0b0.0100.0110,0,4,20.7494 +71,0b0.0100.0111,0,4,21.6681 +72,0b0.0100.1000,0,4,22.6274 +73,0b0.0100.1001,0,4,23.6292 +74,0b0.0100.1010,0,4,24.6754 +75,0b0.0100.1011,0,4,25.7678 +76,0b0.0100.1100,0,4,26.9087 +77,0b0.0100.1101,0,4,28.1 +78,0b0.0100.1110,0,4,29.3441 +79,0b0.0100.1111,0,4,30.6433 +80,0b0.0101.0000,0,5,32 +81,0b0.0101.0001,0,5,33.4168 +82,0b0.0101.0010,0,5,34.8962 +83,0b0.0101.0011,0,5,36.4412 +84,0b0.0101.0100,0,5,38.0546 +85,0b0.0101.0101,0,5,39.7394 +86,0b0.0101.0110,0,5,41.4989 +87,0b0.0101.0111,0,5,43.3362 +88,0b0.0101.1000,0,5,45.2548 +89,0b0.0101.1001,0,5,47.2584 +90,0b0.0101.1010,0,5,49.3507 +91,0b0.0101.1011,0,5,51.5357 +92,0b0.0101.1100,0,5,53.8174 +93,0b0.0101.1101,0,5,56.2001 +94,0b0.0101.1110,0,5,58.6883 +95,0b0.0101.1111,0,5,61.2866 +96,0b0.0110.0000,0,6,64 +97,0b0.0110.0001,0,6,66.8335 +98,0b0.0110.0010,0,6,69.7925 +99,0b0.0110.0011,0,6,72.8825 +100,0b0.0110.0100,0,6,76.1093 +101,0b0.0110.0101,0,6,79.4789 +102,0b0.0110.0110,0,6,82.9977 +103,0b0.0110.0111,0,6,86.6724 +104,0b0.0110.1000,0,6,90.5097 +105,0b0.0110.1001,0,6,94.5169 +106,0b0.0110.1010,0,6,98.7015 +107,0b0.0110.1011,0,6,103.071 +108,0b0.0110.1100,0,6,107.635 +109,0b0.0110.1101,0,6,112.4 +110,0b0.0110.1110,0,6,117.377 +111,0b0.0110.1111,0,6,122.573 +112,0b0.0111.0000,0,7,128 +113,0b0.0111.0001,0,7,133.667 +114,0b0.0111.0010,0,7,139.585 +115,0b0.0111.0011,0,7,145.765 +116,0b0.0111.0100,0,7,152.219 +117,0b0.0111.0101,0,7,158.958 +118,0b0.0111.0110,0,7,165.995 +119,0b0.0111.0111,0,7,173.345 +120,0b0.0111.1000,0,7,181.019 +121,0b0.0111.1001,0,7,189.034 +122,0b0.0111.1010,0,7,197.403 +123,0b0.0111.1011,0,7,206.143 +124,0b0.0111.1100,0,7,215.269 +125,0b0.0111.1101,0,7,224.8 +126,0b0.0111.1110,0,7,234.753 +127,0b0.0111.1111,0,7,245.146 +128,0b0.1000.0000,0,-8,0 +129,0b0.1000.0001,0,-8,0.00407919 +130,0b0.1000.0010,0,-8,0.0042598 +131,0b0.1000.0011,0,-8,0.00444839 +132,0b0.1000.0100,0,-8,0.00464534 +133,0b0.1000.0101,0,-8,0.00485101 +134,0b0.1000.0110,0,-8,0.00506578 +135,0b0.1000.0111,0,-8,0.00529006 +136,0b0.1000.1000,0,-8,0.00552427 +137,0b0.1000.1001,0,-8,0.00576885 +138,0b0.1000.1010,0,-8,0.00602426 +139,0b0.1000.1011,0,-8,0.00629098 +140,0b0.1000.1100,0,-8,0.0065695 +141,0b0.1000.1101,0,-8,0.00686036 +142,0b0.1000.1110,0,-8,0.00716409 +143,0b0.1000.1111,0,-8,0.00748128 +144,0b0.1001.0000,0,-7,0.0078125 +145,0b0.1001.0001,0,-7,0.00815839 +146,0b0.1001.0010,0,-7,0.00851959 +147,0b0.1001.0011,0,-7,0.00889679 +148,0b0.1001.0100,0,-7,0.00929068 +149,0b0.1001.0101,0,-7,0.00970201 +150,0b0.1001.0110,0,-7,0.0101316 +151,0b0.1001.0111,0,-7,0.0105801 +152,0b0.1001.1000,0,-7,0.0110485 +153,0b0.1001.1001,0,-7,0.0115377 +154,0b0.1001.1010,0,-7,0.0120485 +155,0b0.1001.1011,0,-7,0.012582 +156,0b0.1001.1100,0,-7,0.013139 +157,0b0.1001.1101,0,-7,0.0137207 +158,0b0.1001.1110,0,-7,0.0143282 +159,0b0.1001.1111,0,-7,0.0149626 +160,0b0.1010.0000,0,-6,0.015625 +161,0b0.1010.0001,0,-6,0.0163168 +162,0b0.1010.0010,0,-6,0.0170392 +163,0b0.1010.0011,0,-6,0.0177936 +164,0b0.1010.0100,0,-6,0.0185814 +165,0b0.1010.0101,0,-6,0.019404 +166,0b0.1010.0110,0,-6,0.0202631 +167,0b0.1010.0111,0,-6,0.0211602 +168,0b0.1010.1000,0,-6,0.0220971 +169,0b0.1010.1001,0,-6,0.0230754 +170,0b0.1010.1010,0,-6,0.024097 +171,0b0.1010.1011,0,-6,0.0251639 +172,0b0.1010.1100,0,-6,0.026278 +173,0b0.1010.1101,0,-6,0.0274414 +174,0b0.1010.1110,0,-6,0.0286564 +175,0b0.1010.1111,0,-6,0.0299251 +176,0b0.1011.0000,0,-5,0.03125 +177,0b0.1011.0001,0,-5,0.0326336 +178,0b0.1011.0010,0,-5,0.0340784 +179,0b0.1011.0011,0,-5,0.0355871 +180,0b0.1011.0100,0,-5,0.0371627 +181,0b0.1011.0101,0,-5,0.0388081 +182,0b0.1011.0110,0,-5,0.0405262 +183,0b0.1011.0111,0,-5,0.0423205 +184,0b0.1011.1000,0,-5,0.0441942 +185,0b0.1011.1001,0,-5,0.0461508 +186,0b0.1011.1010,0,-5,0.0481941 +187,0b0.1011.1011,0,-5,0.0503278 +188,0b0.1011.1100,0,-5,0.052556 +189,0b0.1011.1101,0,-5,0.0548829 +190,0b0.1011.1110,0,-5,0.0573128 +191,0b0.1011.1111,0,-5,0.0598502 +192,0b0.1100.0000,0,-4,0.0625 +193,0b0.1100.0001,0,-4,0.0652671 +194,0b0.1100.0010,0,-4,0.0681567 +195,0b0.1100.0011,0,-4,0.0711743 +196,0b0.1100.0100,0,-4,0.0743254 +197,0b0.1100.0101,0,-4,0.0776161 +198,0b0.1100.0110,0,-4,0.0810525 +199,0b0.1100.0111,0,-4,0.084641 +200,0b0.1100.1000,0,-4,0.0883883 +201,0b0.1100.1001,0,-4,0.0923016 +202,0b0.1100.1010,0,-4,0.0963882 +203,0b0.1100.1011,0,-4,0.100656 +204,0b0.1100.1100,0,-4,0.105112 +205,0b0.1100.1101,0,-4,0.109766 +206,0b0.1100.1110,0,-4,0.114626 +207,0b0.1100.1111,0,-4,0.1197 +208,0b0.1101.0000,0,-3,0.125 +209,0b0.1101.0001,0,-3,0.130534 +210,0b0.1101.0010,0,-3,0.136313 +211,0b0.1101.0011,0,-3,0.142349 +212,0b0.1101.0100,0,-3,0.148651 +213,0b0.1101.0101,0,-3,0.155232 +214,0b0.1101.0110,0,-3,0.162105 +215,0b0.1101.0111,0,-3,0.169282 +216,0b0.1101.1000,0,-3,0.176777 +217,0b0.1101.1001,0,-3,0.184603 +218,0b0.1101.1010,0,-3,0.192776 +219,0b0.1101.1011,0,-3,0.201311 +220,0b0.1101.1100,0,-3,0.210224 +221,0b0.1101.1101,0,-3,0.219532 +222,0b0.1101.1110,0,-3,0.229251 +223,0b0.1101.1111,0,-3,0.239401 +224,0b0.1110.0000,0,-2,0.25 +225,0b0.1110.0001,0,-2,0.261068 +226,0b0.1110.0010,0,-2,0.272627 +227,0b0.1110.0011,0,-2,0.284697 +228,0b0.1110.0100,0,-2,0.297302 +229,0b0.1110.0101,0,-2,0.310464 +230,0b0.1110.0110,0,-2,0.32421 +231,0b0.1110.0111,0,-2,0.338564 +232,0b0.1110.1000,0,-2,0.353553 +233,0b0.1110.1001,0,-2,0.369207 +234,0b0.1110.1010,0,-2,0.385553 +235,0b0.1110.1011,0,-2,0.402623 +236,0b0.1110.1100,0,-2,0.420448 +237,0b0.1110.1101,0,-2,0.439063 +238,0b0.1110.1110,0,-2,0.458502 +239,0b0.1110.1111,0,-2,0.478802 +240,0b0.1111.0000,0,-1,0.5 +241,0b0.1111.0001,0,-1,0.522137 +242,0b0.1111.0010,0,-1,0.545254 +243,0b0.1111.0011,0,-1,0.569394 +244,0b0.1111.0100,0,-1,0.594604 +245,0b0.1111.0101,0,-1,0.620929 +246,0b0.1111.0110,0,-1,0.64842 +247,0b0.1111.0111,0,-1,0.677128 +248,0b0.1111.1000,0,-1,0.707107 +249,0b0.1111.1001,0,-1,0.738413 +250,0b0.1111.1010,0,-1,0.771105 +251,0b0.1111.1011,0,-1,0.805245 +252,0b0.1111.1100,0,-1,0.840896 +253,0b0.1111.1101,0,-1,0.878126 +254,0b0.1111.1110,0,-1,0.917004 +255,0b0.1111.1111,0,-1,0.957603 +256,0b1.0000.0000,1,0,-1 +257,0b1.0000.0001,1,0,-1.04427 +258,0b1.0000.0010,1,0,-1.09051 +259,0b1.0000.0011,1,0,-1.13879 +260,0b1.0000.0100,1,0,-1.18921 +261,0b1.0000.0101,1,0,-1.24186 +262,0b1.0000.0110,1,0,-1.29684 +263,0b1.0000.0111,1,0,-1.35426 +264,0b1.0000.1000,1,0,-1.41421 +265,0b1.0000.1001,1,0,-1.47683 +266,0b1.0000.1010,1,0,-1.54221 +267,0b1.0000.1011,1,0,-1.61049 +268,0b1.0000.1100,1,0,-1.68179 +269,0b1.0000.1101,1,0,-1.75625 +270,0b1.0000.1110,1,0,-1.83401 +271,0b1.0000.1111,1,0,-1.91521 +272,0b1.0001.0000,1,1,-2 +273,0b1.0001.0001,1,1,-2.08855 +274,0b1.0001.0010,1,1,-2.18102 +275,0b1.0001.0011,1,1,-2.27758 +276,0b1.0001.0100,1,1,-2.37841 +277,0b1.0001.0101,1,1,-2.48372 +278,0b1.0001.0110,1,1,-2.59368 +279,0b1.0001.0111,1,1,-2.70851 +280,0b1.0001.1000,1,1,-2.82843 +281,0b1.0001.1001,1,1,-2.95365 +282,0b1.0001.1010,1,1,-3.08442 +283,0b1.0001.1011,1,1,-3.22098 +284,0b1.0001.1100,1,1,-3.36359 +285,0b1.0001.1101,1,1,-3.5125 +286,0b1.0001.1110,1,1,-3.66802 +287,0b1.0001.1111,1,1,-3.83041 +288,0b1.0010.0000,1,2,-4 +289,0b1.0010.0001,1,2,-4.1771 +290,0b1.0010.0010,1,2,-4.36203 +291,0b1.0010.0011,1,2,-4.55515 +292,0b1.0010.0100,1,2,-4.75683 +293,0b1.0010.0101,1,2,-4.96743 +294,0b1.0010.0110,1,2,-5.18736 +295,0b1.0010.0111,1,2,-5.41702 +296,0b1.0010.1000,1,2,-5.65685 +297,0b1.0010.1001,1,2,-5.9073 +298,0b1.0010.1010,1,2,-6.16884 +299,0b1.0010.1011,1,2,-6.44196 +300,0b1.0010.1100,1,2,-6.72717 +301,0b1.0010.1101,1,2,-7.02501 +302,0b1.0010.1110,1,2,-7.33603 +303,0b1.0010.1111,1,2,-7.66083 +304,0b1.0011.0000,1,3,-8 +305,0b1.0011.0001,1,3,-8.35419 +306,0b1.0011.0010,1,3,-8.72406 +307,0b1.0011.0011,1,3,-9.11031 +308,0b1.0011.0100,1,3,-9.51366 +309,0b1.0011.0101,1,3,-9.93486 +310,0b1.0011.0110,1,3,-10.3747 +311,0b1.0011.0111,1,3,-10.834 +312,0b1.0011.1000,1,3,-11.3137 +313,0b1.0011.1001,1,3,-11.8146 +314,0b1.0011.1010,1,3,-12.3377 +315,0b1.0011.1011,1,3,-12.8839 +316,0b1.0011.1100,1,3,-13.4543 +317,0b1.0011.1101,1,3,-14.05 +318,0b1.0011.1110,1,3,-14.6721 +319,0b1.0011.1111,1,3,-15.3217 +320,0b1.0100.0000,1,4,-16 +321,0b1.0100.0001,1,4,-16.7084 +322,0b1.0100.0010,1,4,-17.4481 +323,0b1.0100.0011,1,4,-18.2206 +324,0b1.0100.0100,1,4,-19.0273 +325,0b1.0100.0101,1,4,-19.8697 +326,0b1.0100.0110,1,4,-20.7494 +327,0b1.0100.0111,1,4,-21.6681 +328,0b1.0100.1000,1,4,-22.6274 +329,0b1.0100.1001,1,4,-23.6292 +330,0b1.0100.1010,1,4,-24.6754 +331,0b1.0100.1011,1,4,-25.7678 +332,0b1.0100.1100,1,4,-26.9087 +333,0b1.0100.1101,1,4,-28.1 +334,0b1.0100.1110,1,4,-29.3441 +335,0b1.0100.1111,1,4,-30.6433 +336,0b1.0101.0000,1,5,-32 +337,0b1.0101.0001,1,5,-33.4168 +338,0b1.0101.0010,1,5,-34.8962 +339,0b1.0101.0011,1,5,-36.4412 +340,0b1.0101.0100,1,5,-38.0546 +341,0b1.0101.0101,1,5,-39.7394 +342,0b1.0101.0110,1,5,-41.4989 +343,0b1.0101.0111,1,5,-43.3362 +344,0b1.0101.1000,1,5,-45.2548 +345,0b1.0101.1001,1,5,-47.2584 +346,0b1.0101.1010,1,5,-49.3507 +347,0b1.0101.1011,1,5,-51.5357 +348,0b1.0101.1100,1,5,-53.8174 +349,0b1.0101.1101,1,5,-56.2001 +350,0b1.0101.1110,1,5,-58.6883 +351,0b1.0101.1111,1,5,-61.2866 +352,0b1.0110.0000,1,6,-64 +353,0b1.0110.0001,1,6,-66.8335 +354,0b1.0110.0010,1,6,-69.7925 +355,0b1.0110.0011,1,6,-72.8825 +356,0b1.0110.0100,1,6,-76.1093 +357,0b1.0110.0101,1,6,-79.4789 +358,0b1.0110.0110,1,6,-82.9977 +359,0b1.0110.0111,1,6,-86.6724 +360,0b1.0110.1000,1,6,-90.5097 +361,0b1.0110.1001,1,6,-94.5169 +362,0b1.0110.1010,1,6,-98.7015 +363,0b1.0110.1011,1,6,-103.071 +364,0b1.0110.1100,1,6,-107.635 +365,0b1.0110.1101,1,6,-112.4 +366,0b1.0110.1110,1,6,-117.377 +367,0b1.0110.1111,1,6,-122.573 +368,0b1.0111.0000,1,7,-128 +369,0b1.0111.0001,1,7,-133.667 +370,0b1.0111.0010,1,7,-139.585 +371,0b1.0111.0011,1,7,-145.765 +372,0b1.0111.0100,1,7,-152.219 +373,0b1.0111.0101,1,7,-158.958 +374,0b1.0111.0110,1,7,-165.995 +375,0b1.0111.0111,1,7,-173.345 +376,0b1.0111.1000,1,7,-181.019 +377,0b1.0111.1001,1,7,-189.034 +378,0b1.0111.1010,1,7,-197.403 +379,0b1.0111.1011,1,7,-206.143 +380,0b1.0111.1100,1,7,-215.269 +381,0b1.0111.1101,1,7,-224.8 +382,0b1.0111.1110,1,7,-234.753 +383,0b1.0111.1111,1,7,-245.146 +384,0b1.1000.0000,1,-8,-nan(ind) +385,0b1.1000.0001,1,-8,-0.00407919 +386,0b1.1000.0010,1,-8,-0.0042598 +387,0b1.1000.0011,1,-8,-0.00444839 +388,0b1.1000.0100,1,-8,-0.00464534 +389,0b1.1000.0101,1,-8,-0.00485101 +390,0b1.1000.0110,1,-8,-0.00506578 +391,0b1.1000.0111,1,-8,-0.00529006 +392,0b1.1000.1000,1,-8,-0.00552427 +393,0b1.1000.1001,1,-8,-0.00576885 +394,0b1.1000.1010,1,-8,-0.00602426 +395,0b1.1000.1011,1,-8,-0.00629098 +396,0b1.1000.1100,1,-8,-0.0065695 +397,0b1.1000.1101,1,-8,-0.00686036 +398,0b1.1000.1110,1,-8,-0.00716409 +399,0b1.1000.1111,1,-8,-0.00748128 +400,0b1.1001.0000,1,-7,-0.0078125 +401,0b1.1001.0001,1,-7,-0.00815839 +402,0b1.1001.0010,1,-7,-0.00851959 +403,0b1.1001.0011,1,-7,-0.00889679 +404,0b1.1001.0100,1,-7,-0.00929068 +405,0b1.1001.0101,1,-7,-0.00970201 +406,0b1.1001.0110,1,-7,-0.0101316 +407,0b1.1001.0111,1,-7,-0.0105801 +408,0b1.1001.1000,1,-7,-0.0110485 +409,0b1.1001.1001,1,-7,-0.0115377 +410,0b1.1001.1010,1,-7,-0.0120485 +411,0b1.1001.1011,1,-7,-0.012582 +412,0b1.1001.1100,1,-7,-0.013139 +413,0b1.1001.1101,1,-7,-0.0137207 +414,0b1.1001.1110,1,-7,-0.0143282 +415,0b1.1001.1111,1,-7,-0.0149626 +416,0b1.1010.0000,1,-6,-0.015625 +417,0b1.1010.0001,1,-6,-0.0163168 +418,0b1.1010.0010,1,-6,-0.0170392 +419,0b1.1010.0011,1,-6,-0.0177936 +420,0b1.1010.0100,1,-6,-0.0185814 +421,0b1.1010.0101,1,-6,-0.019404 +422,0b1.1010.0110,1,-6,-0.0202631 +423,0b1.1010.0111,1,-6,-0.0211602 +424,0b1.1010.1000,1,-6,-0.0220971 +425,0b1.1010.1001,1,-6,-0.0230754 +426,0b1.1010.1010,1,-6,-0.024097 +427,0b1.1010.1011,1,-6,-0.0251639 +428,0b1.1010.1100,1,-6,-0.026278 +429,0b1.1010.1101,1,-6,-0.0274414 +430,0b1.1010.1110,1,-6,-0.0286564 +431,0b1.1010.1111,1,-6,-0.0299251 +432,0b1.1011.0000,1,-5,-0.03125 +433,0b1.1011.0001,1,-5,-0.0326336 +434,0b1.1011.0010,1,-5,-0.0340784 +435,0b1.1011.0011,1,-5,-0.0355871 +436,0b1.1011.0100,1,-5,-0.0371627 +437,0b1.1011.0101,1,-5,-0.0388081 +438,0b1.1011.0110,1,-5,-0.0405262 +439,0b1.1011.0111,1,-5,-0.0423205 +440,0b1.1011.1000,1,-5,-0.0441942 +441,0b1.1011.1001,1,-5,-0.0461508 +442,0b1.1011.1010,1,-5,-0.0481941 +443,0b1.1011.1011,1,-5,-0.0503278 +444,0b1.1011.1100,1,-5,-0.052556 +445,0b1.1011.1101,1,-5,-0.0548829 +446,0b1.1011.1110,1,-5,-0.0573128 +447,0b1.1011.1111,1,-5,-0.0598502 +448,0b1.1100.0000,1,-4,-0.0625 +449,0b1.1100.0001,1,-4,-0.0652671 +450,0b1.1100.0010,1,-4,-0.0681567 +451,0b1.1100.0011,1,-4,-0.0711743 +452,0b1.1100.0100,1,-4,-0.0743254 +453,0b1.1100.0101,1,-4,-0.0776161 +454,0b1.1100.0110,1,-4,-0.0810525 +455,0b1.1100.0111,1,-4,-0.084641 +456,0b1.1100.1000,1,-4,-0.0883883 +457,0b1.1100.1001,1,-4,-0.0923016 +458,0b1.1100.1010,1,-4,-0.0963882 +459,0b1.1100.1011,1,-4,-0.100656 +460,0b1.1100.1100,1,-4,-0.105112 +461,0b1.1100.1101,1,-4,-0.109766 +462,0b1.1100.1110,1,-4,-0.114626 +463,0b1.1100.1111,1,-4,-0.1197 +464,0b1.1101.0000,1,-3,-0.125 +465,0b1.1101.0001,1,-3,-0.130534 +466,0b1.1101.0010,1,-3,-0.136313 +467,0b1.1101.0011,1,-3,-0.142349 +468,0b1.1101.0100,1,-3,-0.148651 +469,0b1.1101.0101,1,-3,-0.155232 +470,0b1.1101.0110,1,-3,-0.162105 +471,0b1.1101.0111,1,-3,-0.169282 +472,0b1.1101.1000,1,-3,-0.176777 +473,0b1.1101.1001,1,-3,-0.184603 +474,0b1.1101.1010,1,-3,-0.192776 +475,0b1.1101.1011,1,-3,-0.201311 +476,0b1.1101.1100,1,-3,-0.210224 +477,0b1.1101.1101,1,-3,-0.219532 +478,0b1.1101.1110,1,-3,-0.229251 +479,0b1.1101.1111,1,-3,-0.239401 +480,0b1.1110.0000,1,-2,-0.25 +481,0b1.1110.0001,1,-2,-0.261068 +482,0b1.1110.0010,1,-2,-0.272627 +483,0b1.1110.0011,1,-2,-0.284697 +484,0b1.1110.0100,1,-2,-0.297302 +485,0b1.1110.0101,1,-2,-0.310464 +486,0b1.1110.0110,1,-2,-0.32421 +487,0b1.1110.0111,1,-2,-0.338564 +488,0b1.1110.1000,1,-2,-0.353553 +489,0b1.1110.1001,1,-2,-0.369207 +490,0b1.1110.1010,1,-2,-0.385553 +491,0b1.1110.1011,1,-2,-0.402623 +492,0b1.1110.1100,1,-2,-0.420448 +493,0b1.1110.1101,1,-2,-0.439063 +494,0b1.1110.1110,1,-2,-0.458502 +495,0b1.1110.1111,1,-2,-0.478802 +496,0b1.1111.0000,1,-1,-0.5 +497,0b1.1111.0001,1,-1,-0.522137 +498,0b1.1111.0010,1,-1,-0.545254 +499,0b1.1111.0011,1,-1,-0.569394 +500,0b1.1111.0100,1,-1,-0.594604 +501,0b1.1111.0101,1,-1,-0.620929 +502,0b1.1111.0110,1,-1,-0.64842 +503,0b1.1111.0111,1,-1,-0.677128 +504,0b1.1111.1000,1,-1,-0.707107 +505,0b1.1111.1001,1,-1,-0.738413 +506,0b1.1111.1010,1,-1,-0.771105 +507,0b1.1111.1011,1,-1,-0.805245 +508,0b1.1111.1100,1,-1,-0.840896 +509,0b1.1111.1101,1,-1,-0.878126 +510,0b1.1111.1110,1,-1,-0.917004 +511,0b1.1111.1111,1,-1,-0.957603 + +"Generate Value table for an LNS<9,6> in CSV format" +#, Binary, sign, scale, value +0,0b0.00.000000,0,0,1 +1,0b0.00.000001,0,0,1.01089 +2,0b0.00.000010,0,0,1.0219 +3,0b0.00.000011,0,0,1.03302 +4,0b0.00.000100,0,0,1.04427 +5,0b0.00.000101,0,0,1.05565 +6,0b0.00.000110,0,0,1.06714 +7,0b0.00.000111,0,0,1.07876 +8,0b0.00.001000,0,0,1.09051 +9,0b0.00.001001,0,0,1.10238 +10,0b0.00.001010,0,0,1.11439 +11,0b0.00.001011,0,0,1.12652 +12,0b0.00.001100,0,0,1.13879 +13,0b0.00.001101,0,0,1.15119 +14,0b0.00.001110,0,0,1.16372 +15,0b0.00.001111,0,0,1.1764 +16,0b0.00.010000,0,0,1.18921 +17,0b0.00.010001,0,0,1.20216 +18,0b0.00.010010,0,0,1.21525 +19,0b0.00.010011,0,0,1.22848 +20,0b0.00.010100,0,0,1.24186 +21,0b0.00.010101,0,0,1.25538 +22,0b0.00.010110,0,0,1.26905 +23,0b0.00.010111,0,0,1.28287 +24,0b0.00.011000,0,0,1.29684 +25,0b0.00.011001,0,0,1.31096 +26,0b0.00.011010,0,0,1.32524 +27,0b0.00.011011,0,0,1.33967 +28,0b0.00.011100,0,0,1.35426 +29,0b0.00.011101,0,0,1.369 +30,0b0.00.011110,0,0,1.38391 +31,0b0.00.011111,0,0,1.39898 +32,0b0.00.100000,0,0,1.41421 +33,0b0.00.100001,0,0,1.42961 +34,0b0.00.100010,0,0,1.44518 +35,0b0.00.100011,0,0,1.46092 +36,0b0.00.100100,0,0,1.47683 +37,0b0.00.100101,0,0,1.49291 +38,0b0.00.100110,0,0,1.50916 +39,0b0.00.100111,0,0,1.5256 +40,0b0.00.101000,0,0,1.54221 +41,0b0.00.101001,0,0,1.559 +42,0b0.00.101010,0,0,1.57598 +43,0b0.00.101011,0,0,1.59314 +44,0b0.00.101100,0,0,1.61049 +45,0b0.00.101101,0,0,1.62803 +46,0b0.00.101110,0,0,1.64576 +47,0b0.00.101111,0,0,1.66368 +48,0b0.00.110000,0,0,1.68179 +49,0b0.00.110001,0,0,1.70011 +50,0b0.00.110010,0,0,1.71862 +51,0b0.00.110011,0,0,1.73733 +52,0b0.00.110100,0,0,1.75625 +53,0b0.00.110101,0,0,1.77538 +54,0b0.00.110110,0,0,1.79471 +55,0b0.00.110111,0,0,1.81425 +56,0b0.00.111000,0,0,1.83401 +57,0b0.00.111001,0,0,1.85398 +58,0b0.00.111010,0,0,1.87417 +59,0b0.00.111011,0,0,1.89458 +60,0b0.00.111100,0,0,1.91521 +61,0b0.00.111101,0,0,1.93606 +62,0b0.00.111110,0,0,1.95714 +63,0b0.00.111111,0,0,1.97846 +64,0b0.01.000000,0,1,2 +65,0b0.01.000001,0,1,2.02178 +66,0b0.01.000010,0,1,2.04379 +67,0b0.01.000011,0,1,2.06605 +68,0b0.01.000100,0,1,2.08855 +69,0b0.01.000101,0,1,2.11129 +70,0b0.01.000110,0,1,2.13428 +71,0b0.01.000111,0,1,2.15752 +72,0b0.01.001000,0,1,2.18102 +73,0b0.01.001001,0,1,2.20477 +74,0b0.01.001010,0,1,2.22877 +75,0b0.01.001011,0,1,2.25304 +76,0b0.01.001100,0,1,2.27758 +77,0b0.01.001101,0,1,2.30238 +78,0b0.01.001110,0,1,2.32745 +79,0b0.01.001111,0,1,2.35279 +80,0b0.01.010000,0,1,2.37841 +81,0b0.01.010001,0,1,2.40431 +82,0b0.01.010010,0,1,2.43049 +83,0b0.01.010011,0,1,2.45696 +84,0b0.01.010100,0,1,2.48372 +85,0b0.01.010101,0,1,2.51076 +86,0b0.01.010110,0,1,2.5381 +87,0b0.01.010111,0,1,2.56574 +88,0b0.01.011000,0,1,2.59368 +89,0b0.01.011001,0,1,2.62192 +90,0b0.01.011010,0,1,2.65047 +91,0b0.01.011011,0,1,2.67934 +92,0b0.01.011100,0,1,2.70851 +93,0b0.01.011101,0,1,2.738 +94,0b0.01.011110,0,1,2.76782 +95,0b0.01.011111,0,1,2.79796 +96,0b0.01.100000,0,1,2.82843 +97,0b0.01.100001,0,1,2.85923 +98,0b0.01.100010,0,1,2.89036 +99,0b0.01.100011,0,1,2.92184 +100,0b0.01.100100,0,1,2.95365 +101,0b0.01.100101,0,1,2.98582 +102,0b0.01.100110,0,1,3.01833 +103,0b0.01.100111,0,1,3.0512 +104,0b0.01.101000,0,1,3.08442 +105,0b0.01.101001,0,1,3.11801 +106,0b0.01.101010,0,1,3.15196 +107,0b0.01.101011,0,1,3.18628 +108,0b0.01.101100,0,1,3.22098 +109,0b0.01.101101,0,1,3.25605 +110,0b0.01.101110,0,1,3.29151 +111,0b0.01.101111,0,1,3.32735 +112,0b0.01.110000,0,1,3.36359 +113,0b0.01.110001,0,1,3.40021 +114,0b0.01.110010,0,1,3.43724 +115,0b0.01.110011,0,1,3.47467 +116,0b0.01.110100,0,1,3.5125 +117,0b0.01.110101,0,1,3.55075 +118,0b0.01.110110,0,1,3.58942 +119,0b0.01.110111,0,1,3.6285 +120,0b0.01.111000,0,1,3.66802 +121,0b0.01.111001,0,1,3.70796 +122,0b0.01.111010,0,1,3.74834 +123,0b0.01.111011,0,1,3.78915 +124,0b0.01.111100,0,1,3.83041 +125,0b0.01.111101,0,1,3.87212 +126,0b0.01.111110,0,1,3.91429 +127,0b0.01.111111,0,1,3.95691 +128,0b0.10.000000,0,-2,0 +129,0b0.10.000001,0,-2,0.252722 +130,0b0.10.000010,0,-2,0.255474 +131,0b0.10.000011,0,-2,0.258256 +132,0b0.10.000100,0,-2,0.261068 +133,0b0.10.000101,0,-2,0.263911 +134,0b0.10.000110,0,-2,0.266785 +135,0b0.10.000111,0,-2,0.26969 +136,0b0.10.001000,0,-2,0.272627 +137,0b0.10.001001,0,-2,0.275596 +138,0b0.10.001010,0,-2,0.278597 +139,0b0.10.001011,0,-2,0.28163 +140,0b0.10.001100,0,-2,0.284697 +141,0b0.10.001101,0,-2,0.287797 +142,0b0.10.001110,0,-2,0.290931 +143,0b0.10.001111,0,-2,0.294099 +144,0b0.10.010000,0,-2,0.297302 +145,0b0.10.010001,0,-2,0.300539 +146,0b0.10.010010,0,-2,0.303812 +147,0b0.10.010011,0,-2,0.30712 +148,0b0.10.010100,0,-2,0.310464 +149,0b0.10.010101,0,-2,0.313845 +150,0b0.10.010110,0,-2,0.317263 +151,0b0.10.010111,0,-2,0.320718 +152,0b0.10.011000,0,-2,0.32421 +153,0b0.10.011001,0,-2,0.32774 +154,0b0.10.011010,0,-2,0.331309 +155,0b0.10.011011,0,-2,0.334917 +156,0b0.10.011100,0,-2,0.338564 +157,0b0.10.011101,0,-2,0.342251 +158,0b0.10.011110,0,-2,0.345977 +159,0b0.10.011111,0,-2,0.349745 +160,0b0.10.100000,0,-2,0.353553 +161,0b0.10.100001,0,-2,0.357403 +162,0b0.10.100010,0,-2,0.361295 +163,0b0.10.100011,0,-2,0.365229 +164,0b0.10.100100,0,-2,0.369207 +165,0b0.10.100101,0,-2,0.373227 +166,0b0.10.100110,0,-2,0.377291 +167,0b0.10.100111,0,-2,0.3814 +168,0b0.10.101000,0,-2,0.385553 +169,0b0.10.101001,0,-2,0.389751 +170,0b0.10.101010,0,-2,0.393995 +171,0b0.10.101011,0,-2,0.398286 +172,0b0.10.101100,0,-2,0.402623 +173,0b0.10.101101,0,-2,0.407007 +174,0b0.10.101110,0,-2,0.411439 +175,0b0.10.101111,0,-2,0.415919 +176,0b0.10.110000,0,-2,0.420448 +177,0b0.10.110001,0,-2,0.425027 +178,0b0.10.110010,0,-2,0.429655 +179,0b0.10.110011,0,-2,0.434333 +180,0b0.10.110100,0,-2,0.439063 +181,0b0.10.110101,0,-2,0.443844 +182,0b0.10.110110,0,-2,0.448677 +183,0b0.10.110111,0,-2,0.453563 +184,0b0.10.111000,0,-2,0.458502 +185,0b0.10.111001,0,-2,0.463495 +186,0b0.10.111010,0,-2,0.468542 +187,0b0.10.111011,0,-2,0.473644 +188,0b0.10.111100,0,-2,0.478802 +189,0b0.10.111101,0,-2,0.484015 +190,0b0.10.111110,0,-2,0.489286 +191,0b0.10.111111,0,-2,0.494614 +192,0b0.11.000000,0,-1,0.5 +193,0b0.11.000001,0,-1,0.505445 +194,0b0.11.000010,0,-1,0.510949 +195,0b0.11.000011,0,-1,0.516512 +196,0b0.11.000100,0,-1,0.522137 +197,0b0.11.000101,0,-1,0.527823 +198,0b0.11.000110,0,-1,0.53357 +199,0b0.11.000111,0,-1,0.53938 +200,0b0.11.001000,0,-1,0.545254 +201,0b0.11.001001,0,-1,0.551191 +202,0b0.11.001010,0,-1,0.557193 +203,0b0.11.001011,0,-1,0.563261 +204,0b0.11.001100,0,-1,0.569394 +205,0b0.11.001101,0,-1,0.575595 +206,0b0.11.001110,0,-1,0.581862 +207,0b0.11.001111,0,-1,0.588198 +208,0b0.11.010000,0,-1,0.594604 +209,0b0.11.010001,0,-1,0.601078 +210,0b0.11.010010,0,-1,0.607624 +211,0b0.11.010011,0,-1,0.61424 +212,0b0.11.010100,0,-1,0.620929 +213,0b0.11.010101,0,-1,0.62769 +214,0b0.11.010110,0,-1,0.634525 +215,0b0.11.010111,0,-1,0.641435 +216,0b0.11.011000,0,-1,0.64842 +217,0b0.11.011001,0,-1,0.655481 +218,0b0.11.011010,0,-1,0.662618 +219,0b0.11.011011,0,-1,0.669834 +220,0b0.11.011100,0,-1,0.677128 +221,0b0.11.011101,0,-1,0.684501 +222,0b0.11.011110,0,-1,0.691955 +223,0b0.11.011111,0,-1,0.69949 +224,0b0.11.100000,0,-1,0.707107 +225,0b0.11.100001,0,-1,0.714807 +226,0b0.11.100010,0,-1,0.72259 +227,0b0.11.100011,0,-1,0.730459 +228,0b0.11.100100,0,-1,0.738413 +229,0b0.11.100101,0,-1,0.746454 +230,0b0.11.100110,0,-1,0.754582 +231,0b0.11.100111,0,-1,0.762799 +232,0b0.11.101000,0,-1,0.771105 +233,0b0.11.101001,0,-1,0.779502 +234,0b0.11.101010,0,-1,0.78799 +235,0b0.11.101011,0,-1,0.796571 +236,0b0.11.101100,0,-1,0.805245 +237,0b0.11.101101,0,-1,0.814014 +238,0b0.11.101110,0,-1,0.822878 +239,0b0.11.101111,0,-1,0.831838 +240,0b0.11.110000,0,-1,0.840896 +241,0b0.11.110001,0,-1,0.850053 +242,0b0.11.110010,0,-1,0.85931 +243,0b0.11.110011,0,-1,0.868667 +244,0b0.11.110100,0,-1,0.878126 +245,0b0.11.110101,0,-1,0.887688 +246,0b0.11.110110,0,-1,0.897355 +247,0b0.11.110111,0,-1,0.907126 +248,0b0.11.111000,0,-1,0.917004 +249,0b0.11.111001,0,-1,0.92699 +250,0b0.11.111010,0,-1,0.937084 +251,0b0.11.111011,0,-1,0.947288 +252,0b0.11.111100,0,-1,0.957603 +253,0b0.11.111101,0,-1,0.968031 +254,0b0.11.111110,0,-1,0.978572 +255,0b0.11.111111,0,-1,0.989228 +256,0b1.00.000000,1,0,-1 +257,0b1.00.000001,1,0,-1.01089 +258,0b1.00.000010,1,0,-1.0219 +259,0b1.00.000011,1,0,-1.03302 +260,0b1.00.000100,1,0,-1.04427 +261,0b1.00.000101,1,0,-1.05565 +262,0b1.00.000110,1,0,-1.06714 +263,0b1.00.000111,1,0,-1.07876 +264,0b1.00.001000,1,0,-1.09051 +265,0b1.00.001001,1,0,-1.10238 +266,0b1.00.001010,1,0,-1.11439 +267,0b1.00.001011,1,0,-1.12652 +268,0b1.00.001100,1,0,-1.13879 +269,0b1.00.001101,1,0,-1.15119 +270,0b1.00.001110,1,0,-1.16372 +271,0b1.00.001111,1,0,-1.1764 +272,0b1.00.010000,1,0,-1.18921 +273,0b1.00.010001,1,0,-1.20216 +274,0b1.00.010010,1,0,-1.21525 +275,0b1.00.010011,1,0,-1.22848 +276,0b1.00.010100,1,0,-1.24186 +277,0b1.00.010101,1,0,-1.25538 +278,0b1.00.010110,1,0,-1.26905 +279,0b1.00.010111,1,0,-1.28287 +280,0b1.00.011000,1,0,-1.29684 +281,0b1.00.011001,1,0,-1.31096 +282,0b1.00.011010,1,0,-1.32524 +283,0b1.00.011011,1,0,-1.33967 +284,0b1.00.011100,1,0,-1.35426 +285,0b1.00.011101,1,0,-1.369 +286,0b1.00.011110,1,0,-1.38391 +287,0b1.00.011111,1,0,-1.39898 +288,0b1.00.100000,1,0,-1.41421 +289,0b1.00.100001,1,0,-1.42961 +290,0b1.00.100010,1,0,-1.44518 +291,0b1.00.100011,1,0,-1.46092 +292,0b1.00.100100,1,0,-1.47683 +293,0b1.00.100101,1,0,-1.49291 +294,0b1.00.100110,1,0,-1.50916 +295,0b1.00.100111,1,0,-1.5256 +296,0b1.00.101000,1,0,-1.54221 +297,0b1.00.101001,1,0,-1.559 +298,0b1.00.101010,1,0,-1.57598 +299,0b1.00.101011,1,0,-1.59314 +300,0b1.00.101100,1,0,-1.61049 +301,0b1.00.101101,1,0,-1.62803 +302,0b1.00.101110,1,0,-1.64576 +303,0b1.00.101111,1,0,-1.66368 +304,0b1.00.110000,1,0,-1.68179 +305,0b1.00.110001,1,0,-1.70011 +306,0b1.00.110010,1,0,-1.71862 +307,0b1.00.110011,1,0,-1.73733 +308,0b1.00.110100,1,0,-1.75625 +309,0b1.00.110101,1,0,-1.77538 +310,0b1.00.110110,1,0,-1.79471 +311,0b1.00.110111,1,0,-1.81425 +312,0b1.00.111000,1,0,-1.83401 +313,0b1.00.111001,1,0,-1.85398 +314,0b1.00.111010,1,0,-1.87417 +315,0b1.00.111011,1,0,-1.89458 +316,0b1.00.111100,1,0,-1.91521 +317,0b1.00.111101,1,0,-1.93606 +318,0b1.00.111110,1,0,-1.95714 +319,0b1.00.111111,1,0,-1.97846 +320,0b1.01.000000,1,1,-2 +321,0b1.01.000001,1,1,-2.02178 +322,0b1.01.000010,1,1,-2.04379 +323,0b1.01.000011,1,1,-2.06605 +324,0b1.01.000100,1,1,-2.08855 +325,0b1.01.000101,1,1,-2.11129 +326,0b1.01.000110,1,1,-2.13428 +327,0b1.01.000111,1,1,-2.15752 +328,0b1.01.001000,1,1,-2.18102 +329,0b1.01.001001,1,1,-2.20477 +330,0b1.01.001010,1,1,-2.22877 +331,0b1.01.001011,1,1,-2.25304 +332,0b1.01.001100,1,1,-2.27758 +333,0b1.01.001101,1,1,-2.30238 +334,0b1.01.001110,1,1,-2.32745 +335,0b1.01.001111,1,1,-2.35279 +336,0b1.01.010000,1,1,-2.37841 +337,0b1.01.010001,1,1,-2.40431 +338,0b1.01.010010,1,1,-2.43049 +339,0b1.01.010011,1,1,-2.45696 +340,0b1.01.010100,1,1,-2.48372 +341,0b1.01.010101,1,1,-2.51076 +342,0b1.01.010110,1,1,-2.5381 +343,0b1.01.010111,1,1,-2.56574 +344,0b1.01.011000,1,1,-2.59368 +345,0b1.01.011001,1,1,-2.62192 +346,0b1.01.011010,1,1,-2.65047 +347,0b1.01.011011,1,1,-2.67934 +348,0b1.01.011100,1,1,-2.70851 +349,0b1.01.011101,1,1,-2.738 +350,0b1.01.011110,1,1,-2.76782 +351,0b1.01.011111,1,1,-2.79796 +352,0b1.01.100000,1,1,-2.82843 +353,0b1.01.100001,1,1,-2.85923 +354,0b1.01.100010,1,1,-2.89036 +355,0b1.01.100011,1,1,-2.92184 +356,0b1.01.100100,1,1,-2.95365 +357,0b1.01.100101,1,1,-2.98582 +358,0b1.01.100110,1,1,-3.01833 +359,0b1.01.100111,1,1,-3.0512 +360,0b1.01.101000,1,1,-3.08442 +361,0b1.01.101001,1,1,-3.11801 +362,0b1.01.101010,1,1,-3.15196 +363,0b1.01.101011,1,1,-3.18628 +364,0b1.01.101100,1,1,-3.22098 +365,0b1.01.101101,1,1,-3.25605 +366,0b1.01.101110,1,1,-3.29151 +367,0b1.01.101111,1,1,-3.32735 +368,0b1.01.110000,1,1,-3.36359 +369,0b1.01.110001,1,1,-3.40021 +370,0b1.01.110010,1,1,-3.43724 +371,0b1.01.110011,1,1,-3.47467 +372,0b1.01.110100,1,1,-3.5125 +373,0b1.01.110101,1,1,-3.55075 +374,0b1.01.110110,1,1,-3.58942 +375,0b1.01.110111,1,1,-3.6285 +376,0b1.01.111000,1,1,-3.66802 +377,0b1.01.111001,1,1,-3.70796 +378,0b1.01.111010,1,1,-3.74834 +379,0b1.01.111011,1,1,-3.78915 +380,0b1.01.111100,1,1,-3.83041 +381,0b1.01.111101,1,1,-3.87212 +382,0b1.01.111110,1,1,-3.91429 +383,0b1.01.111111,1,1,-3.95691 +384,0b1.10.000000,1,-2,-nan(ind) +385,0b1.10.000001,1,-2,-0.252722 +386,0b1.10.000010,1,-2,-0.255474 +387,0b1.10.000011,1,-2,-0.258256 +388,0b1.10.000100,1,-2,-0.261068 +389,0b1.10.000101,1,-2,-0.263911 +390,0b1.10.000110,1,-2,-0.266785 +391,0b1.10.000111,1,-2,-0.26969 +392,0b1.10.001000,1,-2,-0.272627 +393,0b1.10.001001,1,-2,-0.275596 +394,0b1.10.001010,1,-2,-0.278597 +395,0b1.10.001011,1,-2,-0.28163 +396,0b1.10.001100,1,-2,-0.284697 +397,0b1.10.001101,1,-2,-0.287797 +398,0b1.10.001110,1,-2,-0.290931 +399,0b1.10.001111,1,-2,-0.294099 +400,0b1.10.010000,1,-2,-0.297302 +401,0b1.10.010001,1,-2,-0.300539 +402,0b1.10.010010,1,-2,-0.303812 +403,0b1.10.010011,1,-2,-0.30712 +404,0b1.10.010100,1,-2,-0.310464 +405,0b1.10.010101,1,-2,-0.313845 +406,0b1.10.010110,1,-2,-0.317263 +407,0b1.10.010111,1,-2,-0.320718 +408,0b1.10.011000,1,-2,-0.32421 +409,0b1.10.011001,1,-2,-0.32774 +410,0b1.10.011010,1,-2,-0.331309 +411,0b1.10.011011,1,-2,-0.334917 +412,0b1.10.011100,1,-2,-0.338564 +413,0b1.10.011101,1,-2,-0.342251 +414,0b1.10.011110,1,-2,-0.345977 +415,0b1.10.011111,1,-2,-0.349745 +416,0b1.10.100000,1,-2,-0.353553 +417,0b1.10.100001,1,-2,-0.357403 +418,0b1.10.100010,1,-2,-0.361295 +419,0b1.10.100011,1,-2,-0.365229 +420,0b1.10.100100,1,-2,-0.369207 +421,0b1.10.100101,1,-2,-0.373227 +422,0b1.10.100110,1,-2,-0.377291 +423,0b1.10.100111,1,-2,-0.3814 +424,0b1.10.101000,1,-2,-0.385553 +425,0b1.10.101001,1,-2,-0.389751 +426,0b1.10.101010,1,-2,-0.393995 +427,0b1.10.101011,1,-2,-0.398286 +428,0b1.10.101100,1,-2,-0.402623 +429,0b1.10.101101,1,-2,-0.407007 +430,0b1.10.101110,1,-2,-0.411439 +431,0b1.10.101111,1,-2,-0.415919 +432,0b1.10.110000,1,-2,-0.420448 +433,0b1.10.110001,1,-2,-0.425027 +434,0b1.10.110010,1,-2,-0.429655 +435,0b1.10.110011,1,-2,-0.434333 +436,0b1.10.110100,1,-2,-0.439063 +437,0b1.10.110101,1,-2,-0.443844 +438,0b1.10.110110,1,-2,-0.448677 +439,0b1.10.110111,1,-2,-0.453563 +440,0b1.10.111000,1,-2,-0.458502 +441,0b1.10.111001,1,-2,-0.463495 +442,0b1.10.111010,1,-2,-0.468542 +443,0b1.10.111011,1,-2,-0.473644 +444,0b1.10.111100,1,-2,-0.478802 +445,0b1.10.111101,1,-2,-0.484015 +446,0b1.10.111110,1,-2,-0.489286 +447,0b1.10.111111,1,-2,-0.494614 +448,0b1.11.000000,1,-1,-0.5 +449,0b1.11.000001,1,-1,-0.505445 +450,0b1.11.000010,1,-1,-0.510949 +451,0b1.11.000011,1,-1,-0.516512 +452,0b1.11.000100,1,-1,-0.522137 +453,0b1.11.000101,1,-1,-0.527823 +454,0b1.11.000110,1,-1,-0.53357 +455,0b1.11.000111,1,-1,-0.53938 +456,0b1.11.001000,1,-1,-0.545254 +457,0b1.11.001001,1,-1,-0.551191 +458,0b1.11.001010,1,-1,-0.557193 +459,0b1.11.001011,1,-1,-0.563261 +460,0b1.11.001100,1,-1,-0.569394 +461,0b1.11.001101,1,-1,-0.575595 +462,0b1.11.001110,1,-1,-0.581862 +463,0b1.11.001111,1,-1,-0.588198 +464,0b1.11.010000,1,-1,-0.594604 +465,0b1.11.010001,1,-1,-0.601078 +466,0b1.11.010010,1,-1,-0.607624 +467,0b1.11.010011,1,-1,-0.61424 +468,0b1.11.010100,1,-1,-0.620929 +469,0b1.11.010101,1,-1,-0.62769 +470,0b1.11.010110,1,-1,-0.634525 +471,0b1.11.010111,1,-1,-0.641435 +472,0b1.11.011000,1,-1,-0.64842 +473,0b1.11.011001,1,-1,-0.655481 +474,0b1.11.011010,1,-1,-0.662618 +475,0b1.11.011011,1,-1,-0.669834 +476,0b1.11.011100,1,-1,-0.677128 +477,0b1.11.011101,1,-1,-0.684501 +478,0b1.11.011110,1,-1,-0.691955 +479,0b1.11.011111,1,-1,-0.69949 +480,0b1.11.100000,1,-1,-0.707107 +481,0b1.11.100001,1,-1,-0.714807 +482,0b1.11.100010,1,-1,-0.72259 +483,0b1.11.100011,1,-1,-0.730459 +484,0b1.11.100100,1,-1,-0.738413 +485,0b1.11.100101,1,-1,-0.746454 +486,0b1.11.100110,1,-1,-0.754582 +487,0b1.11.100111,1,-1,-0.762799 +488,0b1.11.101000,1,-1,-0.771105 +489,0b1.11.101001,1,-1,-0.779502 +490,0b1.11.101010,1,-1,-0.78799 +491,0b1.11.101011,1,-1,-0.796571 +492,0b1.11.101100,1,-1,-0.805245 +493,0b1.11.101101,1,-1,-0.814014 +494,0b1.11.101110,1,-1,-0.822878 +495,0b1.11.101111,1,-1,-0.831838 +496,0b1.11.110000,1,-1,-0.840896 +497,0b1.11.110001,1,-1,-0.850053 +498,0b1.11.110010,1,-1,-0.85931 +499,0b1.11.110011,1,-1,-0.868667 +500,0b1.11.110100,1,-1,-0.878126 +501,0b1.11.110101,1,-1,-0.887688 +502,0b1.11.110110,1,-1,-0.897355 +503,0b1.11.110111,1,-1,-0.907126 +504,0b1.11.111000,1,-1,-0.917004 +505,0b1.11.111001,1,-1,-0.92699 +506,0b1.11.111010,1,-1,-0.937084 +507,0b1.11.111011,1,-1,-0.947288 +508,0b1.11.111100,1,-1,-0.957603 +509,0b1.11.111101,1,-1,-0.968031 +510,0b1.11.111110,1,-1,-0.978572 +511,0b1.11.111111,1,-1,-0.989228 + diff --git a/docs/tables/lns.txt b/docs/tables/lns.txt new file mode 100644 index 000000000..0219fdb09 --- /dev/null +++ b/docs/tables/lns.txt @@ -0,0 +1,4244 @@ +Generate Value table for an LNS<4,0> in TXT format + # Binary sign scale value format + 0: 0b0.000 0 0 1 1 + 1: 0b0.001 0 1 2 2 + 2: 0b0.010 0 2 4 4 + 3: 0b0.011 0 3 8 8 + 4: 0b0.100 0 -4 0 0 + 5: 0b0.101 0 -3 0.125 0.125 + 6: 0b0.110 0 -2 0.25 0.25 + 7: 0b0.111 0 -1 0.5 0.5 + 8: 0b1.000 1 0 -1 -1 + 9: 0b1.001 1 1 -2 -2 + 10: 0b1.010 1 2 -4 -4 + 11: 0b1.011 1 3 -8 -8 + 12: 0b1.100 1 -4 -nan(ind) -nan(ind) + 13: 0b1.101 1 -3 -0.125 -0.125 + 14: 0b1.110 1 -2 -0.25 -0.25 + 15: 0b1.111 1 -1 -0.5 -0.5 +Generate Value table for an LNS<4,1> in TXT format + # Binary sign scale value format + 0: 0b0.00.0 0 0 1 1 + 1: 0b0.00.1 0 0 1.41421 1.41421 + 2: 0b0.01.0 0 1 2 2 + 3: 0b0.01.1 0 1 2.82843 2.82843 + 4: 0b0.10.0 0 -2 0 0 + 5: 0b0.10.1 0 -2 0.353553 0.353553 + 6: 0b0.11.0 0 -1 0.5 0.5 + 7: 0b0.11.1 0 -1 0.707107 0.707107 + 8: 0b1.00.0 1 0 -1 -1 + 9: 0b1.00.1 1 0 -1.41421 -1.41421 + 10: 0b1.01.0 1 1 -2 -2 + 11: 0b1.01.1 1 1 -2.82843 -2.82843 + 12: 0b1.10.0 1 -2 -nan(ind) -nan(ind) + 13: 0b1.10.1 1 -2 -0.353553 -0.353553 + 14: 0b1.11.0 1 -1 -0.5 -0.5 + 15: 0b1.11.1 1 -1 -0.707107 -0.707107 +Generate Value table for an LNS<4,2> in TXT format + # Binary sign scale value format + 0: 0b0.0.00 0 0 1 1 + 1: 0b0.0.01 0 0 1.18921 1.18921 + 2: 0b0.0.10 0 0 1.41421 1.41421 + 3: 0b0.0.11 0 0 1.68179 1.68179 + 4: 0b0.1.00 0 -1 0 0 + 5: 0b0.1.01 0 -1 0.594604 0.594604 + 6: 0b0.1.10 0 -1 0.707107 0.707107 + 7: 0b0.1.11 0 -1 0.840896 0.840896 + 8: 0b1.0.00 1 0 -1 -1 + 9: 0b1.0.01 1 0 -1.18921 -1.18921 + 10: 0b1.0.10 1 0 -1.41421 -1.41421 + 11: 0b1.0.11 1 0 -1.68179 -1.68179 + 12: 0b1.1.00 1 -1 -nan(ind) -nan(ind) + 13: 0b1.1.01 1 -1 -0.594604 -0.594604 + 14: 0b1.1.10 1 -1 -0.707107 -0.707107 + 15: 0b1.1.11 1 -1 -0.840896 -0.840896 +Generate Value table for an LNS<4,3> in TXT format + # Binary sign scale value format + 0: 0b0..000 0 0 1 1 + 1: 0b0..001 0 0 1.09051 1.09051 + 2: 0b0..010 0 0 1.18921 1.18921 + 3: 0b0..011 0 0 1.29684 1.29684 + 4: 0b0..100 0 0 0 0 + 5: 0b0..101 0 0 0.771105 0.771105 + 6: 0b0..110 0 0 0.840896 0.840896 + 7: 0b0..111 0 0 0.917004 0.917004 + 8: 0b1..000 1 0 -1 -1 + 9: 0b1..001 1 0 -1.09051 -1.09051 + 10: 0b1..010 1 0 -1.18921 -1.18921 + 11: 0b1..011 1 0 -1.29684 -1.29684 + 12: 0b1..100 1 0 -nan(ind) -nan(ind) + 13: 0b1..101 1 0 -0.771105 -0.771105 + 14: 0b1..110 1 0 -0.840896 -0.840896 + 15: 0b1..111 1 0 -0.917004 -0.917004 +Generate Value table for an LNS<5,0> in TXT format + # Binary sign scale value format + 0: 0b0.0000 0 0 1 1 + 1: 0b0.0001 0 1 2 2 + 2: 0b0.0010 0 2 4 4 + 3: 0b0.0011 0 3 8 8 + 4: 0b0.0100 0 4 16 16 + 5: 0b0.0101 0 5 32 32 + 6: 0b0.0110 0 6 64 64 + 7: 0b0.0111 0 7 128 128 + 8: 0b0.1000 0 -8 0 0 + 9: 0b0.1001 0 -7 0.0078125 0.0078125 + 10: 0b0.1010 0 -6 0.015625 0.015625 + 11: 0b0.1011 0 -5 0.03125 0.03125 + 12: 0b0.1100 0 -4 0.0625 0.0625 + 13: 0b0.1101 0 -3 0.125 0.125 + 14: 0b0.1110 0 -2 0.25 0.25 + 15: 0b0.1111 0 -1 0.5 0.5 + 16: 0b1.0000 1 0 -1 -1 + 17: 0b1.0001 1 1 -2 -2 + 18: 0b1.0010 1 2 -4 -4 + 19: 0b1.0011 1 3 -8 -8 + 20: 0b1.0100 1 4 -16 -16 + 21: 0b1.0101 1 5 -32 -32 + 22: 0b1.0110 1 6 -64 -64 + 23: 0b1.0111 1 7 -128 -128 + 24: 0b1.1000 1 -8 -nan(ind) -nan(ind) + 25: 0b1.1001 1 -7 -0.0078125 -0.0078125 + 26: 0b1.1010 1 -6 -0.015625 -0.015625 + 27: 0b1.1011 1 -5 -0.03125 -0.03125 + 28: 0b1.1100 1 -4 -0.0625 -0.0625 + 29: 0b1.1101 1 -3 -0.125 -0.125 + 30: 0b1.1110 1 -2 -0.25 -0.25 + 31: 0b1.1111 1 -1 -0.5 -0.5 +Generate Value table for an LNS<5,1> in TXT format + # Binary sign scale value format + 0: 0b0.000.0 0 0 1 1 + 1: 0b0.000.1 0 0 1.41421 1.41421 + 2: 0b0.001.0 0 1 2 2 + 3: 0b0.001.1 0 1 2.82843 2.82843 + 4: 0b0.010.0 0 2 4 4 + 5: 0b0.010.1 0 2 5.65685 5.65685 + 6: 0b0.011.0 0 3 8 8 + 7: 0b0.011.1 0 3 11.3137 11.3137 + 8: 0b0.100.0 0 -4 0 0 + 9: 0b0.100.1 0 -4 0.0883883 0.0883883 + 10: 0b0.101.0 0 -3 0.125 0.125 + 11: 0b0.101.1 0 -3 0.176777 0.176777 + 12: 0b0.110.0 0 -2 0.25 0.25 + 13: 0b0.110.1 0 -2 0.353553 0.353553 + 14: 0b0.111.0 0 -1 0.5 0.5 + 15: 0b0.111.1 0 -1 0.707107 0.707107 + 16: 0b1.000.0 1 0 -1 -1 + 17: 0b1.000.1 1 0 -1.41421 -1.41421 + 18: 0b1.001.0 1 1 -2 -2 + 19: 0b1.001.1 1 1 -2.82843 -2.82843 + 20: 0b1.010.0 1 2 -4 -4 + 21: 0b1.010.1 1 2 -5.65685 -5.65685 + 22: 0b1.011.0 1 3 -8 -8 + 23: 0b1.011.1 1 3 -11.3137 -11.3137 + 24: 0b1.100.0 1 -4 -nan(ind) -nan(ind) + 25: 0b1.100.1 1 -4 -0.0883883 -0.0883883 + 26: 0b1.101.0 1 -3 -0.125 -0.125 + 27: 0b1.101.1 1 -3 -0.176777 -0.176777 + 28: 0b1.110.0 1 -2 -0.25 -0.25 + 29: 0b1.110.1 1 -2 -0.353553 -0.353553 + 30: 0b1.111.0 1 -1 -0.5 -0.5 + 31: 0b1.111.1 1 -1 -0.707107 -0.707107 +Generate Value table for an LNS<5,2> in TXT format + # Binary sign scale value format + 0: 0b0.00.00 0 0 1 1 + 1: 0b0.00.01 0 0 1.18921 1.18921 + 2: 0b0.00.10 0 0 1.41421 1.41421 + 3: 0b0.00.11 0 0 1.68179 1.68179 + 4: 0b0.01.00 0 1 2 2 + 5: 0b0.01.01 0 1 2.37841 2.37841 + 6: 0b0.01.10 0 1 2.82843 2.82843 + 7: 0b0.01.11 0 1 3.36359 3.36359 + 8: 0b0.10.00 0 -2 0 0 + 9: 0b0.10.01 0 -2 0.297302 0.297302 + 10: 0b0.10.10 0 -2 0.353553 0.353553 + 11: 0b0.10.11 0 -2 0.420448 0.420448 + 12: 0b0.11.00 0 -1 0.5 0.5 + 13: 0b0.11.01 0 -1 0.594604 0.594604 + 14: 0b0.11.10 0 -1 0.707107 0.707107 + 15: 0b0.11.11 0 -1 0.840896 0.840896 + 16: 0b1.00.00 1 0 -1 -1 + 17: 0b1.00.01 1 0 -1.18921 -1.18921 + 18: 0b1.00.10 1 0 -1.41421 -1.41421 + 19: 0b1.00.11 1 0 -1.68179 -1.68179 + 20: 0b1.01.00 1 1 -2 -2 + 21: 0b1.01.01 1 1 -2.37841 -2.37841 + 22: 0b1.01.10 1 1 -2.82843 -2.82843 + 23: 0b1.01.11 1 1 -3.36359 -3.36359 + 24: 0b1.10.00 1 -2 -nan(ind) -nan(ind) + 25: 0b1.10.01 1 -2 -0.297302 -0.297302 + 26: 0b1.10.10 1 -2 -0.353553 -0.353553 + 27: 0b1.10.11 1 -2 -0.420448 -0.420448 + 28: 0b1.11.00 1 -1 -0.5 -0.5 + 29: 0b1.11.01 1 -1 -0.594604 -0.594604 + 30: 0b1.11.10 1 -1 -0.707107 -0.707107 + 31: 0b1.11.11 1 -1 -0.840896 -0.840896 +Generate Value table for an LNS<5,3> in TXT format + # Binary sign scale value format + 0: 0b0.0.000 0 0 1 1 + 1: 0b0.0.001 0 0 1.09051 1.09051 + 2: 0b0.0.010 0 0 1.18921 1.18921 + 3: 0b0.0.011 0 0 1.29684 1.29684 + 4: 0b0.0.100 0 0 1.41421 1.41421 + 5: 0b0.0.101 0 0 1.54221 1.54221 + 6: 0b0.0.110 0 0 1.68179 1.68179 + 7: 0b0.0.111 0 0 1.83401 1.83401 + 8: 0b0.1.000 0 -1 0 0 + 9: 0b0.1.001 0 -1 0.545254 0.545254 + 10: 0b0.1.010 0 -1 0.594604 0.594604 + 11: 0b0.1.011 0 -1 0.64842 0.64842 + 12: 0b0.1.100 0 -1 0.707107 0.707107 + 13: 0b0.1.101 0 -1 0.771105 0.771105 + 14: 0b0.1.110 0 -1 0.840896 0.840896 + 15: 0b0.1.111 0 -1 0.917004 0.917004 + 16: 0b1.0.000 1 0 -1 -1 + 17: 0b1.0.001 1 0 -1.09051 -1.09051 + 18: 0b1.0.010 1 0 -1.18921 -1.18921 + 19: 0b1.0.011 1 0 -1.29684 -1.29684 + 20: 0b1.0.100 1 0 -1.41421 -1.41421 + 21: 0b1.0.101 1 0 -1.54221 -1.54221 + 22: 0b1.0.110 1 0 -1.68179 -1.68179 + 23: 0b1.0.111 1 0 -1.83401 -1.83401 + 24: 0b1.1.000 1 -1 -nan(ind) -nan(ind) + 25: 0b1.1.001 1 -1 -0.545254 -0.545254 + 26: 0b1.1.010 1 -1 -0.594604 -0.594604 + 27: 0b1.1.011 1 -1 -0.64842 -0.64842 + 28: 0b1.1.100 1 -1 -0.707107 -0.707107 + 29: 0b1.1.101 1 -1 -0.771105 -0.771105 + 30: 0b1.1.110 1 -1 -0.840896 -0.840896 + 31: 0b1.1.111 1 -1 -0.917004 -0.917004 +Generate Value table for an LNS<5,4> in TXT format + # Binary sign scale value format + 0: 0b0..0000 0 0 1 1 + 1: 0b0..0001 0 0 1.04427 1.04427 + 2: 0b0..0010 0 0 1.09051 1.09051 + 3: 0b0..0011 0 0 1.13879 1.13879 + 4: 0b0..0100 0 0 1.18921 1.18921 + 5: 0b0..0101 0 0 1.24186 1.24186 + 6: 0b0..0110 0 0 1.29684 1.29684 + 7: 0b0..0111 0 0 1.35426 1.35426 + 8: 0b0..1000 0 0 0 0 + 9: 0b0..1001 0 0 0.738413 0.738413 + 10: 0b0..1010 0 0 0.771105 0.771105 + 11: 0b0..1011 0 0 0.805245 0.805245 + 12: 0b0..1100 0 0 0.840896 0.840896 + 13: 0b0..1101 0 0 0.878126 0.878126 + 14: 0b0..1110 0 0 0.917004 0.917004 + 15: 0b0..1111 0 0 0.957603 0.957603 + 16: 0b1..0000 1 0 -1 -1 + 17: 0b1..0001 1 0 -1.04427 -1.04427 + 18: 0b1..0010 1 0 -1.09051 -1.09051 + 19: 0b1..0011 1 0 -1.13879 -1.13879 + 20: 0b1..0100 1 0 -1.18921 -1.18921 + 21: 0b1..0101 1 0 -1.24186 -1.24186 + 22: 0b1..0110 1 0 -1.29684 -1.29684 + 23: 0b1..0111 1 0 -1.35426 -1.35426 + 24: 0b1..1000 1 0 -nan(ind) -nan(ind) + 25: 0b1..1001 1 0 -0.738413 -0.738413 + 26: 0b1..1010 1 0 -0.771105 -0.771105 + 27: 0b1..1011 1 0 -0.805245 -0.805245 + 28: 0b1..1100 1 0 -0.840896 -0.840896 + 29: 0b1..1101 1 0 -0.878126 -0.878126 + 30: 0b1..1110 1 0 -0.917004 -0.917004 + 31: 0b1..1111 1 0 -0.957603 -0.957603 +Generate Value table for an LNS<6,0> in TXT format + # Binary sign scale value format + 0: 0b0.00000 0 0 1 1 + 1: 0b0.00001 0 1 2 2 + 2: 0b0.00010 0 2 4 4 + 3: 0b0.00011 0 3 8 8 + 4: 0b0.00100 0 4 16 16 + 5: 0b0.00101 0 5 32 32 + 6: 0b0.00110 0 6 64 64 + 7: 0b0.00111 0 7 128 128 + 8: 0b0.01000 0 8 256 256 + 9: 0b0.01001 0 9 512 512 + 10: 0b0.01010 0 10 1024 1024 + 11: 0b0.01011 0 11 2048 2048 + 12: 0b0.01100 0 12 4096 4096 + 13: 0b0.01101 0 13 8192 8192 + 14: 0b0.01110 0 14 16384 16384 + 15: 0b0.01111 0 15 32768 32768 + 16: 0b0.10000 0 -16 0 0 + 17: 0b0.10001 0 -15 3.05176e-05 3.05176e-05 + 18: 0b0.10010 0 -14 6.10352e-05 6.10352e-05 + 19: 0b0.10011 0 -13 0.00012207 0.00012207 + 20: 0b0.10100 0 -12 0.000244141 0.000244141 + 21: 0b0.10101 0 -11 0.000488281 0.000488281 + 22: 0b0.10110 0 -10 0.000976562 0.000976562 + 23: 0b0.10111 0 -9 0.00195312 0.00195312 + 24: 0b0.11000 0 -8 0.00390625 0.00390625 + 25: 0b0.11001 0 -7 0.0078125 0.0078125 + 26: 0b0.11010 0 -6 0.015625 0.015625 + 27: 0b0.11011 0 -5 0.03125 0.03125 + 28: 0b0.11100 0 -4 0.0625 0.0625 + 29: 0b0.11101 0 -3 0.125 0.125 + 30: 0b0.11110 0 -2 0.25 0.25 + 31: 0b0.11111 0 -1 0.5 0.5 + 32: 0b1.00000 1 0 -1 -1 + 33: 0b1.00001 1 1 -2 -2 + 34: 0b1.00010 1 2 -4 -4 + 35: 0b1.00011 1 3 -8 -8 + 36: 0b1.00100 1 4 -16 -16 + 37: 0b1.00101 1 5 -32 -32 + 38: 0b1.00110 1 6 -64 -64 + 39: 0b1.00111 1 7 -128 -128 + 40: 0b1.01000 1 8 -256 -256 + 41: 0b1.01001 1 9 -512 -512 + 42: 0b1.01010 1 10 -1024 -1024 + 43: 0b1.01011 1 11 -2048 -2048 + 44: 0b1.01100 1 12 -4096 -4096 + 45: 0b1.01101 1 13 -8192 -8192 + 46: 0b1.01110 1 14 -16384 -16384 + 47: 0b1.01111 1 15 -32768 -32768 + 48: 0b1.10000 1 -16 -nan(ind) -nan(ind) + 49: 0b1.10001 1 -15 -3.05176e-05 -3.05176e-05 + 50: 0b1.10010 1 -14 -6.10352e-05 -6.10352e-05 + 51: 0b1.10011 1 -13 -0.00012207 -0.00012207 + 52: 0b1.10100 1 -12 -0.000244141 -0.000244141 + 53: 0b1.10101 1 -11 -0.000488281 -0.000488281 + 54: 0b1.10110 1 -10 -0.000976562 -0.000976562 + 55: 0b1.10111 1 -9 -0.00195312 -0.00195312 + 56: 0b1.11000 1 -8 -0.00390625 -0.00390625 + 57: 0b1.11001 1 -7 -0.0078125 -0.0078125 + 58: 0b1.11010 1 -6 -0.015625 -0.015625 + 59: 0b1.11011 1 -5 -0.03125 -0.03125 + 60: 0b1.11100 1 -4 -0.0625 -0.0625 + 61: 0b1.11101 1 -3 -0.125 -0.125 + 62: 0b1.11110 1 -2 -0.25 -0.25 + 63: 0b1.11111 1 -1 -0.5 -0.5 +Generate Value table for an LNS<6,1> in TXT format + # Binary sign scale value format + 0: 0b0.0000.0 0 0 1 1 + 1: 0b0.0000.1 0 0 1.41421 1.41421 + 2: 0b0.0001.0 0 1 2 2 + 3: 0b0.0001.1 0 1 2.82843 2.82843 + 4: 0b0.0010.0 0 2 4 4 + 5: 0b0.0010.1 0 2 5.65685 5.65685 + 6: 0b0.0011.0 0 3 8 8 + 7: 0b0.0011.1 0 3 11.3137 11.3137 + 8: 0b0.0100.0 0 4 16 16 + 9: 0b0.0100.1 0 4 22.6274 22.6274 + 10: 0b0.0101.0 0 5 32 32 + 11: 0b0.0101.1 0 5 45.2548 45.2548 + 12: 0b0.0110.0 0 6 64 64 + 13: 0b0.0110.1 0 6 90.5097 90.5097 + 14: 0b0.0111.0 0 7 128 128 + 15: 0b0.0111.1 0 7 181.019 181.019 + 16: 0b0.1000.0 0 -8 0 0 + 17: 0b0.1000.1 0 -8 0.00552427 0.00552427 + 18: 0b0.1001.0 0 -7 0.0078125 0.0078125 + 19: 0b0.1001.1 0 -7 0.0110485 0.0110485 + 20: 0b0.1010.0 0 -6 0.015625 0.015625 + 21: 0b0.1010.1 0 -6 0.0220971 0.0220971 + 22: 0b0.1011.0 0 -5 0.03125 0.03125 + 23: 0b0.1011.1 0 -5 0.0441942 0.0441942 + 24: 0b0.1100.0 0 -4 0.0625 0.0625 + 25: 0b0.1100.1 0 -4 0.0883883 0.0883883 + 26: 0b0.1101.0 0 -3 0.125 0.125 + 27: 0b0.1101.1 0 -3 0.176777 0.176777 + 28: 0b0.1110.0 0 -2 0.25 0.25 + 29: 0b0.1110.1 0 -2 0.353553 0.353553 + 30: 0b0.1111.0 0 -1 0.5 0.5 + 31: 0b0.1111.1 0 -1 0.707107 0.707107 + 32: 0b1.0000.0 1 0 -1 -1 + 33: 0b1.0000.1 1 0 -1.41421 -1.41421 + 34: 0b1.0001.0 1 1 -2 -2 + 35: 0b1.0001.1 1 1 -2.82843 -2.82843 + 36: 0b1.0010.0 1 2 -4 -4 + 37: 0b1.0010.1 1 2 -5.65685 -5.65685 + 38: 0b1.0011.0 1 3 -8 -8 + 39: 0b1.0011.1 1 3 -11.3137 -11.3137 + 40: 0b1.0100.0 1 4 -16 -16 + 41: 0b1.0100.1 1 4 -22.6274 -22.6274 + 42: 0b1.0101.0 1 5 -32 -32 + 43: 0b1.0101.1 1 5 -45.2548 -45.2548 + 44: 0b1.0110.0 1 6 -64 -64 + 45: 0b1.0110.1 1 6 -90.5097 -90.5097 + 46: 0b1.0111.0 1 7 -128 -128 + 47: 0b1.0111.1 1 7 -181.019 -181.019 + 48: 0b1.1000.0 1 -8 -nan(ind) -nan(ind) + 49: 0b1.1000.1 1 -8 -0.00552427 -0.00552427 + 50: 0b1.1001.0 1 -7 -0.0078125 -0.0078125 + 51: 0b1.1001.1 1 -7 -0.0110485 -0.0110485 + 52: 0b1.1010.0 1 -6 -0.015625 -0.015625 + 53: 0b1.1010.1 1 -6 -0.0220971 -0.0220971 + 54: 0b1.1011.0 1 -5 -0.03125 -0.03125 + 55: 0b1.1011.1 1 -5 -0.0441942 -0.0441942 + 56: 0b1.1100.0 1 -4 -0.0625 -0.0625 + 57: 0b1.1100.1 1 -4 -0.0883883 -0.0883883 + 58: 0b1.1101.0 1 -3 -0.125 -0.125 + 59: 0b1.1101.1 1 -3 -0.176777 -0.176777 + 60: 0b1.1110.0 1 -2 -0.25 -0.25 + 61: 0b1.1110.1 1 -2 -0.353553 -0.353553 + 62: 0b1.1111.0 1 -1 -0.5 -0.5 + 63: 0b1.1111.1 1 -1 -0.707107 -0.707107 +Generate Value table for an LNS<6,2> in TXT format + # Binary sign scale value format + 0: 0b0.000.00 0 0 1 1 + 1: 0b0.000.01 0 0 1.18921 1.18921 + 2: 0b0.000.10 0 0 1.41421 1.41421 + 3: 0b0.000.11 0 0 1.68179 1.68179 + 4: 0b0.001.00 0 1 2 2 + 5: 0b0.001.01 0 1 2.37841 2.37841 + 6: 0b0.001.10 0 1 2.82843 2.82843 + 7: 0b0.001.11 0 1 3.36359 3.36359 + 8: 0b0.010.00 0 2 4 4 + 9: 0b0.010.01 0 2 4.75683 4.75683 + 10: 0b0.010.10 0 2 5.65685 5.65685 + 11: 0b0.010.11 0 2 6.72717 6.72717 + 12: 0b0.011.00 0 3 8 8 + 13: 0b0.011.01 0 3 9.51366 9.51366 + 14: 0b0.011.10 0 3 11.3137 11.3137 + 15: 0b0.011.11 0 3 13.4543 13.4543 + 16: 0b0.100.00 0 -4 0 0 + 17: 0b0.100.01 0 -4 0.0743254 0.0743254 + 18: 0b0.100.10 0 -4 0.0883883 0.0883883 + 19: 0b0.100.11 0 -4 0.105112 0.105112 + 20: 0b0.101.00 0 -3 0.125 0.125 + 21: 0b0.101.01 0 -3 0.148651 0.148651 + 22: 0b0.101.10 0 -3 0.176777 0.176777 + 23: 0b0.101.11 0 -3 0.210224 0.210224 + 24: 0b0.110.00 0 -2 0.25 0.25 + 25: 0b0.110.01 0 -2 0.297302 0.297302 + 26: 0b0.110.10 0 -2 0.353553 0.353553 + 27: 0b0.110.11 0 -2 0.420448 0.420448 + 28: 0b0.111.00 0 -1 0.5 0.5 + 29: 0b0.111.01 0 -1 0.594604 0.594604 + 30: 0b0.111.10 0 -1 0.707107 0.707107 + 31: 0b0.111.11 0 -1 0.840896 0.840896 + 32: 0b1.000.00 1 0 -1 -1 + 33: 0b1.000.01 1 0 -1.18921 -1.18921 + 34: 0b1.000.10 1 0 -1.41421 -1.41421 + 35: 0b1.000.11 1 0 -1.68179 -1.68179 + 36: 0b1.001.00 1 1 -2 -2 + 37: 0b1.001.01 1 1 -2.37841 -2.37841 + 38: 0b1.001.10 1 1 -2.82843 -2.82843 + 39: 0b1.001.11 1 1 -3.36359 -3.36359 + 40: 0b1.010.00 1 2 -4 -4 + 41: 0b1.010.01 1 2 -4.75683 -4.75683 + 42: 0b1.010.10 1 2 -5.65685 -5.65685 + 43: 0b1.010.11 1 2 -6.72717 -6.72717 + 44: 0b1.011.00 1 3 -8 -8 + 45: 0b1.011.01 1 3 -9.51366 -9.51366 + 46: 0b1.011.10 1 3 -11.3137 -11.3137 + 47: 0b1.011.11 1 3 -13.4543 -13.4543 + 48: 0b1.100.00 1 -4 -nan(ind) -nan(ind) + 49: 0b1.100.01 1 -4 -0.0743254 -0.0743254 + 50: 0b1.100.10 1 -4 -0.0883883 -0.0883883 + 51: 0b1.100.11 1 -4 -0.105112 -0.105112 + 52: 0b1.101.00 1 -3 -0.125 -0.125 + 53: 0b1.101.01 1 -3 -0.148651 -0.148651 + 54: 0b1.101.10 1 -3 -0.176777 -0.176777 + 55: 0b1.101.11 1 -3 -0.210224 -0.210224 + 56: 0b1.110.00 1 -2 -0.25 -0.25 + 57: 0b1.110.01 1 -2 -0.297302 -0.297302 + 58: 0b1.110.10 1 -2 -0.353553 -0.353553 + 59: 0b1.110.11 1 -2 -0.420448 -0.420448 + 60: 0b1.111.00 1 -1 -0.5 -0.5 + 61: 0b1.111.01 1 -1 -0.594604 -0.594604 + 62: 0b1.111.10 1 -1 -0.707107 -0.707107 + 63: 0b1.111.11 1 -1 -0.840896 -0.840896 +Generate Value table for an LNS<6,3> in TXT format + # Binary sign scale value format + 0: 0b0.00.000 0 0 1 1 + 1: 0b0.00.001 0 0 1.09051 1.09051 + 2: 0b0.00.010 0 0 1.18921 1.18921 + 3: 0b0.00.011 0 0 1.29684 1.29684 + 4: 0b0.00.100 0 0 1.41421 1.41421 + 5: 0b0.00.101 0 0 1.54221 1.54221 + 6: 0b0.00.110 0 0 1.68179 1.68179 + 7: 0b0.00.111 0 0 1.83401 1.83401 + 8: 0b0.01.000 0 1 2 2 + 9: 0b0.01.001 0 1 2.18102 2.18102 + 10: 0b0.01.010 0 1 2.37841 2.37841 + 11: 0b0.01.011 0 1 2.59368 2.59368 + 12: 0b0.01.100 0 1 2.82843 2.82843 + 13: 0b0.01.101 0 1 3.08442 3.08442 + 14: 0b0.01.110 0 1 3.36359 3.36359 + 15: 0b0.01.111 0 1 3.66802 3.66802 + 16: 0b0.10.000 0 -2 0 0 + 17: 0b0.10.001 0 -2 0.272627 0.272627 + 18: 0b0.10.010 0 -2 0.297302 0.297302 + 19: 0b0.10.011 0 -2 0.32421 0.32421 + 20: 0b0.10.100 0 -2 0.353553 0.353553 + 21: 0b0.10.101 0 -2 0.385553 0.385553 + 22: 0b0.10.110 0 -2 0.420448 0.420448 + 23: 0b0.10.111 0 -2 0.458502 0.458502 + 24: 0b0.11.000 0 -1 0.5 0.5 + 25: 0b0.11.001 0 -1 0.545254 0.545254 + 26: 0b0.11.010 0 -1 0.594604 0.594604 + 27: 0b0.11.011 0 -1 0.64842 0.64842 + 28: 0b0.11.100 0 -1 0.707107 0.707107 + 29: 0b0.11.101 0 -1 0.771105 0.771105 + 30: 0b0.11.110 0 -1 0.840896 0.840896 + 31: 0b0.11.111 0 -1 0.917004 0.917004 + 32: 0b1.00.000 1 0 -1 -1 + 33: 0b1.00.001 1 0 -1.09051 -1.09051 + 34: 0b1.00.010 1 0 -1.18921 -1.18921 + 35: 0b1.00.011 1 0 -1.29684 -1.29684 + 36: 0b1.00.100 1 0 -1.41421 -1.41421 + 37: 0b1.00.101 1 0 -1.54221 -1.54221 + 38: 0b1.00.110 1 0 -1.68179 -1.68179 + 39: 0b1.00.111 1 0 -1.83401 -1.83401 + 40: 0b1.01.000 1 1 -2 -2 + 41: 0b1.01.001 1 1 -2.18102 -2.18102 + 42: 0b1.01.010 1 1 -2.37841 -2.37841 + 43: 0b1.01.011 1 1 -2.59368 -2.59368 + 44: 0b1.01.100 1 1 -2.82843 -2.82843 + 45: 0b1.01.101 1 1 -3.08442 -3.08442 + 46: 0b1.01.110 1 1 -3.36359 -3.36359 + 47: 0b1.01.111 1 1 -3.66802 -3.66802 + 48: 0b1.10.000 1 -2 -nan(ind) -nan(ind) + 49: 0b1.10.001 1 -2 -0.272627 -0.272627 + 50: 0b1.10.010 1 -2 -0.297302 -0.297302 + 51: 0b1.10.011 1 -2 -0.32421 -0.32421 + 52: 0b1.10.100 1 -2 -0.353553 -0.353553 + 53: 0b1.10.101 1 -2 -0.385553 -0.385553 + 54: 0b1.10.110 1 -2 -0.420448 -0.420448 + 55: 0b1.10.111 1 -2 -0.458502 -0.458502 + 56: 0b1.11.000 1 -1 -0.5 -0.5 + 57: 0b1.11.001 1 -1 -0.545254 -0.545254 + 58: 0b1.11.010 1 -1 -0.594604 -0.594604 + 59: 0b1.11.011 1 -1 -0.64842 -0.64842 + 60: 0b1.11.100 1 -1 -0.707107 -0.707107 + 61: 0b1.11.101 1 -1 -0.771105 -0.771105 + 62: 0b1.11.110 1 -1 -0.840896 -0.840896 + 63: 0b1.11.111 1 -1 -0.917004 -0.917004 +Generate Value table for an LNS<6,4> in TXT format + # Binary sign scale value format + 0: 0b0.0.0000 0 0 1 1 + 1: 0b0.0.0001 0 0 1.04427 1.04427 + 2: 0b0.0.0010 0 0 1.09051 1.09051 + 3: 0b0.0.0011 0 0 1.13879 1.13879 + 4: 0b0.0.0100 0 0 1.18921 1.18921 + 5: 0b0.0.0101 0 0 1.24186 1.24186 + 6: 0b0.0.0110 0 0 1.29684 1.29684 + 7: 0b0.0.0111 0 0 1.35426 1.35426 + 8: 0b0.0.1000 0 0 1.41421 1.41421 + 9: 0b0.0.1001 0 0 1.47683 1.47683 + 10: 0b0.0.1010 0 0 1.54221 1.54221 + 11: 0b0.0.1011 0 0 1.61049 1.61049 + 12: 0b0.0.1100 0 0 1.68179 1.68179 + 13: 0b0.0.1101 0 0 1.75625 1.75625 + 14: 0b0.0.1110 0 0 1.83401 1.83401 + 15: 0b0.0.1111 0 0 1.91521 1.91521 + 16: 0b0.1.0000 0 -1 0 0 + 17: 0b0.1.0001 0 -1 0.522137 0.522137 + 18: 0b0.1.0010 0 -1 0.545254 0.545254 + 19: 0b0.1.0011 0 -1 0.569394 0.569394 + 20: 0b0.1.0100 0 -1 0.594604 0.594604 + 21: 0b0.1.0101 0 -1 0.620929 0.620929 + 22: 0b0.1.0110 0 -1 0.64842 0.64842 + 23: 0b0.1.0111 0 -1 0.677128 0.677128 + 24: 0b0.1.1000 0 -1 0.707107 0.707107 + 25: 0b0.1.1001 0 -1 0.738413 0.738413 + 26: 0b0.1.1010 0 -1 0.771105 0.771105 + 27: 0b0.1.1011 0 -1 0.805245 0.805245 + 28: 0b0.1.1100 0 -1 0.840896 0.840896 + 29: 0b0.1.1101 0 -1 0.878126 0.878126 + 30: 0b0.1.1110 0 -1 0.917004 0.917004 + 31: 0b0.1.1111 0 -1 0.957603 0.957603 + 32: 0b1.0.0000 1 0 -1 -1 + 33: 0b1.0.0001 1 0 -1.04427 -1.04427 + 34: 0b1.0.0010 1 0 -1.09051 -1.09051 + 35: 0b1.0.0011 1 0 -1.13879 -1.13879 + 36: 0b1.0.0100 1 0 -1.18921 -1.18921 + 37: 0b1.0.0101 1 0 -1.24186 -1.24186 + 38: 0b1.0.0110 1 0 -1.29684 -1.29684 + 39: 0b1.0.0111 1 0 -1.35426 -1.35426 + 40: 0b1.0.1000 1 0 -1.41421 -1.41421 + 41: 0b1.0.1001 1 0 -1.47683 -1.47683 + 42: 0b1.0.1010 1 0 -1.54221 -1.54221 + 43: 0b1.0.1011 1 0 -1.61049 -1.61049 + 44: 0b1.0.1100 1 0 -1.68179 -1.68179 + 45: 0b1.0.1101 1 0 -1.75625 -1.75625 + 46: 0b1.0.1110 1 0 -1.83401 -1.83401 + 47: 0b1.0.1111 1 0 -1.91521 -1.91521 + 48: 0b1.1.0000 1 -1 -nan(ind) -nan(ind) + 49: 0b1.1.0001 1 -1 -0.522137 -0.522137 + 50: 0b1.1.0010 1 -1 -0.545254 -0.545254 + 51: 0b1.1.0011 1 -1 -0.569394 -0.569394 + 52: 0b1.1.0100 1 -1 -0.594604 -0.594604 + 53: 0b1.1.0101 1 -1 -0.620929 -0.620929 + 54: 0b1.1.0110 1 -1 -0.64842 -0.64842 + 55: 0b1.1.0111 1 -1 -0.677128 -0.677128 + 56: 0b1.1.1000 1 -1 -0.707107 -0.707107 + 57: 0b1.1.1001 1 -1 -0.738413 -0.738413 + 58: 0b1.1.1010 1 -1 -0.771105 -0.771105 + 59: 0b1.1.1011 1 -1 -0.805245 -0.805245 + 60: 0b1.1.1100 1 -1 -0.840896 -0.840896 + 61: 0b1.1.1101 1 -1 -0.878126 -0.878126 + 62: 0b1.1.1110 1 -1 -0.917004 -0.917004 + 63: 0b1.1.1111 1 -1 -0.957603 -0.957603 +Generate Value table for an LNS<6,5> in TXT format + # Binary sign scale value format + 0: 0b0..00000 0 0 1 1 + 1: 0b0..00001 0 0 1.0219 1.0219 + 2: 0b0..00010 0 0 1.04427 1.04427 + 3: 0b0..00011 0 0 1.06714 1.06714 + 4: 0b0..00100 0 0 1.09051 1.09051 + 5: 0b0..00101 0 0 1.11439 1.11439 + 6: 0b0..00110 0 0 1.13879 1.13879 + 7: 0b0..00111 0 0 1.16372 1.16372 + 8: 0b0..01000 0 0 1.18921 1.18921 + 9: 0b0..01001 0 0 1.21525 1.21525 + 10: 0b0..01010 0 0 1.24186 1.24186 + 11: 0b0..01011 0 0 1.26905 1.26905 + 12: 0b0..01100 0 0 1.29684 1.29684 + 13: 0b0..01101 0 0 1.32524 1.32524 + 14: 0b0..01110 0 0 1.35426 1.35426 + 15: 0b0..01111 0 0 1.38391 1.38391 + 16: 0b0..10000 0 0 0 0 + 17: 0b0..10001 0 0 0.72259 0.72259 + 18: 0b0..10010 0 0 0.738413 0.738413 + 19: 0b0..10011 0 0 0.754582 0.754582 + 20: 0b0..10100 0 0 0.771105 0.771105 + 21: 0b0..10101 0 0 0.78799 0.78799 + 22: 0b0..10110 0 0 0.805245 0.805245 + 23: 0b0..10111 0 0 0.822878 0.822878 + 24: 0b0..11000 0 0 0.840896 0.840896 + 25: 0b0..11001 0 0 0.85931 0.85931 + 26: 0b0..11010 0 0 0.878126 0.878126 + 27: 0b0..11011 0 0 0.897355 0.897355 + 28: 0b0..11100 0 0 0.917004 0.917004 + 29: 0b0..11101 0 0 0.937084 0.937084 + 30: 0b0..11110 0 0 0.957603 0.957603 + 31: 0b0..11111 0 0 0.978572 0.978572 + 32: 0b1..00000 1 0 -1 -1 + 33: 0b1..00001 1 0 -1.0219 -1.0219 + 34: 0b1..00010 1 0 -1.04427 -1.04427 + 35: 0b1..00011 1 0 -1.06714 -1.06714 + 36: 0b1..00100 1 0 -1.09051 -1.09051 + 37: 0b1..00101 1 0 -1.11439 -1.11439 + 38: 0b1..00110 1 0 -1.13879 -1.13879 + 39: 0b1..00111 1 0 -1.16372 -1.16372 + 40: 0b1..01000 1 0 -1.18921 -1.18921 + 41: 0b1..01001 1 0 -1.21525 -1.21525 + 42: 0b1..01010 1 0 -1.24186 -1.24186 + 43: 0b1..01011 1 0 -1.26905 -1.26905 + 44: 0b1..01100 1 0 -1.29684 -1.29684 + 45: 0b1..01101 1 0 -1.32524 -1.32524 + 46: 0b1..01110 1 0 -1.35426 -1.35426 + 47: 0b1..01111 1 0 -1.38391 -1.38391 + 48: 0b1..10000 1 0 -nan(ind) -nan(ind) + 49: 0b1..10001 1 0 -0.72259 -0.72259 + 50: 0b1..10010 1 0 -0.738413 -0.738413 + 51: 0b1..10011 1 0 -0.754582 -0.754582 + 52: 0b1..10100 1 0 -0.771105 -0.771105 + 53: 0b1..10101 1 0 -0.78799 -0.78799 + 54: 0b1..10110 1 0 -0.805245 -0.805245 + 55: 0b1..10111 1 0 -0.822878 -0.822878 + 56: 0b1..11000 1 0 -0.840896 -0.840896 + 57: 0b1..11001 1 0 -0.85931 -0.85931 + 58: 0b1..11010 1 0 -0.878126 -0.878126 + 59: 0b1..11011 1 0 -0.897355 -0.897355 + 60: 0b1..11100 1 0 -0.917004 -0.917004 + 61: 0b1..11101 1 0 -0.937084 -0.937084 + 62: 0b1..11110 1 0 -0.957603 -0.957603 + 63: 0b1..11111 1 0 -0.978572 -0.978572 +Generate Value table for an LNS<8,0> in TXT format + # Binary sign scale value format + 0: 0b0.0000000 0 0 1 1 + 1: 0b0.0000001 0 1 2 2 + 2: 0b0.0000010 0 2 4 4 + 3: 0b0.0000011 0 3 8 8 + 4: 0b0.0000100 0 4 16 16 + 5: 0b0.0000101 0 5 32 32 + 6: 0b0.0000110 0 6 64 64 + 7: 0b0.0000111 0 7 128 128 + 8: 0b0.0001000 0 8 256 256 + 9: 0b0.0001001 0 9 512 512 + 10: 0b0.0001010 0 10 1024 1024 + 11: 0b0.0001011 0 11 2048 2048 + 12: 0b0.0001100 0 12 4096 4096 + 13: 0b0.0001101 0 13 8192 8192 + 14: 0b0.0001110 0 14 16384 16384 + 15: 0b0.0001111 0 15 32768 32768 + 16: 0b0.0010000 0 16 65536 65536 + 17: 0b0.0010001 0 17 131072 131072 + 18: 0b0.0010010 0 18 262144 262144 + 19: 0b0.0010011 0 19 524288 524288 + 20: 0b0.0010100 0 20 1.04858e+06 1.04858e+06 + 21: 0b0.0010101 0 21 2.09715e+06 2.09715e+06 + 22: 0b0.0010110 0 22 4.1943e+06 4.1943e+06 + 23: 0b0.0010111 0 23 8.38861e+06 8.38861e+06 + 24: 0b0.0011000 0 24 1.67772e+07 1.67772e+07 + 25: 0b0.0011001 0 25 3.35544e+07 3.35544e+07 + 26: 0b0.0011010 0 26 6.71089e+07 6.71089e+07 + 27: 0b0.0011011 0 27 1.34218e+08 1.34218e+08 + 28: 0b0.0011100 0 28 2.68435e+08 2.68435e+08 + 29: 0b0.0011101 0 29 5.36871e+08 5.36871e+08 + 30: 0b0.0011110 0 30 1.07374e+09 1.07374e+09 + 31: 0b0.0011111 0 31 2.14748e+09 2.14748e+09 + 32: 0b0.0100000 0 32 4.29497e+09 4.29497e+09 + 33: 0b0.0100001 0 33 8.58993e+09 8.58993e+09 + 34: 0b0.0100010 0 34 1.71799e+10 1.71799e+10 + 35: 0b0.0100011 0 35 3.43597e+10 3.43597e+10 + 36: 0b0.0100100 0 36 6.87195e+10 6.87195e+10 + 37: 0b0.0100101 0 37 1.37439e+11 1.37439e+11 + 38: 0b0.0100110 0 38 2.74878e+11 2.74878e+11 + 39: 0b0.0100111 0 39 5.49756e+11 5.49756e+11 + 40: 0b0.0101000 0 40 1.09951e+12 1.09951e+12 + 41: 0b0.0101001 0 41 2.19902e+12 2.19902e+12 + 42: 0b0.0101010 0 42 4.39805e+12 4.39805e+12 + 43: 0b0.0101011 0 43 8.79609e+12 8.79609e+12 + 44: 0b0.0101100 0 44 1.75922e+13 1.75922e+13 + 45: 0b0.0101101 0 45 3.51844e+13 3.51844e+13 + 46: 0b0.0101110 0 46 7.03687e+13 7.03687e+13 + 47: 0b0.0101111 0 47 1.40737e+14 1.40737e+14 + 48: 0b0.0110000 0 48 2.81475e+14 2.81475e+14 + 49: 0b0.0110001 0 49 5.6295e+14 5.6295e+14 + 50: 0b0.0110010 0 50 1.1259e+15 1.1259e+15 + 51: 0b0.0110011 0 51 2.2518e+15 2.2518e+15 + 52: 0b0.0110100 0 52 4.5036e+15 4.5036e+15 + 53: 0b0.0110101 0 53 9.0072e+15 9.0072e+15 + 54: 0b0.0110110 0 54 1.80144e+16 1.80144e+16 + 55: 0b0.0110111 0 55 3.60288e+16 3.60288e+16 + 56: 0b0.0111000 0 56 7.20576e+16 7.20576e+16 + 57: 0b0.0111001 0 57 1.44115e+17 1.44115e+17 + 58: 0b0.0111010 0 58 2.8823e+17 2.8823e+17 + 59: 0b0.0111011 0 59 5.76461e+17 5.76461e+17 + 60: 0b0.0111100 0 60 1.15292e+18 1.15292e+18 + 61: 0b0.0111101 0 61 2.30584e+18 2.30584e+18 + 62: 0b0.0111110 0 62 4.61169e+18 4.61169e+18 + 63: 0b0.0111111 0 63 9.22337e+18 9.22337e+18 + 64: 0b0.1000000 0 -64 0 0 + 65: 0b0.1000001 0 -63 1.0842e-19 1.0842e-19 + 66: 0b0.1000010 0 -62 2.1684e-19 2.1684e-19 + 67: 0b0.1000011 0 -61 4.33681e-19 4.33681e-19 + 68: 0b0.1000100 0 -60 8.67362e-19 8.67362e-19 + 69: 0b0.1000101 0 -59 1.73472e-18 1.73472e-18 + 70: 0b0.1000110 0 -58 3.46945e-18 3.46945e-18 + 71: 0b0.1000111 0 -57 6.93889e-18 6.93889e-18 + 72: 0b0.1001000 0 -56 1.38778e-17 1.38778e-17 + 73: 0b0.1001001 0 -55 2.77556e-17 2.77556e-17 + 74: 0b0.1001010 0 -54 5.55112e-17 5.55112e-17 + 75: 0b0.1001011 0 -53 1.11022e-16 1.11022e-16 + 76: 0b0.1001100 0 -52 2.22045e-16 2.22045e-16 + 77: 0b0.1001101 0 -51 4.44089e-16 4.44089e-16 + 78: 0b0.1001110 0 -50 8.88178e-16 8.88178e-16 + 79: 0b0.1001111 0 -49 1.77636e-15 1.77636e-15 + 80: 0b0.1010000 0 -48 3.55271e-15 3.55271e-15 + 81: 0b0.1010001 0 -47 7.10543e-15 7.10543e-15 + 82: 0b0.1010010 0 -46 1.42109e-14 1.42109e-14 + 83: 0b0.1010011 0 -45 2.84217e-14 2.84217e-14 + 84: 0b0.1010100 0 -44 5.68434e-14 5.68434e-14 + 85: 0b0.1010101 0 -43 1.13687e-13 1.13687e-13 + 86: 0b0.1010110 0 -42 2.27374e-13 2.27374e-13 + 87: 0b0.1010111 0 -41 4.54747e-13 4.54747e-13 + 88: 0b0.1011000 0 -40 9.09495e-13 9.09495e-13 + 89: 0b0.1011001 0 -39 1.81899e-12 1.81899e-12 + 90: 0b0.1011010 0 -38 3.63798e-12 3.63798e-12 + 91: 0b0.1011011 0 -37 7.27596e-12 7.27596e-12 + 92: 0b0.1011100 0 -36 1.45519e-11 1.45519e-11 + 93: 0b0.1011101 0 -35 2.91038e-11 2.91038e-11 + 94: 0b0.1011110 0 -34 5.82077e-11 5.82077e-11 + 95: 0b0.1011111 0 -33 1.16415e-10 1.16415e-10 + 96: 0b0.1100000 0 -32 2.32831e-10 2.32831e-10 + 97: 0b0.1100001 0 -31 4.65661e-10 4.65661e-10 + 98: 0b0.1100010 0 -30 9.31323e-10 9.31323e-10 + 99: 0b0.1100011 0 -29 1.86265e-09 1.86265e-09 + 100: 0b0.1100100 0 -28 3.72529e-09 3.72529e-09 + 101: 0b0.1100101 0 -27 7.45058e-09 7.45058e-09 + 102: 0b0.1100110 0 -26 1.49012e-08 1.49012e-08 + 103: 0b0.1100111 0 -25 2.98023e-08 2.98023e-08 + 104: 0b0.1101000 0 -24 5.96046e-08 5.96046e-08 + 105: 0b0.1101001 0 -23 1.19209e-07 1.19209e-07 + 106: 0b0.1101010 0 -22 2.38419e-07 2.38419e-07 + 107: 0b0.1101011 0 -21 4.76837e-07 4.76837e-07 + 108: 0b0.1101100 0 -20 9.53674e-07 9.53674e-07 + 109: 0b0.1101101 0 -19 1.90735e-06 1.90735e-06 + 110: 0b0.1101110 0 -18 3.8147e-06 3.8147e-06 + 111: 0b0.1101111 0 -17 7.62939e-06 7.62939e-06 + 112: 0b0.1110000 0 -16 1.52588e-05 1.52588e-05 + 113: 0b0.1110001 0 -15 3.05176e-05 3.05176e-05 + 114: 0b0.1110010 0 -14 6.10352e-05 6.10352e-05 + 115: 0b0.1110011 0 -13 0.00012207 0.00012207 + 116: 0b0.1110100 0 -12 0.000244141 0.000244141 + 117: 0b0.1110101 0 -11 0.000488281 0.000488281 + 118: 0b0.1110110 0 -10 0.000976562 0.000976562 + 119: 0b0.1110111 0 -9 0.00195312 0.00195312 + 120: 0b0.1111000 0 -8 0.00390625 0.00390625 + 121: 0b0.1111001 0 -7 0.0078125 0.0078125 + 122: 0b0.1111010 0 -6 0.015625 0.015625 + 123: 0b0.1111011 0 -5 0.03125 0.03125 + 124: 0b0.1111100 0 -4 0.0625 0.0625 + 125: 0b0.1111101 0 -3 0.125 0.125 + 126: 0b0.1111110 0 -2 0.25 0.25 + 127: 0b0.1111111 0 -1 0.5 0.5 + 128: 0b1.0000000 1 0 -1 -1 + 129: 0b1.0000001 1 1 -2 -2 + 130: 0b1.0000010 1 2 -4 -4 + 131: 0b1.0000011 1 3 -8 -8 + 132: 0b1.0000100 1 4 -16 -16 + 133: 0b1.0000101 1 5 -32 -32 + 134: 0b1.0000110 1 6 -64 -64 + 135: 0b1.0000111 1 7 -128 -128 + 136: 0b1.0001000 1 8 -256 -256 + 137: 0b1.0001001 1 9 -512 -512 + 138: 0b1.0001010 1 10 -1024 -1024 + 139: 0b1.0001011 1 11 -2048 -2048 + 140: 0b1.0001100 1 12 -4096 -4096 + 141: 0b1.0001101 1 13 -8192 -8192 + 142: 0b1.0001110 1 14 -16384 -16384 + 143: 0b1.0001111 1 15 -32768 -32768 + 144: 0b1.0010000 1 16 -65536 -65536 + 145: 0b1.0010001 1 17 -131072 -131072 + 146: 0b1.0010010 1 18 -262144 -262144 + 147: 0b1.0010011 1 19 -524288 -524288 + 148: 0b1.0010100 1 20 -1.04858e+06 -1.04858e+06 + 149: 0b1.0010101 1 21 -2.09715e+06 -2.09715e+06 + 150: 0b1.0010110 1 22 -4.1943e+06 -4.1943e+06 + 151: 0b1.0010111 1 23 -8.38861e+06 -8.38861e+06 + 152: 0b1.0011000 1 24 -1.67772e+07 -1.67772e+07 + 153: 0b1.0011001 1 25 -3.35544e+07 -3.35544e+07 + 154: 0b1.0011010 1 26 -6.71089e+07 -6.71089e+07 + 155: 0b1.0011011 1 27 -1.34218e+08 -1.34218e+08 + 156: 0b1.0011100 1 28 -2.68435e+08 -2.68435e+08 + 157: 0b1.0011101 1 29 -5.36871e+08 -5.36871e+08 + 158: 0b1.0011110 1 30 -1.07374e+09 -1.07374e+09 + 159: 0b1.0011111 1 31 -2.14748e+09 -2.14748e+09 + 160: 0b1.0100000 1 32 -4.29497e+09 -4.29497e+09 + 161: 0b1.0100001 1 33 -8.58993e+09 -8.58993e+09 + 162: 0b1.0100010 1 34 -1.71799e+10 -1.71799e+10 + 163: 0b1.0100011 1 35 -3.43597e+10 -3.43597e+10 + 164: 0b1.0100100 1 36 -6.87195e+10 -6.87195e+10 + 165: 0b1.0100101 1 37 -1.37439e+11 -1.37439e+11 + 166: 0b1.0100110 1 38 -2.74878e+11 -2.74878e+11 + 167: 0b1.0100111 1 39 -5.49756e+11 -5.49756e+11 + 168: 0b1.0101000 1 40 -1.09951e+12 -1.09951e+12 + 169: 0b1.0101001 1 41 -2.19902e+12 -2.19902e+12 + 170: 0b1.0101010 1 42 -4.39805e+12 -4.39805e+12 + 171: 0b1.0101011 1 43 -8.79609e+12 -8.79609e+12 + 172: 0b1.0101100 1 44 -1.75922e+13 -1.75922e+13 + 173: 0b1.0101101 1 45 -3.51844e+13 -3.51844e+13 + 174: 0b1.0101110 1 46 -7.03687e+13 -7.03687e+13 + 175: 0b1.0101111 1 47 -1.40737e+14 -1.40737e+14 + 176: 0b1.0110000 1 48 -2.81475e+14 -2.81475e+14 + 177: 0b1.0110001 1 49 -5.6295e+14 -5.6295e+14 + 178: 0b1.0110010 1 50 -1.1259e+15 -1.1259e+15 + 179: 0b1.0110011 1 51 -2.2518e+15 -2.2518e+15 + 180: 0b1.0110100 1 52 -4.5036e+15 -4.5036e+15 + 181: 0b1.0110101 1 53 -9.0072e+15 -9.0072e+15 + 182: 0b1.0110110 1 54 -1.80144e+16 -1.80144e+16 + 183: 0b1.0110111 1 55 -3.60288e+16 -3.60288e+16 + 184: 0b1.0111000 1 56 -7.20576e+16 -7.20576e+16 + 185: 0b1.0111001 1 57 -1.44115e+17 -1.44115e+17 + 186: 0b1.0111010 1 58 -2.8823e+17 -2.8823e+17 + 187: 0b1.0111011 1 59 -5.76461e+17 -5.76461e+17 + 188: 0b1.0111100 1 60 -1.15292e+18 -1.15292e+18 + 189: 0b1.0111101 1 61 -2.30584e+18 -2.30584e+18 + 190: 0b1.0111110 1 62 -4.61169e+18 -4.61169e+18 + 191: 0b1.0111111 1 63 -9.22337e+18 -9.22337e+18 + 192: 0b1.1000000 1 -64 -nan(ind) -nan(ind) + 193: 0b1.1000001 1 -63 -1.0842e-19 -1.0842e-19 + 194: 0b1.1000010 1 -62 -2.1684e-19 -2.1684e-19 + 195: 0b1.1000011 1 -61 -4.33681e-19 -4.33681e-19 + 196: 0b1.1000100 1 -60 -8.67362e-19 -8.67362e-19 + 197: 0b1.1000101 1 -59 -1.73472e-18 -1.73472e-18 + 198: 0b1.1000110 1 -58 -3.46945e-18 -3.46945e-18 + 199: 0b1.1000111 1 -57 -6.93889e-18 -6.93889e-18 + 200: 0b1.1001000 1 -56 -1.38778e-17 -1.38778e-17 + 201: 0b1.1001001 1 -55 -2.77556e-17 -2.77556e-17 + 202: 0b1.1001010 1 -54 -5.55112e-17 -5.55112e-17 + 203: 0b1.1001011 1 -53 -1.11022e-16 -1.11022e-16 + 204: 0b1.1001100 1 -52 -2.22045e-16 -2.22045e-16 + 205: 0b1.1001101 1 -51 -4.44089e-16 -4.44089e-16 + 206: 0b1.1001110 1 -50 -8.88178e-16 -8.88178e-16 + 207: 0b1.1001111 1 -49 -1.77636e-15 -1.77636e-15 + 208: 0b1.1010000 1 -48 -3.55271e-15 -3.55271e-15 + 209: 0b1.1010001 1 -47 -7.10543e-15 -7.10543e-15 + 210: 0b1.1010010 1 -46 -1.42109e-14 -1.42109e-14 + 211: 0b1.1010011 1 -45 -2.84217e-14 -2.84217e-14 + 212: 0b1.1010100 1 -44 -5.68434e-14 -5.68434e-14 + 213: 0b1.1010101 1 -43 -1.13687e-13 -1.13687e-13 + 214: 0b1.1010110 1 -42 -2.27374e-13 -2.27374e-13 + 215: 0b1.1010111 1 -41 -4.54747e-13 -4.54747e-13 + 216: 0b1.1011000 1 -40 -9.09495e-13 -9.09495e-13 + 217: 0b1.1011001 1 -39 -1.81899e-12 -1.81899e-12 + 218: 0b1.1011010 1 -38 -3.63798e-12 -3.63798e-12 + 219: 0b1.1011011 1 -37 -7.27596e-12 -7.27596e-12 + 220: 0b1.1011100 1 -36 -1.45519e-11 -1.45519e-11 + 221: 0b1.1011101 1 -35 -2.91038e-11 -2.91038e-11 + 222: 0b1.1011110 1 -34 -5.82077e-11 -5.82077e-11 + 223: 0b1.1011111 1 -33 -1.16415e-10 -1.16415e-10 + 224: 0b1.1100000 1 -32 -2.32831e-10 -2.32831e-10 + 225: 0b1.1100001 1 -31 -4.65661e-10 -4.65661e-10 + 226: 0b1.1100010 1 -30 -9.31323e-10 -9.31323e-10 + 227: 0b1.1100011 1 -29 -1.86265e-09 -1.86265e-09 + 228: 0b1.1100100 1 -28 -3.72529e-09 -3.72529e-09 + 229: 0b1.1100101 1 -27 -7.45058e-09 -7.45058e-09 + 230: 0b1.1100110 1 -26 -1.49012e-08 -1.49012e-08 + 231: 0b1.1100111 1 -25 -2.98023e-08 -2.98023e-08 + 232: 0b1.1101000 1 -24 -5.96046e-08 -5.96046e-08 + 233: 0b1.1101001 1 -23 -1.19209e-07 -1.19209e-07 + 234: 0b1.1101010 1 -22 -2.38419e-07 -2.38419e-07 + 235: 0b1.1101011 1 -21 -4.76837e-07 -4.76837e-07 + 236: 0b1.1101100 1 -20 -9.53674e-07 -9.53674e-07 + 237: 0b1.1101101 1 -19 -1.90735e-06 -1.90735e-06 + 238: 0b1.1101110 1 -18 -3.8147e-06 -3.8147e-06 + 239: 0b1.1101111 1 -17 -7.62939e-06 -7.62939e-06 + 240: 0b1.1110000 1 -16 -1.52588e-05 -1.52588e-05 + 241: 0b1.1110001 1 -15 -3.05176e-05 -3.05176e-05 + 242: 0b1.1110010 1 -14 -6.10352e-05 -6.10352e-05 + 243: 0b1.1110011 1 -13 -0.00012207 -0.00012207 + 244: 0b1.1110100 1 -12 -0.000244141 -0.000244141 + 245: 0b1.1110101 1 -11 -0.000488281 -0.000488281 + 246: 0b1.1110110 1 -10 -0.000976562 -0.000976562 + 247: 0b1.1110111 1 -9 -0.00195312 -0.00195312 + 248: 0b1.1111000 1 -8 -0.00390625 -0.00390625 + 249: 0b1.1111001 1 -7 -0.0078125 -0.0078125 + 250: 0b1.1111010 1 -6 -0.015625 -0.015625 + 251: 0b1.1111011 1 -5 -0.03125 -0.03125 + 252: 0b1.1111100 1 -4 -0.0625 -0.0625 + 253: 0b1.1111101 1 -3 -0.125 -0.125 + 254: 0b1.1111110 1 -2 -0.25 -0.25 + 255: 0b1.1111111 1 -1 -0.5 -0.5 +Generate Value table for an LNS<8,1> in TXT format + # Binary sign scale value format + 0: 0b0.000000.0 0 0 1 1 + 1: 0b0.000000.1 0 0 1.41421 1.41421 + 2: 0b0.000001.0 0 1 2 2 + 3: 0b0.000001.1 0 1 2.82843 2.82843 + 4: 0b0.000010.0 0 2 4 4 + 5: 0b0.000010.1 0 2 5.65685 5.65685 + 6: 0b0.000011.0 0 3 8 8 + 7: 0b0.000011.1 0 3 11.3137 11.3137 + 8: 0b0.000100.0 0 4 16 16 + 9: 0b0.000100.1 0 4 22.6274 22.6274 + 10: 0b0.000101.0 0 5 32 32 + 11: 0b0.000101.1 0 5 45.2548 45.2548 + 12: 0b0.000110.0 0 6 64 64 + 13: 0b0.000110.1 0 6 90.5097 90.5097 + 14: 0b0.000111.0 0 7 128 128 + 15: 0b0.000111.1 0 7 181.019 181.019 + 16: 0b0.001000.0 0 8 256 256 + 17: 0b0.001000.1 0 8 362.039 362.039 + 18: 0b0.001001.0 0 9 512 512 + 19: 0b0.001001.1 0 9 724.077 724.077 + 20: 0b0.001010.0 0 10 1024 1024 + 21: 0b0.001010.1 0 10 1448.15 1448.15 + 22: 0b0.001011.0 0 11 2048 2048 + 23: 0b0.001011.1 0 11 2896.31 2896.31 + 24: 0b0.001100.0 0 12 4096 4096 + 25: 0b0.001100.1 0 12 5792.62 5792.62 + 26: 0b0.001101.0 0 13 8192 8192 + 27: 0b0.001101.1 0 13 11585.2 11585.2 + 28: 0b0.001110.0 0 14 16384 16384 + 29: 0b0.001110.1 0 14 23170.5 23170.5 + 30: 0b0.001111.0 0 15 32768 32768 + 31: 0b0.001111.1 0 15 46341 46341 + 32: 0b0.010000.0 0 16 65536 65536 + 33: 0b0.010000.1 0 16 92681.9 92681.9 + 34: 0b0.010001.0 0 17 131072 131072 + 35: 0b0.010001.1 0 17 185364 185364 + 36: 0b0.010010.0 0 18 262144 262144 + 37: 0b0.010010.1 0 18 370728 370728 + 38: 0b0.010011.0 0 19 524288 524288 + 39: 0b0.010011.1 0 19 741455 741455 + 40: 0b0.010100.0 0 20 1.04858e+06 1.04858e+06 + 41: 0b0.010100.1 0 20 1.48291e+06 1.48291e+06 + 42: 0b0.010101.0 0 21 2.09715e+06 2.09715e+06 + 43: 0b0.010101.1 0 21 2.96582e+06 2.96582e+06 + 44: 0b0.010110.0 0 22 4.1943e+06 4.1943e+06 + 45: 0b0.010110.1 0 22 5.93164e+06 5.93164e+06 + 46: 0b0.010111.0 0 23 8.38861e+06 8.38861e+06 + 47: 0b0.010111.1 0 23 1.18633e+07 1.18633e+07 + 48: 0b0.011000.0 0 24 1.67772e+07 1.67772e+07 + 49: 0b0.011000.1 0 24 2.37266e+07 2.37266e+07 + 50: 0b0.011001.0 0 25 3.35544e+07 3.35544e+07 + 51: 0b0.011001.1 0 25 4.74531e+07 4.74531e+07 + 52: 0b0.011010.0 0 26 6.71089e+07 6.71089e+07 + 53: 0b0.011010.1 0 26 9.49063e+07 9.49063e+07 + 54: 0b0.011011.0 0 27 1.34218e+08 1.34218e+08 + 55: 0b0.011011.1 0 27 1.89813e+08 1.89813e+08 + 56: 0b0.011100.0 0 28 2.68435e+08 2.68435e+08 + 57: 0b0.011100.1 0 28 3.79625e+08 3.79625e+08 + 58: 0b0.011101.0 0 29 5.36871e+08 5.36871e+08 + 59: 0b0.011101.1 0 29 7.5925e+08 7.5925e+08 + 60: 0b0.011110.0 0 30 1.07374e+09 1.07374e+09 + 61: 0b0.011110.1 0 30 1.5185e+09 1.5185e+09 + 62: 0b0.011111.0 0 31 2.14748e+09 2.14748e+09 + 63: 0b0.011111.1 0 31 3.037e+09 3.037e+09 + 64: 0b0.100000.0 0 -32 0 0 + 65: 0b0.100000.1 0 -32 3.29272e-10 3.29272e-10 + 66: 0b0.100001.0 0 -31 4.65661e-10 4.65661e-10 + 67: 0b0.100001.1 0 -31 6.58545e-10 6.58545e-10 + 68: 0b0.100010.0 0 -30 9.31323e-10 9.31323e-10 + 69: 0b0.100010.1 0 -30 1.31709e-09 1.31709e-09 + 70: 0b0.100011.0 0 -29 1.86265e-09 1.86265e-09 + 71: 0b0.100011.1 0 -29 2.63418e-09 2.63418e-09 + 72: 0b0.100100.0 0 -28 3.72529e-09 3.72529e-09 + 73: 0b0.100100.1 0 -28 5.26836e-09 5.26836e-09 + 74: 0b0.100101.0 0 -27 7.45058e-09 7.45058e-09 + 75: 0b0.100101.1 0 -27 1.05367e-08 1.05367e-08 + 76: 0b0.100110.0 0 -26 1.49012e-08 1.49012e-08 + 77: 0b0.100110.1 0 -26 2.10734e-08 2.10734e-08 + 78: 0b0.100111.0 0 -25 2.98023e-08 2.98023e-08 + 79: 0b0.100111.1 0 -25 4.21468e-08 4.21468e-08 + 80: 0b0.101000.0 0 -24 5.96046e-08 5.96046e-08 + 81: 0b0.101000.1 0 -24 8.42937e-08 8.42937e-08 + 82: 0b0.101001.0 0 -23 1.19209e-07 1.19209e-07 + 83: 0b0.101001.1 0 -23 1.68587e-07 1.68587e-07 + 84: 0b0.101010.0 0 -22 2.38419e-07 2.38419e-07 + 85: 0b0.101010.1 0 -22 3.37175e-07 3.37175e-07 + 86: 0b0.101011.0 0 -21 4.76837e-07 4.76837e-07 + 87: 0b0.101011.1 0 -21 6.7435e-07 6.7435e-07 + 88: 0b0.101100.0 0 -20 9.53674e-07 9.53674e-07 + 89: 0b0.101100.1 0 -20 1.3487e-06 1.3487e-06 + 90: 0b0.101101.0 0 -19 1.90735e-06 1.90735e-06 + 91: 0b0.101101.1 0 -19 2.6974e-06 2.6974e-06 + 92: 0b0.101110.0 0 -18 3.8147e-06 3.8147e-06 + 93: 0b0.101110.1 0 -18 5.3948e-06 5.3948e-06 + 94: 0b0.101111.0 0 -17 7.62939e-06 7.62939e-06 + 95: 0b0.101111.1 0 -17 1.07896e-05 1.07896e-05 + 96: 0b0.110000.0 0 -16 1.52588e-05 1.52588e-05 + 97: 0b0.110000.1 0 -16 2.15792e-05 2.15792e-05 + 98: 0b0.110001.0 0 -15 3.05176e-05 3.05176e-05 + 99: 0b0.110001.1 0 -15 4.31584e-05 4.31584e-05 + 100: 0b0.110010.0 0 -14 6.10352e-05 6.10352e-05 + 101: 0b0.110010.1 0 -14 8.63167e-05 8.63167e-05 + 102: 0b0.110011.0 0 -13 0.00012207 0.00012207 + 103: 0b0.110011.1 0 -13 0.000172633 0.000172633 + 104: 0b0.110100.0 0 -12 0.000244141 0.000244141 + 105: 0b0.110100.1 0 -12 0.000345267 0.000345267 + 106: 0b0.110101.0 0 -11 0.000488281 0.000488281 + 107: 0b0.110101.1 0 -11 0.000690534 0.000690534 + 108: 0b0.110110.0 0 -10 0.000976562 0.000976562 + 109: 0b0.110110.1 0 -10 0.00138107 0.00138107 + 110: 0b0.110111.0 0 -9 0.00195312 0.00195312 + 111: 0b0.110111.1 0 -9 0.00276214 0.00276214 + 112: 0b0.111000.0 0 -8 0.00390625 0.00390625 + 113: 0b0.111000.1 0 -8 0.00552427 0.00552427 + 114: 0b0.111001.0 0 -7 0.0078125 0.0078125 + 115: 0b0.111001.1 0 -7 0.0110485 0.0110485 + 116: 0b0.111010.0 0 -6 0.015625 0.015625 + 117: 0b0.111010.1 0 -6 0.0220971 0.0220971 + 118: 0b0.111011.0 0 -5 0.03125 0.03125 + 119: 0b0.111011.1 0 -5 0.0441942 0.0441942 + 120: 0b0.111100.0 0 -4 0.0625 0.0625 + 121: 0b0.111100.1 0 -4 0.0883883 0.0883883 + 122: 0b0.111101.0 0 -3 0.125 0.125 + 123: 0b0.111101.1 0 -3 0.176777 0.176777 + 124: 0b0.111110.0 0 -2 0.25 0.25 + 125: 0b0.111110.1 0 -2 0.353553 0.353553 + 126: 0b0.111111.0 0 -1 0.5 0.5 + 127: 0b0.111111.1 0 -1 0.707107 0.707107 + 128: 0b1.000000.0 1 0 -1 -1 + 129: 0b1.000000.1 1 0 -1.41421 -1.41421 + 130: 0b1.000001.0 1 1 -2 -2 + 131: 0b1.000001.1 1 1 -2.82843 -2.82843 + 132: 0b1.000010.0 1 2 -4 -4 + 133: 0b1.000010.1 1 2 -5.65685 -5.65685 + 134: 0b1.000011.0 1 3 -8 -8 + 135: 0b1.000011.1 1 3 -11.3137 -11.3137 + 136: 0b1.000100.0 1 4 -16 -16 + 137: 0b1.000100.1 1 4 -22.6274 -22.6274 + 138: 0b1.000101.0 1 5 -32 -32 + 139: 0b1.000101.1 1 5 -45.2548 -45.2548 + 140: 0b1.000110.0 1 6 -64 -64 + 141: 0b1.000110.1 1 6 -90.5097 -90.5097 + 142: 0b1.000111.0 1 7 -128 -128 + 143: 0b1.000111.1 1 7 -181.019 -181.019 + 144: 0b1.001000.0 1 8 -256 -256 + 145: 0b1.001000.1 1 8 -362.039 -362.039 + 146: 0b1.001001.0 1 9 -512 -512 + 147: 0b1.001001.1 1 9 -724.077 -724.077 + 148: 0b1.001010.0 1 10 -1024 -1024 + 149: 0b1.001010.1 1 10 -1448.15 -1448.15 + 150: 0b1.001011.0 1 11 -2048 -2048 + 151: 0b1.001011.1 1 11 -2896.31 -2896.31 + 152: 0b1.001100.0 1 12 -4096 -4096 + 153: 0b1.001100.1 1 12 -5792.62 -5792.62 + 154: 0b1.001101.0 1 13 -8192 -8192 + 155: 0b1.001101.1 1 13 -11585.2 -11585.2 + 156: 0b1.001110.0 1 14 -16384 -16384 + 157: 0b1.001110.1 1 14 -23170.5 -23170.5 + 158: 0b1.001111.0 1 15 -32768 -32768 + 159: 0b1.001111.1 1 15 -46341 -46341 + 160: 0b1.010000.0 1 16 -65536 -65536 + 161: 0b1.010000.1 1 16 -92681.9 -92681.9 + 162: 0b1.010001.0 1 17 -131072 -131072 + 163: 0b1.010001.1 1 17 -185364 -185364 + 164: 0b1.010010.0 1 18 -262144 -262144 + 165: 0b1.010010.1 1 18 -370728 -370728 + 166: 0b1.010011.0 1 19 -524288 -524288 + 167: 0b1.010011.1 1 19 -741455 -741455 + 168: 0b1.010100.0 1 20 -1.04858e+06 -1.04858e+06 + 169: 0b1.010100.1 1 20 -1.48291e+06 -1.48291e+06 + 170: 0b1.010101.0 1 21 -2.09715e+06 -2.09715e+06 + 171: 0b1.010101.1 1 21 -2.96582e+06 -2.96582e+06 + 172: 0b1.010110.0 1 22 -4.1943e+06 -4.1943e+06 + 173: 0b1.010110.1 1 22 -5.93164e+06 -5.93164e+06 + 174: 0b1.010111.0 1 23 -8.38861e+06 -8.38861e+06 + 175: 0b1.010111.1 1 23 -1.18633e+07 -1.18633e+07 + 176: 0b1.011000.0 1 24 -1.67772e+07 -1.67772e+07 + 177: 0b1.011000.1 1 24 -2.37266e+07 -2.37266e+07 + 178: 0b1.011001.0 1 25 -3.35544e+07 -3.35544e+07 + 179: 0b1.011001.1 1 25 -4.74531e+07 -4.74531e+07 + 180: 0b1.011010.0 1 26 -6.71089e+07 -6.71089e+07 + 181: 0b1.011010.1 1 26 -9.49063e+07 -9.49063e+07 + 182: 0b1.011011.0 1 27 -1.34218e+08 -1.34218e+08 + 183: 0b1.011011.1 1 27 -1.89813e+08 -1.89813e+08 + 184: 0b1.011100.0 1 28 -2.68435e+08 -2.68435e+08 + 185: 0b1.011100.1 1 28 -3.79625e+08 -3.79625e+08 + 186: 0b1.011101.0 1 29 -5.36871e+08 -5.36871e+08 + 187: 0b1.011101.1 1 29 -7.5925e+08 -7.5925e+08 + 188: 0b1.011110.0 1 30 -1.07374e+09 -1.07374e+09 + 189: 0b1.011110.1 1 30 -1.5185e+09 -1.5185e+09 + 190: 0b1.011111.0 1 31 -2.14748e+09 -2.14748e+09 + 191: 0b1.011111.1 1 31 -3.037e+09 -3.037e+09 + 192: 0b1.100000.0 1 -32 -nan(ind) -nan(ind) + 193: 0b1.100000.1 1 -32 -3.29272e-10 -3.29272e-10 + 194: 0b1.100001.0 1 -31 -4.65661e-10 -4.65661e-10 + 195: 0b1.100001.1 1 -31 -6.58545e-10 -6.58545e-10 + 196: 0b1.100010.0 1 -30 -9.31323e-10 -9.31323e-10 + 197: 0b1.100010.1 1 -30 -1.31709e-09 -1.31709e-09 + 198: 0b1.100011.0 1 -29 -1.86265e-09 -1.86265e-09 + 199: 0b1.100011.1 1 -29 -2.63418e-09 -2.63418e-09 + 200: 0b1.100100.0 1 -28 -3.72529e-09 -3.72529e-09 + 201: 0b1.100100.1 1 -28 -5.26836e-09 -5.26836e-09 + 202: 0b1.100101.0 1 -27 -7.45058e-09 -7.45058e-09 + 203: 0b1.100101.1 1 -27 -1.05367e-08 -1.05367e-08 + 204: 0b1.100110.0 1 -26 -1.49012e-08 -1.49012e-08 + 205: 0b1.100110.1 1 -26 -2.10734e-08 -2.10734e-08 + 206: 0b1.100111.0 1 -25 -2.98023e-08 -2.98023e-08 + 207: 0b1.100111.1 1 -25 -4.21468e-08 -4.21468e-08 + 208: 0b1.101000.0 1 -24 -5.96046e-08 -5.96046e-08 + 209: 0b1.101000.1 1 -24 -8.42937e-08 -8.42937e-08 + 210: 0b1.101001.0 1 -23 -1.19209e-07 -1.19209e-07 + 211: 0b1.101001.1 1 -23 -1.68587e-07 -1.68587e-07 + 212: 0b1.101010.0 1 -22 -2.38419e-07 -2.38419e-07 + 213: 0b1.101010.1 1 -22 -3.37175e-07 -3.37175e-07 + 214: 0b1.101011.0 1 -21 -4.76837e-07 -4.76837e-07 + 215: 0b1.101011.1 1 -21 -6.7435e-07 -6.7435e-07 + 216: 0b1.101100.0 1 -20 -9.53674e-07 -9.53674e-07 + 217: 0b1.101100.1 1 -20 -1.3487e-06 -1.3487e-06 + 218: 0b1.101101.0 1 -19 -1.90735e-06 -1.90735e-06 + 219: 0b1.101101.1 1 -19 -2.6974e-06 -2.6974e-06 + 220: 0b1.101110.0 1 -18 -3.8147e-06 -3.8147e-06 + 221: 0b1.101110.1 1 -18 -5.3948e-06 -5.3948e-06 + 222: 0b1.101111.0 1 -17 -7.62939e-06 -7.62939e-06 + 223: 0b1.101111.1 1 -17 -1.07896e-05 -1.07896e-05 + 224: 0b1.110000.0 1 -16 -1.52588e-05 -1.52588e-05 + 225: 0b1.110000.1 1 -16 -2.15792e-05 -2.15792e-05 + 226: 0b1.110001.0 1 -15 -3.05176e-05 -3.05176e-05 + 227: 0b1.110001.1 1 -15 -4.31584e-05 -4.31584e-05 + 228: 0b1.110010.0 1 -14 -6.10352e-05 -6.10352e-05 + 229: 0b1.110010.1 1 -14 -8.63167e-05 -8.63167e-05 + 230: 0b1.110011.0 1 -13 -0.00012207 -0.00012207 + 231: 0b1.110011.1 1 -13 -0.000172633 -0.000172633 + 232: 0b1.110100.0 1 -12 -0.000244141 -0.000244141 + 233: 0b1.110100.1 1 -12 -0.000345267 -0.000345267 + 234: 0b1.110101.0 1 -11 -0.000488281 -0.000488281 + 235: 0b1.110101.1 1 -11 -0.000690534 -0.000690534 + 236: 0b1.110110.0 1 -10 -0.000976562 -0.000976562 + 237: 0b1.110110.1 1 -10 -0.00138107 -0.00138107 + 238: 0b1.110111.0 1 -9 -0.00195312 -0.00195312 + 239: 0b1.110111.1 1 -9 -0.00276214 -0.00276214 + 240: 0b1.111000.0 1 -8 -0.00390625 -0.00390625 + 241: 0b1.111000.1 1 -8 -0.00552427 -0.00552427 + 242: 0b1.111001.0 1 -7 -0.0078125 -0.0078125 + 243: 0b1.111001.1 1 -7 -0.0110485 -0.0110485 + 244: 0b1.111010.0 1 -6 -0.015625 -0.015625 + 245: 0b1.111010.1 1 -6 -0.0220971 -0.0220971 + 246: 0b1.111011.0 1 -5 -0.03125 -0.03125 + 247: 0b1.111011.1 1 -5 -0.0441942 -0.0441942 + 248: 0b1.111100.0 1 -4 -0.0625 -0.0625 + 249: 0b1.111100.1 1 -4 -0.0883883 -0.0883883 + 250: 0b1.111101.0 1 -3 -0.125 -0.125 + 251: 0b1.111101.1 1 -3 -0.176777 -0.176777 + 252: 0b1.111110.0 1 -2 -0.25 -0.25 + 253: 0b1.111110.1 1 -2 -0.353553 -0.353553 + 254: 0b1.111111.0 1 -1 -0.5 -0.5 + 255: 0b1.111111.1 1 -1 -0.707107 -0.707107 +Generate Value table for an LNS<8,2> in TXT format + # Binary sign scale value format + 0: 0b0.00000.00 0 0 1 1 + 1: 0b0.00000.01 0 0 1.18921 1.18921 + 2: 0b0.00000.10 0 0 1.41421 1.41421 + 3: 0b0.00000.11 0 0 1.68179 1.68179 + 4: 0b0.00001.00 0 1 2 2 + 5: 0b0.00001.01 0 1 2.37841 2.37841 + 6: 0b0.00001.10 0 1 2.82843 2.82843 + 7: 0b0.00001.11 0 1 3.36359 3.36359 + 8: 0b0.00010.00 0 2 4 4 + 9: 0b0.00010.01 0 2 4.75683 4.75683 + 10: 0b0.00010.10 0 2 5.65685 5.65685 + 11: 0b0.00010.11 0 2 6.72717 6.72717 + 12: 0b0.00011.00 0 3 8 8 + 13: 0b0.00011.01 0 3 9.51366 9.51366 + 14: 0b0.00011.10 0 3 11.3137 11.3137 + 15: 0b0.00011.11 0 3 13.4543 13.4543 + 16: 0b0.00100.00 0 4 16 16 + 17: 0b0.00100.01 0 4 19.0273 19.0273 + 18: 0b0.00100.10 0 4 22.6274 22.6274 + 19: 0b0.00100.11 0 4 26.9087 26.9087 + 20: 0b0.00101.00 0 5 32 32 + 21: 0b0.00101.01 0 5 38.0546 38.0546 + 22: 0b0.00101.10 0 5 45.2548 45.2548 + 23: 0b0.00101.11 0 5 53.8174 53.8174 + 24: 0b0.00110.00 0 6 64 64 + 25: 0b0.00110.01 0 6 76.1093 76.1093 + 26: 0b0.00110.10 0 6 90.5097 90.5097 + 27: 0b0.00110.11 0 6 107.635 107.635 + 28: 0b0.00111.00 0 7 128 128 + 29: 0b0.00111.01 0 7 152.219 152.219 + 30: 0b0.00111.10 0 7 181.019 181.019 + 31: 0b0.00111.11 0 7 215.269 215.269 + 32: 0b0.01000.00 0 8 256 256 + 33: 0b0.01000.01 0 8 304.437 304.437 + 34: 0b0.01000.10 0 8 362.039 362.039 + 35: 0b0.01000.11 0 8 430.539 430.539 + 36: 0b0.01001.00 0 9 512 512 + 37: 0b0.01001.01 0 9 608.874 608.874 + 38: 0b0.01001.10 0 9 724.077 724.077 + 39: 0b0.01001.11 0 9 861.078 861.078 + 40: 0b0.01010.00 0 10 1024 1024 + 41: 0b0.01010.01 0 10 1217.75 1217.75 + 42: 0b0.01010.10 0 10 1448.15 1448.15 + 43: 0b0.01010.11 0 10 1722.16 1722.16 + 44: 0b0.01011.00 0 11 2048 2048 + 45: 0b0.01011.01 0 11 2435.5 2435.5 + 46: 0b0.01011.10 0 11 2896.31 2896.31 + 47: 0b0.01011.11 0 11 3444.31 3444.31 + 48: 0b0.01100.00 0 12 4096 4096 + 49: 0b0.01100.01 0 12 4870.99 4870.99 + 50: 0b0.01100.10 0 12 5792.62 5792.62 + 51: 0b0.01100.11 0 12 6888.62 6888.62 + 52: 0b0.01101.00 0 13 8192 8192 + 53: 0b0.01101.01 0 13 9741.98 9741.98 + 54: 0b0.01101.10 0 13 11585.2 11585.2 + 55: 0b0.01101.11 0 13 13777.2 13777.2 + 56: 0b0.01110.00 0 14 16384 16384 + 57: 0b0.01110.01 0 14 19484 19484 + 58: 0b0.01110.10 0 14 23170.5 23170.5 + 59: 0b0.01110.11 0 14 27554.5 27554.5 + 60: 0b0.01111.00 0 15 32768 32768 + 61: 0b0.01111.01 0 15 38967.9 38967.9 + 62: 0b0.01111.10 0 15 46341 46341 + 63: 0b0.01111.11 0 15 55109 55109 + 64: 0b0.10000.00 0 -16 0 0 + 65: 0b0.10000.01 0 -16 1.81459e-05 1.81459e-05 + 66: 0b0.10000.10 0 -16 2.15792e-05 2.15792e-05 + 67: 0b0.10000.11 0 -16 2.56621e-05 2.56621e-05 + 68: 0b0.10001.00 0 -15 3.05176e-05 3.05176e-05 + 69: 0b0.10001.01 0 -15 3.62917e-05 3.62917e-05 + 70: 0b0.10001.10 0 -15 4.31584e-05 4.31584e-05 + 71: 0b0.10001.11 0 -15 5.13242e-05 5.13242e-05 + 72: 0b0.10010.00 0 -14 6.10352e-05 6.10352e-05 + 73: 0b0.10010.01 0 -14 7.25834e-05 7.25834e-05 + 74: 0b0.10010.10 0 -14 8.63167e-05 8.63167e-05 + 75: 0b0.10010.11 0 -14 0.000102648 0.000102648 + 76: 0b0.10011.00 0 -13 0.00012207 0.00012207 + 77: 0b0.10011.01 0 -13 0.000145167 0.000145167 + 78: 0b0.10011.10 0 -13 0.000172633 0.000172633 + 79: 0b0.10011.11 0 -13 0.000205297 0.000205297 + 80: 0b0.10100.00 0 -12 0.000244141 0.000244141 + 81: 0b0.10100.01 0 -12 0.000290334 0.000290334 + 82: 0b0.10100.10 0 -12 0.000345267 0.000345267 + 83: 0b0.10100.11 0 -12 0.000410594 0.000410594 + 84: 0b0.10101.00 0 -11 0.000488281 0.000488281 + 85: 0b0.10101.01 0 -11 0.000580668 0.000580668 + 86: 0b0.10101.10 0 -11 0.000690534 0.000690534 + 87: 0b0.10101.11 0 -11 0.000821188 0.000821188 + 88: 0b0.10110.00 0 -10 0.000976562 0.000976562 + 89: 0b0.10110.01 0 -10 0.00116134 0.00116134 + 90: 0b0.10110.10 0 -10 0.00138107 0.00138107 + 91: 0b0.10110.11 0 -10 0.00164238 0.00164238 + 92: 0b0.10111.00 0 -9 0.00195312 0.00195312 + 93: 0b0.10111.01 0 -9 0.00232267 0.00232267 + 94: 0b0.10111.10 0 -9 0.00276214 0.00276214 + 95: 0b0.10111.11 0 -9 0.00328475 0.00328475 + 96: 0b0.11000.00 0 -8 0.00390625 0.00390625 + 97: 0b0.11000.01 0 -8 0.00464534 0.00464534 + 98: 0b0.11000.10 0 -8 0.00552427 0.00552427 + 99: 0b0.11000.11 0 -8 0.0065695 0.0065695 + 100: 0b0.11001.00 0 -7 0.0078125 0.0078125 + 101: 0b0.11001.01 0 -7 0.00929068 0.00929068 + 102: 0b0.11001.10 0 -7 0.0110485 0.0110485 + 103: 0b0.11001.11 0 -7 0.013139 0.013139 + 104: 0b0.11010.00 0 -6 0.015625 0.015625 + 105: 0b0.11010.01 0 -6 0.0185814 0.0185814 + 106: 0b0.11010.10 0 -6 0.0220971 0.0220971 + 107: 0b0.11010.11 0 -6 0.026278 0.026278 + 108: 0b0.11011.00 0 -5 0.03125 0.03125 + 109: 0b0.11011.01 0 -5 0.0371627 0.0371627 + 110: 0b0.11011.10 0 -5 0.0441942 0.0441942 + 111: 0b0.11011.11 0 -5 0.052556 0.052556 + 112: 0b0.11100.00 0 -4 0.0625 0.0625 + 113: 0b0.11100.01 0 -4 0.0743254 0.0743254 + 114: 0b0.11100.10 0 -4 0.0883883 0.0883883 + 115: 0b0.11100.11 0 -4 0.105112 0.105112 + 116: 0b0.11101.00 0 -3 0.125 0.125 + 117: 0b0.11101.01 0 -3 0.148651 0.148651 + 118: 0b0.11101.10 0 -3 0.176777 0.176777 + 119: 0b0.11101.11 0 -3 0.210224 0.210224 + 120: 0b0.11110.00 0 -2 0.25 0.25 + 121: 0b0.11110.01 0 -2 0.297302 0.297302 + 122: 0b0.11110.10 0 -2 0.353553 0.353553 + 123: 0b0.11110.11 0 -2 0.420448 0.420448 + 124: 0b0.11111.00 0 -1 0.5 0.5 + 125: 0b0.11111.01 0 -1 0.594604 0.594604 + 126: 0b0.11111.10 0 -1 0.707107 0.707107 + 127: 0b0.11111.11 0 -1 0.840896 0.840896 + 128: 0b1.00000.00 1 0 -1 -1 + 129: 0b1.00000.01 1 0 -1.18921 -1.18921 + 130: 0b1.00000.10 1 0 -1.41421 -1.41421 + 131: 0b1.00000.11 1 0 -1.68179 -1.68179 + 132: 0b1.00001.00 1 1 -2 -2 + 133: 0b1.00001.01 1 1 -2.37841 -2.37841 + 134: 0b1.00001.10 1 1 -2.82843 -2.82843 + 135: 0b1.00001.11 1 1 -3.36359 -3.36359 + 136: 0b1.00010.00 1 2 -4 -4 + 137: 0b1.00010.01 1 2 -4.75683 -4.75683 + 138: 0b1.00010.10 1 2 -5.65685 -5.65685 + 139: 0b1.00010.11 1 2 -6.72717 -6.72717 + 140: 0b1.00011.00 1 3 -8 -8 + 141: 0b1.00011.01 1 3 -9.51366 -9.51366 + 142: 0b1.00011.10 1 3 -11.3137 -11.3137 + 143: 0b1.00011.11 1 3 -13.4543 -13.4543 + 144: 0b1.00100.00 1 4 -16 -16 + 145: 0b1.00100.01 1 4 -19.0273 -19.0273 + 146: 0b1.00100.10 1 4 -22.6274 -22.6274 + 147: 0b1.00100.11 1 4 -26.9087 -26.9087 + 148: 0b1.00101.00 1 5 -32 -32 + 149: 0b1.00101.01 1 5 -38.0546 -38.0546 + 150: 0b1.00101.10 1 5 -45.2548 -45.2548 + 151: 0b1.00101.11 1 5 -53.8174 -53.8174 + 152: 0b1.00110.00 1 6 -64 -64 + 153: 0b1.00110.01 1 6 -76.1093 -76.1093 + 154: 0b1.00110.10 1 6 -90.5097 -90.5097 + 155: 0b1.00110.11 1 6 -107.635 -107.635 + 156: 0b1.00111.00 1 7 -128 -128 + 157: 0b1.00111.01 1 7 -152.219 -152.219 + 158: 0b1.00111.10 1 7 -181.019 -181.019 + 159: 0b1.00111.11 1 7 -215.269 -215.269 + 160: 0b1.01000.00 1 8 -256 -256 + 161: 0b1.01000.01 1 8 -304.437 -304.437 + 162: 0b1.01000.10 1 8 -362.039 -362.039 + 163: 0b1.01000.11 1 8 -430.539 -430.539 + 164: 0b1.01001.00 1 9 -512 -512 + 165: 0b1.01001.01 1 9 -608.874 -608.874 + 166: 0b1.01001.10 1 9 -724.077 -724.077 + 167: 0b1.01001.11 1 9 -861.078 -861.078 + 168: 0b1.01010.00 1 10 -1024 -1024 + 169: 0b1.01010.01 1 10 -1217.75 -1217.75 + 170: 0b1.01010.10 1 10 -1448.15 -1448.15 + 171: 0b1.01010.11 1 10 -1722.16 -1722.16 + 172: 0b1.01011.00 1 11 -2048 -2048 + 173: 0b1.01011.01 1 11 -2435.5 -2435.5 + 174: 0b1.01011.10 1 11 -2896.31 -2896.31 + 175: 0b1.01011.11 1 11 -3444.31 -3444.31 + 176: 0b1.01100.00 1 12 -4096 -4096 + 177: 0b1.01100.01 1 12 -4870.99 -4870.99 + 178: 0b1.01100.10 1 12 -5792.62 -5792.62 + 179: 0b1.01100.11 1 12 -6888.62 -6888.62 + 180: 0b1.01101.00 1 13 -8192 -8192 + 181: 0b1.01101.01 1 13 -9741.98 -9741.98 + 182: 0b1.01101.10 1 13 -11585.2 -11585.2 + 183: 0b1.01101.11 1 13 -13777.2 -13777.2 + 184: 0b1.01110.00 1 14 -16384 -16384 + 185: 0b1.01110.01 1 14 -19484 -19484 + 186: 0b1.01110.10 1 14 -23170.5 -23170.5 + 187: 0b1.01110.11 1 14 -27554.5 -27554.5 + 188: 0b1.01111.00 1 15 -32768 -32768 + 189: 0b1.01111.01 1 15 -38967.9 -38967.9 + 190: 0b1.01111.10 1 15 -46341 -46341 + 191: 0b1.01111.11 1 15 -55109 -55109 + 192: 0b1.10000.00 1 -16 -nan(ind) -nan(ind) + 193: 0b1.10000.01 1 -16 -1.81459e-05 -1.81459e-05 + 194: 0b1.10000.10 1 -16 -2.15792e-05 -2.15792e-05 + 195: 0b1.10000.11 1 -16 -2.56621e-05 -2.56621e-05 + 196: 0b1.10001.00 1 -15 -3.05176e-05 -3.05176e-05 + 197: 0b1.10001.01 1 -15 -3.62917e-05 -3.62917e-05 + 198: 0b1.10001.10 1 -15 -4.31584e-05 -4.31584e-05 + 199: 0b1.10001.11 1 -15 -5.13242e-05 -5.13242e-05 + 200: 0b1.10010.00 1 -14 -6.10352e-05 -6.10352e-05 + 201: 0b1.10010.01 1 -14 -7.25834e-05 -7.25834e-05 + 202: 0b1.10010.10 1 -14 -8.63167e-05 -8.63167e-05 + 203: 0b1.10010.11 1 -14 -0.000102648 -0.000102648 + 204: 0b1.10011.00 1 -13 -0.00012207 -0.00012207 + 205: 0b1.10011.01 1 -13 -0.000145167 -0.000145167 + 206: 0b1.10011.10 1 -13 -0.000172633 -0.000172633 + 207: 0b1.10011.11 1 -13 -0.000205297 -0.000205297 + 208: 0b1.10100.00 1 -12 -0.000244141 -0.000244141 + 209: 0b1.10100.01 1 -12 -0.000290334 -0.000290334 + 210: 0b1.10100.10 1 -12 -0.000345267 -0.000345267 + 211: 0b1.10100.11 1 -12 -0.000410594 -0.000410594 + 212: 0b1.10101.00 1 -11 -0.000488281 -0.000488281 + 213: 0b1.10101.01 1 -11 -0.000580668 -0.000580668 + 214: 0b1.10101.10 1 -11 -0.000690534 -0.000690534 + 215: 0b1.10101.11 1 -11 -0.000821188 -0.000821188 + 216: 0b1.10110.00 1 -10 -0.000976562 -0.000976562 + 217: 0b1.10110.01 1 -10 -0.00116134 -0.00116134 + 218: 0b1.10110.10 1 -10 -0.00138107 -0.00138107 + 219: 0b1.10110.11 1 -10 -0.00164238 -0.00164238 + 220: 0b1.10111.00 1 -9 -0.00195312 -0.00195312 + 221: 0b1.10111.01 1 -9 -0.00232267 -0.00232267 + 222: 0b1.10111.10 1 -9 -0.00276214 -0.00276214 + 223: 0b1.10111.11 1 -9 -0.00328475 -0.00328475 + 224: 0b1.11000.00 1 -8 -0.00390625 -0.00390625 + 225: 0b1.11000.01 1 -8 -0.00464534 -0.00464534 + 226: 0b1.11000.10 1 -8 -0.00552427 -0.00552427 + 227: 0b1.11000.11 1 -8 -0.0065695 -0.0065695 + 228: 0b1.11001.00 1 -7 -0.0078125 -0.0078125 + 229: 0b1.11001.01 1 -7 -0.00929068 -0.00929068 + 230: 0b1.11001.10 1 -7 -0.0110485 -0.0110485 + 231: 0b1.11001.11 1 -7 -0.013139 -0.013139 + 232: 0b1.11010.00 1 -6 -0.015625 -0.015625 + 233: 0b1.11010.01 1 -6 -0.0185814 -0.0185814 + 234: 0b1.11010.10 1 -6 -0.0220971 -0.0220971 + 235: 0b1.11010.11 1 -6 -0.026278 -0.026278 + 236: 0b1.11011.00 1 -5 -0.03125 -0.03125 + 237: 0b1.11011.01 1 -5 -0.0371627 -0.0371627 + 238: 0b1.11011.10 1 -5 -0.0441942 -0.0441942 + 239: 0b1.11011.11 1 -5 -0.052556 -0.052556 + 240: 0b1.11100.00 1 -4 -0.0625 -0.0625 + 241: 0b1.11100.01 1 -4 -0.0743254 -0.0743254 + 242: 0b1.11100.10 1 -4 -0.0883883 -0.0883883 + 243: 0b1.11100.11 1 -4 -0.105112 -0.105112 + 244: 0b1.11101.00 1 -3 -0.125 -0.125 + 245: 0b1.11101.01 1 -3 -0.148651 -0.148651 + 246: 0b1.11101.10 1 -3 -0.176777 -0.176777 + 247: 0b1.11101.11 1 -3 -0.210224 -0.210224 + 248: 0b1.11110.00 1 -2 -0.25 -0.25 + 249: 0b1.11110.01 1 -2 -0.297302 -0.297302 + 250: 0b1.11110.10 1 -2 -0.353553 -0.353553 + 251: 0b1.11110.11 1 -2 -0.420448 -0.420448 + 252: 0b1.11111.00 1 -1 -0.5 -0.5 + 253: 0b1.11111.01 1 -1 -0.594604 -0.594604 + 254: 0b1.11111.10 1 -1 -0.707107 -0.707107 + 255: 0b1.11111.11 1 -1 -0.840896 -0.840896 +Generate Value table for an LNS<8,3> in TXT format + # Binary sign scale value format + 0: 0b0.0000.000 0 0 1 1 + 1: 0b0.0000.001 0 0 1.09051 1.09051 + 2: 0b0.0000.010 0 0 1.18921 1.18921 + 3: 0b0.0000.011 0 0 1.29684 1.29684 + 4: 0b0.0000.100 0 0 1.41421 1.41421 + 5: 0b0.0000.101 0 0 1.54221 1.54221 + 6: 0b0.0000.110 0 0 1.68179 1.68179 + 7: 0b0.0000.111 0 0 1.83401 1.83401 + 8: 0b0.0001.000 0 1 2 2 + 9: 0b0.0001.001 0 1 2.18102 2.18102 + 10: 0b0.0001.010 0 1 2.37841 2.37841 + 11: 0b0.0001.011 0 1 2.59368 2.59368 + 12: 0b0.0001.100 0 1 2.82843 2.82843 + 13: 0b0.0001.101 0 1 3.08442 3.08442 + 14: 0b0.0001.110 0 1 3.36359 3.36359 + 15: 0b0.0001.111 0 1 3.66802 3.66802 + 16: 0b0.0010.000 0 2 4 4 + 17: 0b0.0010.001 0 2 4.36203 4.36203 + 18: 0b0.0010.010 0 2 4.75683 4.75683 + 19: 0b0.0010.011 0 2 5.18736 5.18736 + 20: 0b0.0010.100 0 2 5.65685 5.65685 + 21: 0b0.0010.101 0 2 6.16884 6.16884 + 22: 0b0.0010.110 0 2 6.72717 6.72717 + 23: 0b0.0010.111 0 2 7.33603 7.33603 + 24: 0b0.0011.000 0 3 8 8 + 25: 0b0.0011.001 0 3 8.72406 8.72406 + 26: 0b0.0011.010 0 3 9.51366 9.51366 + 27: 0b0.0011.011 0 3 10.3747 10.3747 + 28: 0b0.0011.100 0 3 11.3137 11.3137 + 29: 0b0.0011.101 0 3 12.3377 12.3377 + 30: 0b0.0011.110 0 3 13.4543 13.4543 + 31: 0b0.0011.111 0 3 14.6721 14.6721 + 32: 0b0.0100.000 0 4 16 16 + 33: 0b0.0100.001 0 4 17.4481 17.4481 + 34: 0b0.0100.010 0 4 19.0273 19.0273 + 35: 0b0.0100.011 0 4 20.7494 20.7494 + 36: 0b0.0100.100 0 4 22.6274 22.6274 + 37: 0b0.0100.101 0 4 24.6754 24.6754 + 38: 0b0.0100.110 0 4 26.9087 26.9087 + 39: 0b0.0100.111 0 4 29.3441 29.3441 + 40: 0b0.0101.000 0 5 32 32 + 41: 0b0.0101.001 0 5 34.8962 34.8962 + 42: 0b0.0101.010 0 5 38.0546 38.0546 + 43: 0b0.0101.011 0 5 41.4989 41.4989 + 44: 0b0.0101.100 0 5 45.2548 45.2548 + 45: 0b0.0101.101 0 5 49.3507 49.3507 + 46: 0b0.0101.110 0 5 53.8174 53.8174 + 47: 0b0.0101.111 0 5 58.6883 58.6883 + 48: 0b0.0110.000 0 6 64 64 + 49: 0b0.0110.001 0 6 69.7925 69.7925 + 50: 0b0.0110.010 0 6 76.1093 76.1093 + 51: 0b0.0110.011 0 6 82.9977 82.9977 + 52: 0b0.0110.100 0 6 90.5097 90.5097 + 53: 0b0.0110.101 0 6 98.7015 98.7015 + 54: 0b0.0110.110 0 6 107.635 107.635 + 55: 0b0.0110.111 0 6 117.377 117.377 + 56: 0b0.0111.000 0 7 128 128 + 57: 0b0.0111.001 0 7 139.585 139.585 + 58: 0b0.0111.010 0 7 152.219 152.219 + 59: 0b0.0111.011 0 7 165.995 165.995 + 60: 0b0.0111.100 0 7 181.019 181.019 + 61: 0b0.0111.101 0 7 197.403 197.403 + 62: 0b0.0111.110 0 7 215.269 215.269 + 63: 0b0.0111.111 0 7 234.753 234.753 + 64: 0b0.1000.000 0 -8 0 0 + 65: 0b0.1000.001 0 -8 0.0042598 0.0042598 + 66: 0b0.1000.010 0 -8 0.00464534 0.00464534 + 67: 0b0.1000.011 0 -8 0.00506578 0.00506578 + 68: 0b0.1000.100 0 -8 0.00552427 0.00552427 + 69: 0b0.1000.101 0 -8 0.00602426 0.00602426 + 70: 0b0.1000.110 0 -8 0.0065695 0.0065695 + 71: 0b0.1000.111 0 -8 0.00716409 0.00716409 + 72: 0b0.1001.000 0 -7 0.0078125 0.0078125 + 73: 0b0.1001.001 0 -7 0.00851959 0.00851959 + 74: 0b0.1001.010 0 -7 0.00929068 0.00929068 + 75: 0b0.1001.011 0 -7 0.0101316 0.0101316 + 76: 0b0.1001.100 0 -7 0.0110485 0.0110485 + 77: 0b0.1001.101 0 -7 0.0120485 0.0120485 + 78: 0b0.1001.110 0 -7 0.013139 0.013139 + 79: 0b0.1001.111 0 -7 0.0143282 0.0143282 + 80: 0b0.1010.000 0 -6 0.015625 0.015625 + 81: 0b0.1010.001 0 -6 0.0170392 0.0170392 + 82: 0b0.1010.010 0 -6 0.0185814 0.0185814 + 83: 0b0.1010.011 0 -6 0.0202631 0.0202631 + 84: 0b0.1010.100 0 -6 0.0220971 0.0220971 + 85: 0b0.1010.101 0 -6 0.024097 0.024097 + 86: 0b0.1010.110 0 -6 0.026278 0.026278 + 87: 0b0.1010.111 0 -6 0.0286564 0.0286564 + 88: 0b0.1011.000 0 -5 0.03125 0.03125 + 89: 0b0.1011.001 0 -5 0.0340784 0.0340784 + 90: 0b0.1011.010 0 -5 0.0371627 0.0371627 + 91: 0b0.1011.011 0 -5 0.0405262 0.0405262 + 92: 0b0.1011.100 0 -5 0.0441942 0.0441942 + 93: 0b0.1011.101 0 -5 0.0481941 0.0481941 + 94: 0b0.1011.110 0 -5 0.052556 0.052556 + 95: 0b0.1011.111 0 -5 0.0573128 0.0573128 + 96: 0b0.1100.000 0 -4 0.0625 0.0625 + 97: 0b0.1100.001 0 -4 0.0681567 0.0681567 + 98: 0b0.1100.010 0 -4 0.0743254 0.0743254 + 99: 0b0.1100.011 0 -4 0.0810525 0.0810525 + 100: 0b0.1100.100 0 -4 0.0883883 0.0883883 + 101: 0b0.1100.101 0 -4 0.0963882 0.0963882 + 102: 0b0.1100.110 0 -4 0.105112 0.105112 + 103: 0b0.1100.111 0 -4 0.114626 0.114626 + 104: 0b0.1101.000 0 -3 0.125 0.125 + 105: 0b0.1101.001 0 -3 0.136313 0.136313 + 106: 0b0.1101.010 0 -3 0.148651 0.148651 + 107: 0b0.1101.011 0 -3 0.162105 0.162105 + 108: 0b0.1101.100 0 -3 0.176777 0.176777 + 109: 0b0.1101.101 0 -3 0.192776 0.192776 + 110: 0b0.1101.110 0 -3 0.210224 0.210224 + 111: 0b0.1101.111 0 -3 0.229251 0.229251 + 112: 0b0.1110.000 0 -2 0.25 0.25 + 113: 0b0.1110.001 0 -2 0.272627 0.272627 + 114: 0b0.1110.010 0 -2 0.297302 0.297302 + 115: 0b0.1110.011 0 -2 0.32421 0.32421 + 116: 0b0.1110.100 0 -2 0.353553 0.353553 + 117: 0b0.1110.101 0 -2 0.385553 0.385553 + 118: 0b0.1110.110 0 -2 0.420448 0.420448 + 119: 0b0.1110.111 0 -2 0.458502 0.458502 + 120: 0b0.1111.000 0 -1 0.5 0.5 + 121: 0b0.1111.001 0 -1 0.545254 0.545254 + 122: 0b0.1111.010 0 -1 0.594604 0.594604 + 123: 0b0.1111.011 0 -1 0.64842 0.64842 + 124: 0b0.1111.100 0 -1 0.707107 0.707107 + 125: 0b0.1111.101 0 -1 0.771105 0.771105 + 126: 0b0.1111.110 0 -1 0.840896 0.840896 + 127: 0b0.1111.111 0 -1 0.917004 0.917004 + 128: 0b1.0000.000 1 0 -1 -1 + 129: 0b1.0000.001 1 0 -1.09051 -1.09051 + 130: 0b1.0000.010 1 0 -1.18921 -1.18921 + 131: 0b1.0000.011 1 0 -1.29684 -1.29684 + 132: 0b1.0000.100 1 0 -1.41421 -1.41421 + 133: 0b1.0000.101 1 0 -1.54221 -1.54221 + 134: 0b1.0000.110 1 0 -1.68179 -1.68179 + 135: 0b1.0000.111 1 0 -1.83401 -1.83401 + 136: 0b1.0001.000 1 1 -2 -2 + 137: 0b1.0001.001 1 1 -2.18102 -2.18102 + 138: 0b1.0001.010 1 1 -2.37841 -2.37841 + 139: 0b1.0001.011 1 1 -2.59368 -2.59368 + 140: 0b1.0001.100 1 1 -2.82843 -2.82843 + 141: 0b1.0001.101 1 1 -3.08442 -3.08442 + 142: 0b1.0001.110 1 1 -3.36359 -3.36359 + 143: 0b1.0001.111 1 1 -3.66802 -3.66802 + 144: 0b1.0010.000 1 2 -4 -4 + 145: 0b1.0010.001 1 2 -4.36203 -4.36203 + 146: 0b1.0010.010 1 2 -4.75683 -4.75683 + 147: 0b1.0010.011 1 2 -5.18736 -5.18736 + 148: 0b1.0010.100 1 2 -5.65685 -5.65685 + 149: 0b1.0010.101 1 2 -6.16884 -6.16884 + 150: 0b1.0010.110 1 2 -6.72717 -6.72717 + 151: 0b1.0010.111 1 2 -7.33603 -7.33603 + 152: 0b1.0011.000 1 3 -8 -8 + 153: 0b1.0011.001 1 3 -8.72406 -8.72406 + 154: 0b1.0011.010 1 3 -9.51366 -9.51366 + 155: 0b1.0011.011 1 3 -10.3747 -10.3747 + 156: 0b1.0011.100 1 3 -11.3137 -11.3137 + 157: 0b1.0011.101 1 3 -12.3377 -12.3377 + 158: 0b1.0011.110 1 3 -13.4543 -13.4543 + 159: 0b1.0011.111 1 3 -14.6721 -14.6721 + 160: 0b1.0100.000 1 4 -16 -16 + 161: 0b1.0100.001 1 4 -17.4481 -17.4481 + 162: 0b1.0100.010 1 4 -19.0273 -19.0273 + 163: 0b1.0100.011 1 4 -20.7494 -20.7494 + 164: 0b1.0100.100 1 4 -22.6274 -22.6274 + 165: 0b1.0100.101 1 4 -24.6754 -24.6754 + 166: 0b1.0100.110 1 4 -26.9087 -26.9087 + 167: 0b1.0100.111 1 4 -29.3441 -29.3441 + 168: 0b1.0101.000 1 5 -32 -32 + 169: 0b1.0101.001 1 5 -34.8962 -34.8962 + 170: 0b1.0101.010 1 5 -38.0546 -38.0546 + 171: 0b1.0101.011 1 5 -41.4989 -41.4989 + 172: 0b1.0101.100 1 5 -45.2548 -45.2548 + 173: 0b1.0101.101 1 5 -49.3507 -49.3507 + 174: 0b1.0101.110 1 5 -53.8174 -53.8174 + 175: 0b1.0101.111 1 5 -58.6883 -58.6883 + 176: 0b1.0110.000 1 6 -64 -64 + 177: 0b1.0110.001 1 6 -69.7925 -69.7925 + 178: 0b1.0110.010 1 6 -76.1093 -76.1093 + 179: 0b1.0110.011 1 6 -82.9977 -82.9977 + 180: 0b1.0110.100 1 6 -90.5097 -90.5097 + 181: 0b1.0110.101 1 6 -98.7015 -98.7015 + 182: 0b1.0110.110 1 6 -107.635 -107.635 + 183: 0b1.0110.111 1 6 -117.377 -117.377 + 184: 0b1.0111.000 1 7 -128 -128 + 185: 0b1.0111.001 1 7 -139.585 -139.585 + 186: 0b1.0111.010 1 7 -152.219 -152.219 + 187: 0b1.0111.011 1 7 -165.995 -165.995 + 188: 0b1.0111.100 1 7 -181.019 -181.019 + 189: 0b1.0111.101 1 7 -197.403 -197.403 + 190: 0b1.0111.110 1 7 -215.269 -215.269 + 191: 0b1.0111.111 1 7 -234.753 -234.753 + 192: 0b1.1000.000 1 -8 -nan(ind) -nan(ind) + 193: 0b1.1000.001 1 -8 -0.0042598 -0.0042598 + 194: 0b1.1000.010 1 -8 -0.00464534 -0.00464534 + 195: 0b1.1000.011 1 -8 -0.00506578 -0.00506578 + 196: 0b1.1000.100 1 -8 -0.00552427 -0.00552427 + 197: 0b1.1000.101 1 -8 -0.00602426 -0.00602426 + 198: 0b1.1000.110 1 -8 -0.0065695 -0.0065695 + 199: 0b1.1000.111 1 -8 -0.00716409 -0.00716409 + 200: 0b1.1001.000 1 -7 -0.0078125 -0.0078125 + 201: 0b1.1001.001 1 -7 -0.00851959 -0.00851959 + 202: 0b1.1001.010 1 -7 -0.00929068 -0.00929068 + 203: 0b1.1001.011 1 -7 -0.0101316 -0.0101316 + 204: 0b1.1001.100 1 -7 -0.0110485 -0.0110485 + 205: 0b1.1001.101 1 -7 -0.0120485 -0.0120485 + 206: 0b1.1001.110 1 -7 -0.013139 -0.013139 + 207: 0b1.1001.111 1 -7 -0.0143282 -0.0143282 + 208: 0b1.1010.000 1 -6 -0.015625 -0.015625 + 209: 0b1.1010.001 1 -6 -0.0170392 -0.0170392 + 210: 0b1.1010.010 1 -6 -0.0185814 -0.0185814 + 211: 0b1.1010.011 1 -6 -0.0202631 -0.0202631 + 212: 0b1.1010.100 1 -6 -0.0220971 -0.0220971 + 213: 0b1.1010.101 1 -6 -0.024097 -0.024097 + 214: 0b1.1010.110 1 -6 -0.026278 -0.026278 + 215: 0b1.1010.111 1 -6 -0.0286564 -0.0286564 + 216: 0b1.1011.000 1 -5 -0.03125 -0.03125 + 217: 0b1.1011.001 1 -5 -0.0340784 -0.0340784 + 218: 0b1.1011.010 1 -5 -0.0371627 -0.0371627 + 219: 0b1.1011.011 1 -5 -0.0405262 -0.0405262 + 220: 0b1.1011.100 1 -5 -0.0441942 -0.0441942 + 221: 0b1.1011.101 1 -5 -0.0481941 -0.0481941 + 222: 0b1.1011.110 1 -5 -0.052556 -0.052556 + 223: 0b1.1011.111 1 -5 -0.0573128 -0.0573128 + 224: 0b1.1100.000 1 -4 -0.0625 -0.0625 + 225: 0b1.1100.001 1 -4 -0.0681567 -0.0681567 + 226: 0b1.1100.010 1 -4 -0.0743254 -0.0743254 + 227: 0b1.1100.011 1 -4 -0.0810525 -0.0810525 + 228: 0b1.1100.100 1 -4 -0.0883883 -0.0883883 + 229: 0b1.1100.101 1 -4 -0.0963882 -0.0963882 + 230: 0b1.1100.110 1 -4 -0.105112 -0.105112 + 231: 0b1.1100.111 1 -4 -0.114626 -0.114626 + 232: 0b1.1101.000 1 -3 -0.125 -0.125 + 233: 0b1.1101.001 1 -3 -0.136313 -0.136313 + 234: 0b1.1101.010 1 -3 -0.148651 -0.148651 + 235: 0b1.1101.011 1 -3 -0.162105 -0.162105 + 236: 0b1.1101.100 1 -3 -0.176777 -0.176777 + 237: 0b1.1101.101 1 -3 -0.192776 -0.192776 + 238: 0b1.1101.110 1 -3 -0.210224 -0.210224 + 239: 0b1.1101.111 1 -3 -0.229251 -0.229251 + 240: 0b1.1110.000 1 -2 -0.25 -0.25 + 241: 0b1.1110.001 1 -2 -0.272627 -0.272627 + 242: 0b1.1110.010 1 -2 -0.297302 -0.297302 + 243: 0b1.1110.011 1 -2 -0.32421 -0.32421 + 244: 0b1.1110.100 1 -2 -0.353553 -0.353553 + 245: 0b1.1110.101 1 -2 -0.385553 -0.385553 + 246: 0b1.1110.110 1 -2 -0.420448 -0.420448 + 247: 0b1.1110.111 1 -2 -0.458502 -0.458502 + 248: 0b1.1111.000 1 -1 -0.5 -0.5 + 249: 0b1.1111.001 1 -1 -0.545254 -0.545254 + 250: 0b1.1111.010 1 -1 -0.594604 -0.594604 + 251: 0b1.1111.011 1 -1 -0.64842 -0.64842 + 252: 0b1.1111.100 1 -1 -0.707107 -0.707107 + 253: 0b1.1111.101 1 -1 -0.771105 -0.771105 + 254: 0b1.1111.110 1 -1 -0.840896 -0.840896 + 255: 0b1.1111.111 1 -1 -0.917004 -0.917004 +Generate Value table for an LNS<8,4> in TXT format + # Binary sign scale value format + 0: 0b0.000.0000 0 0 1 1 + 1: 0b0.000.0001 0 0 1.04427 1.04427 + 2: 0b0.000.0010 0 0 1.09051 1.09051 + 3: 0b0.000.0011 0 0 1.13879 1.13879 + 4: 0b0.000.0100 0 0 1.18921 1.18921 + 5: 0b0.000.0101 0 0 1.24186 1.24186 + 6: 0b0.000.0110 0 0 1.29684 1.29684 + 7: 0b0.000.0111 0 0 1.35426 1.35426 + 8: 0b0.000.1000 0 0 1.41421 1.41421 + 9: 0b0.000.1001 0 0 1.47683 1.47683 + 10: 0b0.000.1010 0 0 1.54221 1.54221 + 11: 0b0.000.1011 0 0 1.61049 1.61049 + 12: 0b0.000.1100 0 0 1.68179 1.68179 + 13: 0b0.000.1101 0 0 1.75625 1.75625 + 14: 0b0.000.1110 0 0 1.83401 1.83401 + 15: 0b0.000.1111 0 0 1.91521 1.91521 + 16: 0b0.001.0000 0 1 2 2 + 17: 0b0.001.0001 0 1 2.08855 2.08855 + 18: 0b0.001.0010 0 1 2.18102 2.18102 + 19: 0b0.001.0011 0 1 2.27758 2.27758 + 20: 0b0.001.0100 0 1 2.37841 2.37841 + 21: 0b0.001.0101 0 1 2.48372 2.48372 + 22: 0b0.001.0110 0 1 2.59368 2.59368 + 23: 0b0.001.0111 0 1 2.70851 2.70851 + 24: 0b0.001.1000 0 1 2.82843 2.82843 + 25: 0b0.001.1001 0 1 2.95365 2.95365 + 26: 0b0.001.1010 0 1 3.08442 3.08442 + 27: 0b0.001.1011 0 1 3.22098 3.22098 + 28: 0b0.001.1100 0 1 3.36359 3.36359 + 29: 0b0.001.1101 0 1 3.5125 3.5125 + 30: 0b0.001.1110 0 1 3.66802 3.66802 + 31: 0b0.001.1111 0 1 3.83041 3.83041 + 32: 0b0.010.0000 0 2 4 4 + 33: 0b0.010.0001 0 2 4.1771 4.1771 + 34: 0b0.010.0010 0 2 4.36203 4.36203 + 35: 0b0.010.0011 0 2 4.55515 4.55515 + 36: 0b0.010.0100 0 2 4.75683 4.75683 + 37: 0b0.010.0101 0 2 4.96743 4.96743 + 38: 0b0.010.0110 0 2 5.18736 5.18736 + 39: 0b0.010.0111 0 2 5.41702 5.41702 + 40: 0b0.010.1000 0 2 5.65685 5.65685 + 41: 0b0.010.1001 0 2 5.9073 5.9073 + 42: 0b0.010.1010 0 2 6.16884 6.16884 + 43: 0b0.010.1011 0 2 6.44196 6.44196 + 44: 0b0.010.1100 0 2 6.72717 6.72717 + 45: 0b0.010.1101 0 2 7.02501 7.02501 + 46: 0b0.010.1110 0 2 7.33603 7.33603 + 47: 0b0.010.1111 0 2 7.66083 7.66083 + 48: 0b0.011.0000 0 3 8 8 + 49: 0b0.011.0001 0 3 8.35419 8.35419 + 50: 0b0.011.0010 0 3 8.72406 8.72406 + 51: 0b0.011.0011 0 3 9.11031 9.11031 + 52: 0b0.011.0100 0 3 9.51366 9.51366 + 53: 0b0.011.0101 0 3 9.93486 9.93486 + 54: 0b0.011.0110 0 3 10.3747 10.3747 + 55: 0b0.011.0111 0 3 10.834 10.834 + 56: 0b0.011.1000 0 3 11.3137 11.3137 + 57: 0b0.011.1001 0 3 11.8146 11.8146 + 58: 0b0.011.1010 0 3 12.3377 12.3377 + 59: 0b0.011.1011 0 3 12.8839 12.8839 + 60: 0b0.011.1100 0 3 13.4543 13.4543 + 61: 0b0.011.1101 0 3 14.05 14.05 + 62: 0b0.011.1110 0 3 14.6721 14.6721 + 63: 0b0.011.1111 0 3 15.3217 15.3217 + 64: 0b0.100.0000 0 -4 0 0 + 65: 0b0.100.0001 0 -4 0.0652671 0.0652671 + 66: 0b0.100.0010 0 -4 0.0681567 0.0681567 + 67: 0b0.100.0011 0 -4 0.0711743 0.0711743 + 68: 0b0.100.0100 0 -4 0.0743254 0.0743254 + 69: 0b0.100.0101 0 -4 0.0776161 0.0776161 + 70: 0b0.100.0110 0 -4 0.0810525 0.0810525 + 71: 0b0.100.0111 0 -4 0.084641 0.084641 + 72: 0b0.100.1000 0 -4 0.0883883 0.0883883 + 73: 0b0.100.1001 0 -4 0.0923016 0.0923016 + 74: 0b0.100.1010 0 -4 0.0963882 0.0963882 + 75: 0b0.100.1011 0 -4 0.100656 0.100656 + 76: 0b0.100.1100 0 -4 0.105112 0.105112 + 77: 0b0.100.1101 0 -4 0.109766 0.109766 + 78: 0b0.100.1110 0 -4 0.114626 0.114626 + 79: 0b0.100.1111 0 -4 0.1197 0.1197 + 80: 0b0.101.0000 0 -3 0.125 0.125 + 81: 0b0.101.0001 0 -3 0.130534 0.130534 + 82: 0b0.101.0010 0 -3 0.136313 0.136313 + 83: 0b0.101.0011 0 -3 0.142349 0.142349 + 84: 0b0.101.0100 0 -3 0.148651 0.148651 + 85: 0b0.101.0101 0 -3 0.155232 0.155232 + 86: 0b0.101.0110 0 -3 0.162105 0.162105 + 87: 0b0.101.0111 0 -3 0.169282 0.169282 + 88: 0b0.101.1000 0 -3 0.176777 0.176777 + 89: 0b0.101.1001 0 -3 0.184603 0.184603 + 90: 0b0.101.1010 0 -3 0.192776 0.192776 + 91: 0b0.101.1011 0 -3 0.201311 0.201311 + 92: 0b0.101.1100 0 -3 0.210224 0.210224 + 93: 0b0.101.1101 0 -3 0.219532 0.219532 + 94: 0b0.101.1110 0 -3 0.229251 0.229251 + 95: 0b0.101.1111 0 -3 0.239401 0.239401 + 96: 0b0.110.0000 0 -2 0.25 0.25 + 97: 0b0.110.0001 0 -2 0.261068 0.261068 + 98: 0b0.110.0010 0 -2 0.272627 0.272627 + 99: 0b0.110.0011 0 -2 0.284697 0.284697 + 100: 0b0.110.0100 0 -2 0.297302 0.297302 + 101: 0b0.110.0101 0 -2 0.310464 0.310464 + 102: 0b0.110.0110 0 -2 0.32421 0.32421 + 103: 0b0.110.0111 0 -2 0.338564 0.338564 + 104: 0b0.110.1000 0 -2 0.353553 0.353553 + 105: 0b0.110.1001 0 -2 0.369207 0.369207 + 106: 0b0.110.1010 0 -2 0.385553 0.385553 + 107: 0b0.110.1011 0 -2 0.402623 0.402623 + 108: 0b0.110.1100 0 -2 0.420448 0.420448 + 109: 0b0.110.1101 0 -2 0.439063 0.439063 + 110: 0b0.110.1110 0 -2 0.458502 0.458502 + 111: 0b0.110.1111 0 -2 0.478802 0.478802 + 112: 0b0.111.0000 0 -1 0.5 0.5 + 113: 0b0.111.0001 0 -1 0.522137 0.522137 + 114: 0b0.111.0010 0 -1 0.545254 0.545254 + 115: 0b0.111.0011 0 -1 0.569394 0.569394 + 116: 0b0.111.0100 0 -1 0.594604 0.594604 + 117: 0b0.111.0101 0 -1 0.620929 0.620929 + 118: 0b0.111.0110 0 -1 0.64842 0.64842 + 119: 0b0.111.0111 0 -1 0.677128 0.677128 + 120: 0b0.111.1000 0 -1 0.707107 0.707107 + 121: 0b0.111.1001 0 -1 0.738413 0.738413 + 122: 0b0.111.1010 0 -1 0.771105 0.771105 + 123: 0b0.111.1011 0 -1 0.805245 0.805245 + 124: 0b0.111.1100 0 -1 0.840896 0.840896 + 125: 0b0.111.1101 0 -1 0.878126 0.878126 + 126: 0b0.111.1110 0 -1 0.917004 0.917004 + 127: 0b0.111.1111 0 -1 0.957603 0.957603 + 128: 0b1.000.0000 1 0 -1 -1 + 129: 0b1.000.0001 1 0 -1.04427 -1.04427 + 130: 0b1.000.0010 1 0 -1.09051 -1.09051 + 131: 0b1.000.0011 1 0 -1.13879 -1.13879 + 132: 0b1.000.0100 1 0 -1.18921 -1.18921 + 133: 0b1.000.0101 1 0 -1.24186 -1.24186 + 134: 0b1.000.0110 1 0 -1.29684 -1.29684 + 135: 0b1.000.0111 1 0 -1.35426 -1.35426 + 136: 0b1.000.1000 1 0 -1.41421 -1.41421 + 137: 0b1.000.1001 1 0 -1.47683 -1.47683 + 138: 0b1.000.1010 1 0 -1.54221 -1.54221 + 139: 0b1.000.1011 1 0 -1.61049 -1.61049 + 140: 0b1.000.1100 1 0 -1.68179 -1.68179 + 141: 0b1.000.1101 1 0 -1.75625 -1.75625 + 142: 0b1.000.1110 1 0 -1.83401 -1.83401 + 143: 0b1.000.1111 1 0 -1.91521 -1.91521 + 144: 0b1.001.0000 1 1 -2 -2 + 145: 0b1.001.0001 1 1 -2.08855 -2.08855 + 146: 0b1.001.0010 1 1 -2.18102 -2.18102 + 147: 0b1.001.0011 1 1 -2.27758 -2.27758 + 148: 0b1.001.0100 1 1 -2.37841 -2.37841 + 149: 0b1.001.0101 1 1 -2.48372 -2.48372 + 150: 0b1.001.0110 1 1 -2.59368 -2.59368 + 151: 0b1.001.0111 1 1 -2.70851 -2.70851 + 152: 0b1.001.1000 1 1 -2.82843 -2.82843 + 153: 0b1.001.1001 1 1 -2.95365 -2.95365 + 154: 0b1.001.1010 1 1 -3.08442 -3.08442 + 155: 0b1.001.1011 1 1 -3.22098 -3.22098 + 156: 0b1.001.1100 1 1 -3.36359 -3.36359 + 157: 0b1.001.1101 1 1 -3.5125 -3.5125 + 158: 0b1.001.1110 1 1 -3.66802 -3.66802 + 159: 0b1.001.1111 1 1 -3.83041 -3.83041 + 160: 0b1.010.0000 1 2 -4 -4 + 161: 0b1.010.0001 1 2 -4.1771 -4.1771 + 162: 0b1.010.0010 1 2 -4.36203 -4.36203 + 163: 0b1.010.0011 1 2 -4.55515 -4.55515 + 164: 0b1.010.0100 1 2 -4.75683 -4.75683 + 165: 0b1.010.0101 1 2 -4.96743 -4.96743 + 166: 0b1.010.0110 1 2 -5.18736 -5.18736 + 167: 0b1.010.0111 1 2 -5.41702 -5.41702 + 168: 0b1.010.1000 1 2 -5.65685 -5.65685 + 169: 0b1.010.1001 1 2 -5.9073 -5.9073 + 170: 0b1.010.1010 1 2 -6.16884 -6.16884 + 171: 0b1.010.1011 1 2 -6.44196 -6.44196 + 172: 0b1.010.1100 1 2 -6.72717 -6.72717 + 173: 0b1.010.1101 1 2 -7.02501 -7.02501 + 174: 0b1.010.1110 1 2 -7.33603 -7.33603 + 175: 0b1.010.1111 1 2 -7.66083 -7.66083 + 176: 0b1.011.0000 1 3 -8 -8 + 177: 0b1.011.0001 1 3 -8.35419 -8.35419 + 178: 0b1.011.0010 1 3 -8.72406 -8.72406 + 179: 0b1.011.0011 1 3 -9.11031 -9.11031 + 180: 0b1.011.0100 1 3 -9.51366 -9.51366 + 181: 0b1.011.0101 1 3 -9.93486 -9.93486 + 182: 0b1.011.0110 1 3 -10.3747 -10.3747 + 183: 0b1.011.0111 1 3 -10.834 -10.834 + 184: 0b1.011.1000 1 3 -11.3137 -11.3137 + 185: 0b1.011.1001 1 3 -11.8146 -11.8146 + 186: 0b1.011.1010 1 3 -12.3377 -12.3377 + 187: 0b1.011.1011 1 3 -12.8839 -12.8839 + 188: 0b1.011.1100 1 3 -13.4543 -13.4543 + 189: 0b1.011.1101 1 3 -14.05 -14.05 + 190: 0b1.011.1110 1 3 -14.6721 -14.6721 + 191: 0b1.011.1111 1 3 -15.3217 -15.3217 + 192: 0b1.100.0000 1 -4 -nan(ind) -nan(ind) + 193: 0b1.100.0001 1 -4 -0.0652671 -0.0652671 + 194: 0b1.100.0010 1 -4 -0.0681567 -0.0681567 + 195: 0b1.100.0011 1 -4 -0.0711743 -0.0711743 + 196: 0b1.100.0100 1 -4 -0.0743254 -0.0743254 + 197: 0b1.100.0101 1 -4 -0.0776161 -0.0776161 + 198: 0b1.100.0110 1 -4 -0.0810525 -0.0810525 + 199: 0b1.100.0111 1 -4 -0.084641 -0.084641 + 200: 0b1.100.1000 1 -4 -0.0883883 -0.0883883 + 201: 0b1.100.1001 1 -4 -0.0923016 -0.0923016 + 202: 0b1.100.1010 1 -4 -0.0963882 -0.0963882 + 203: 0b1.100.1011 1 -4 -0.100656 -0.100656 + 204: 0b1.100.1100 1 -4 -0.105112 -0.105112 + 205: 0b1.100.1101 1 -4 -0.109766 -0.109766 + 206: 0b1.100.1110 1 -4 -0.114626 -0.114626 + 207: 0b1.100.1111 1 -4 -0.1197 -0.1197 + 208: 0b1.101.0000 1 -3 -0.125 -0.125 + 209: 0b1.101.0001 1 -3 -0.130534 -0.130534 + 210: 0b1.101.0010 1 -3 -0.136313 -0.136313 + 211: 0b1.101.0011 1 -3 -0.142349 -0.142349 + 212: 0b1.101.0100 1 -3 -0.148651 -0.148651 + 213: 0b1.101.0101 1 -3 -0.155232 -0.155232 + 214: 0b1.101.0110 1 -3 -0.162105 -0.162105 + 215: 0b1.101.0111 1 -3 -0.169282 -0.169282 + 216: 0b1.101.1000 1 -3 -0.176777 -0.176777 + 217: 0b1.101.1001 1 -3 -0.184603 -0.184603 + 218: 0b1.101.1010 1 -3 -0.192776 -0.192776 + 219: 0b1.101.1011 1 -3 -0.201311 -0.201311 + 220: 0b1.101.1100 1 -3 -0.210224 -0.210224 + 221: 0b1.101.1101 1 -3 -0.219532 -0.219532 + 222: 0b1.101.1110 1 -3 -0.229251 -0.229251 + 223: 0b1.101.1111 1 -3 -0.239401 -0.239401 + 224: 0b1.110.0000 1 -2 -0.25 -0.25 + 225: 0b1.110.0001 1 -2 -0.261068 -0.261068 + 226: 0b1.110.0010 1 -2 -0.272627 -0.272627 + 227: 0b1.110.0011 1 -2 -0.284697 -0.284697 + 228: 0b1.110.0100 1 -2 -0.297302 -0.297302 + 229: 0b1.110.0101 1 -2 -0.310464 -0.310464 + 230: 0b1.110.0110 1 -2 -0.32421 -0.32421 + 231: 0b1.110.0111 1 -2 -0.338564 -0.338564 + 232: 0b1.110.1000 1 -2 -0.353553 -0.353553 + 233: 0b1.110.1001 1 -2 -0.369207 -0.369207 + 234: 0b1.110.1010 1 -2 -0.385553 -0.385553 + 235: 0b1.110.1011 1 -2 -0.402623 -0.402623 + 236: 0b1.110.1100 1 -2 -0.420448 -0.420448 + 237: 0b1.110.1101 1 -2 -0.439063 -0.439063 + 238: 0b1.110.1110 1 -2 -0.458502 -0.458502 + 239: 0b1.110.1111 1 -2 -0.478802 -0.478802 + 240: 0b1.111.0000 1 -1 -0.5 -0.5 + 241: 0b1.111.0001 1 -1 -0.522137 -0.522137 + 242: 0b1.111.0010 1 -1 -0.545254 -0.545254 + 243: 0b1.111.0011 1 -1 -0.569394 -0.569394 + 244: 0b1.111.0100 1 -1 -0.594604 -0.594604 + 245: 0b1.111.0101 1 -1 -0.620929 -0.620929 + 246: 0b1.111.0110 1 -1 -0.64842 -0.64842 + 247: 0b1.111.0111 1 -1 -0.677128 -0.677128 + 248: 0b1.111.1000 1 -1 -0.707107 -0.707107 + 249: 0b1.111.1001 1 -1 -0.738413 -0.738413 + 250: 0b1.111.1010 1 -1 -0.771105 -0.771105 + 251: 0b1.111.1011 1 -1 -0.805245 -0.805245 + 252: 0b1.111.1100 1 -1 -0.840896 -0.840896 + 253: 0b1.111.1101 1 -1 -0.878126 -0.878126 + 254: 0b1.111.1110 1 -1 -0.917004 -0.917004 + 255: 0b1.111.1111 1 -1 -0.957603 -0.957603 +Generate Value table for an LNS<8,5> in TXT format + # Binary sign scale value format + 0: 0b0.00.00000 0 0 1 1 + 1: 0b0.00.00001 0 0 1.0219 1.0219 + 2: 0b0.00.00010 0 0 1.04427 1.04427 + 3: 0b0.00.00011 0 0 1.06714 1.06714 + 4: 0b0.00.00100 0 0 1.09051 1.09051 + 5: 0b0.00.00101 0 0 1.11439 1.11439 + 6: 0b0.00.00110 0 0 1.13879 1.13879 + 7: 0b0.00.00111 0 0 1.16372 1.16372 + 8: 0b0.00.01000 0 0 1.18921 1.18921 + 9: 0b0.00.01001 0 0 1.21525 1.21525 + 10: 0b0.00.01010 0 0 1.24186 1.24186 + 11: 0b0.00.01011 0 0 1.26905 1.26905 + 12: 0b0.00.01100 0 0 1.29684 1.29684 + 13: 0b0.00.01101 0 0 1.32524 1.32524 + 14: 0b0.00.01110 0 0 1.35426 1.35426 + 15: 0b0.00.01111 0 0 1.38391 1.38391 + 16: 0b0.00.10000 0 0 1.41421 1.41421 + 17: 0b0.00.10001 0 0 1.44518 1.44518 + 18: 0b0.00.10010 0 0 1.47683 1.47683 + 19: 0b0.00.10011 0 0 1.50916 1.50916 + 20: 0b0.00.10100 0 0 1.54221 1.54221 + 21: 0b0.00.10101 0 0 1.57598 1.57598 + 22: 0b0.00.10110 0 0 1.61049 1.61049 + 23: 0b0.00.10111 0 0 1.64576 1.64576 + 24: 0b0.00.11000 0 0 1.68179 1.68179 + 25: 0b0.00.11001 0 0 1.71862 1.71862 + 26: 0b0.00.11010 0 0 1.75625 1.75625 + 27: 0b0.00.11011 0 0 1.79471 1.79471 + 28: 0b0.00.11100 0 0 1.83401 1.83401 + 29: 0b0.00.11101 0 0 1.87417 1.87417 + 30: 0b0.00.11110 0 0 1.91521 1.91521 + 31: 0b0.00.11111 0 0 1.95714 1.95714 + 32: 0b0.01.00000 0 1 2 2 + 33: 0b0.01.00001 0 1 2.04379 2.04379 + 34: 0b0.01.00010 0 1 2.08855 2.08855 + 35: 0b0.01.00011 0 1 2.13428 2.13428 + 36: 0b0.01.00100 0 1 2.18102 2.18102 + 37: 0b0.01.00101 0 1 2.22877 2.22877 + 38: 0b0.01.00110 0 1 2.27758 2.27758 + 39: 0b0.01.00111 0 1 2.32745 2.32745 + 40: 0b0.01.01000 0 1 2.37841 2.37841 + 41: 0b0.01.01001 0 1 2.43049 2.43049 + 42: 0b0.01.01010 0 1 2.48372 2.48372 + 43: 0b0.01.01011 0 1 2.5381 2.5381 + 44: 0b0.01.01100 0 1 2.59368 2.59368 + 45: 0b0.01.01101 0 1 2.65047 2.65047 + 46: 0b0.01.01110 0 1 2.70851 2.70851 + 47: 0b0.01.01111 0 1 2.76782 2.76782 + 48: 0b0.01.10000 0 1 2.82843 2.82843 + 49: 0b0.01.10001 0 1 2.89036 2.89036 + 50: 0b0.01.10010 0 1 2.95365 2.95365 + 51: 0b0.01.10011 0 1 3.01833 3.01833 + 52: 0b0.01.10100 0 1 3.08442 3.08442 + 53: 0b0.01.10101 0 1 3.15196 3.15196 + 54: 0b0.01.10110 0 1 3.22098 3.22098 + 55: 0b0.01.10111 0 1 3.29151 3.29151 + 56: 0b0.01.11000 0 1 3.36359 3.36359 + 57: 0b0.01.11001 0 1 3.43724 3.43724 + 58: 0b0.01.11010 0 1 3.5125 3.5125 + 59: 0b0.01.11011 0 1 3.58942 3.58942 + 60: 0b0.01.11100 0 1 3.66802 3.66802 + 61: 0b0.01.11101 0 1 3.74834 3.74834 + 62: 0b0.01.11110 0 1 3.83041 3.83041 + 63: 0b0.01.11111 0 1 3.91429 3.91429 + 64: 0b0.10.00000 0 -2 0 0 + 65: 0b0.10.00001 0 -2 0.255474 0.255474 + 66: 0b0.10.00010 0 -2 0.261068 0.261068 + 67: 0b0.10.00011 0 -2 0.266785 0.266785 + 68: 0b0.10.00100 0 -2 0.272627 0.272627 + 69: 0b0.10.00101 0 -2 0.278597 0.278597 + 70: 0b0.10.00110 0 -2 0.284697 0.284697 + 71: 0b0.10.00111 0 -2 0.290931 0.290931 + 72: 0b0.10.01000 0 -2 0.297302 0.297302 + 73: 0b0.10.01001 0 -2 0.303812 0.303812 + 74: 0b0.10.01010 0 -2 0.310464 0.310464 + 75: 0b0.10.01011 0 -2 0.317263 0.317263 + 76: 0b0.10.01100 0 -2 0.32421 0.32421 + 77: 0b0.10.01101 0 -2 0.331309 0.331309 + 78: 0b0.10.01110 0 -2 0.338564 0.338564 + 79: 0b0.10.01111 0 -2 0.345977 0.345977 + 80: 0b0.10.10000 0 -2 0.353553 0.353553 + 81: 0b0.10.10001 0 -2 0.361295 0.361295 + 82: 0b0.10.10010 0 -2 0.369207 0.369207 + 83: 0b0.10.10011 0 -2 0.377291 0.377291 + 84: 0b0.10.10100 0 -2 0.385553 0.385553 + 85: 0b0.10.10101 0 -2 0.393995 0.393995 + 86: 0b0.10.10110 0 -2 0.402623 0.402623 + 87: 0b0.10.10111 0 -2 0.411439 0.411439 + 88: 0b0.10.11000 0 -2 0.420448 0.420448 + 89: 0b0.10.11001 0 -2 0.429655 0.429655 + 90: 0b0.10.11010 0 -2 0.439063 0.439063 + 91: 0b0.10.11011 0 -2 0.448677 0.448677 + 92: 0b0.10.11100 0 -2 0.458502 0.458502 + 93: 0b0.10.11101 0 -2 0.468542 0.468542 + 94: 0b0.10.11110 0 -2 0.478802 0.478802 + 95: 0b0.10.11111 0 -2 0.489286 0.489286 + 96: 0b0.11.00000 0 -1 0.5 0.5 + 97: 0b0.11.00001 0 -1 0.510949 0.510949 + 98: 0b0.11.00010 0 -1 0.522137 0.522137 + 99: 0b0.11.00011 0 -1 0.53357 0.53357 + 100: 0b0.11.00100 0 -1 0.545254 0.545254 + 101: 0b0.11.00101 0 -1 0.557193 0.557193 + 102: 0b0.11.00110 0 -1 0.569394 0.569394 + 103: 0b0.11.00111 0 -1 0.581862 0.581862 + 104: 0b0.11.01000 0 -1 0.594604 0.594604 + 105: 0b0.11.01001 0 -1 0.607624 0.607624 + 106: 0b0.11.01010 0 -1 0.620929 0.620929 + 107: 0b0.11.01011 0 -1 0.634525 0.634525 + 108: 0b0.11.01100 0 -1 0.64842 0.64842 + 109: 0b0.11.01101 0 -1 0.662618 0.662618 + 110: 0b0.11.01110 0 -1 0.677128 0.677128 + 111: 0b0.11.01111 0 -1 0.691955 0.691955 + 112: 0b0.11.10000 0 -1 0.707107 0.707107 + 113: 0b0.11.10001 0 -1 0.72259 0.72259 + 114: 0b0.11.10010 0 -1 0.738413 0.738413 + 115: 0b0.11.10011 0 -1 0.754582 0.754582 + 116: 0b0.11.10100 0 -1 0.771105 0.771105 + 117: 0b0.11.10101 0 -1 0.78799 0.78799 + 118: 0b0.11.10110 0 -1 0.805245 0.805245 + 119: 0b0.11.10111 0 -1 0.822878 0.822878 + 120: 0b0.11.11000 0 -1 0.840896 0.840896 + 121: 0b0.11.11001 0 -1 0.85931 0.85931 + 122: 0b0.11.11010 0 -1 0.878126 0.878126 + 123: 0b0.11.11011 0 -1 0.897355 0.897355 + 124: 0b0.11.11100 0 -1 0.917004 0.917004 + 125: 0b0.11.11101 0 -1 0.937084 0.937084 + 126: 0b0.11.11110 0 -1 0.957603 0.957603 + 127: 0b0.11.11111 0 -1 0.978572 0.978572 + 128: 0b1.00.00000 1 0 -1 -1 + 129: 0b1.00.00001 1 0 -1.0219 -1.0219 + 130: 0b1.00.00010 1 0 -1.04427 -1.04427 + 131: 0b1.00.00011 1 0 -1.06714 -1.06714 + 132: 0b1.00.00100 1 0 -1.09051 -1.09051 + 133: 0b1.00.00101 1 0 -1.11439 -1.11439 + 134: 0b1.00.00110 1 0 -1.13879 -1.13879 + 135: 0b1.00.00111 1 0 -1.16372 -1.16372 + 136: 0b1.00.01000 1 0 -1.18921 -1.18921 + 137: 0b1.00.01001 1 0 -1.21525 -1.21525 + 138: 0b1.00.01010 1 0 -1.24186 -1.24186 + 139: 0b1.00.01011 1 0 -1.26905 -1.26905 + 140: 0b1.00.01100 1 0 -1.29684 -1.29684 + 141: 0b1.00.01101 1 0 -1.32524 -1.32524 + 142: 0b1.00.01110 1 0 -1.35426 -1.35426 + 143: 0b1.00.01111 1 0 -1.38391 -1.38391 + 144: 0b1.00.10000 1 0 -1.41421 -1.41421 + 145: 0b1.00.10001 1 0 -1.44518 -1.44518 + 146: 0b1.00.10010 1 0 -1.47683 -1.47683 + 147: 0b1.00.10011 1 0 -1.50916 -1.50916 + 148: 0b1.00.10100 1 0 -1.54221 -1.54221 + 149: 0b1.00.10101 1 0 -1.57598 -1.57598 + 150: 0b1.00.10110 1 0 -1.61049 -1.61049 + 151: 0b1.00.10111 1 0 -1.64576 -1.64576 + 152: 0b1.00.11000 1 0 -1.68179 -1.68179 + 153: 0b1.00.11001 1 0 -1.71862 -1.71862 + 154: 0b1.00.11010 1 0 -1.75625 -1.75625 + 155: 0b1.00.11011 1 0 -1.79471 -1.79471 + 156: 0b1.00.11100 1 0 -1.83401 -1.83401 + 157: 0b1.00.11101 1 0 -1.87417 -1.87417 + 158: 0b1.00.11110 1 0 -1.91521 -1.91521 + 159: 0b1.00.11111 1 0 -1.95714 -1.95714 + 160: 0b1.01.00000 1 1 -2 -2 + 161: 0b1.01.00001 1 1 -2.04379 -2.04379 + 162: 0b1.01.00010 1 1 -2.08855 -2.08855 + 163: 0b1.01.00011 1 1 -2.13428 -2.13428 + 164: 0b1.01.00100 1 1 -2.18102 -2.18102 + 165: 0b1.01.00101 1 1 -2.22877 -2.22877 + 166: 0b1.01.00110 1 1 -2.27758 -2.27758 + 167: 0b1.01.00111 1 1 -2.32745 -2.32745 + 168: 0b1.01.01000 1 1 -2.37841 -2.37841 + 169: 0b1.01.01001 1 1 -2.43049 -2.43049 + 170: 0b1.01.01010 1 1 -2.48372 -2.48372 + 171: 0b1.01.01011 1 1 -2.5381 -2.5381 + 172: 0b1.01.01100 1 1 -2.59368 -2.59368 + 173: 0b1.01.01101 1 1 -2.65047 -2.65047 + 174: 0b1.01.01110 1 1 -2.70851 -2.70851 + 175: 0b1.01.01111 1 1 -2.76782 -2.76782 + 176: 0b1.01.10000 1 1 -2.82843 -2.82843 + 177: 0b1.01.10001 1 1 -2.89036 -2.89036 + 178: 0b1.01.10010 1 1 -2.95365 -2.95365 + 179: 0b1.01.10011 1 1 -3.01833 -3.01833 + 180: 0b1.01.10100 1 1 -3.08442 -3.08442 + 181: 0b1.01.10101 1 1 -3.15196 -3.15196 + 182: 0b1.01.10110 1 1 -3.22098 -3.22098 + 183: 0b1.01.10111 1 1 -3.29151 -3.29151 + 184: 0b1.01.11000 1 1 -3.36359 -3.36359 + 185: 0b1.01.11001 1 1 -3.43724 -3.43724 + 186: 0b1.01.11010 1 1 -3.5125 -3.5125 + 187: 0b1.01.11011 1 1 -3.58942 -3.58942 + 188: 0b1.01.11100 1 1 -3.66802 -3.66802 + 189: 0b1.01.11101 1 1 -3.74834 -3.74834 + 190: 0b1.01.11110 1 1 -3.83041 -3.83041 + 191: 0b1.01.11111 1 1 -3.91429 -3.91429 + 192: 0b1.10.00000 1 -2 -nan(ind) -nan(ind) + 193: 0b1.10.00001 1 -2 -0.255474 -0.255474 + 194: 0b1.10.00010 1 -2 -0.261068 -0.261068 + 195: 0b1.10.00011 1 -2 -0.266785 -0.266785 + 196: 0b1.10.00100 1 -2 -0.272627 -0.272627 + 197: 0b1.10.00101 1 -2 -0.278597 -0.278597 + 198: 0b1.10.00110 1 -2 -0.284697 -0.284697 + 199: 0b1.10.00111 1 -2 -0.290931 -0.290931 + 200: 0b1.10.01000 1 -2 -0.297302 -0.297302 + 201: 0b1.10.01001 1 -2 -0.303812 -0.303812 + 202: 0b1.10.01010 1 -2 -0.310464 -0.310464 + 203: 0b1.10.01011 1 -2 -0.317263 -0.317263 + 204: 0b1.10.01100 1 -2 -0.32421 -0.32421 + 205: 0b1.10.01101 1 -2 -0.331309 -0.331309 + 206: 0b1.10.01110 1 -2 -0.338564 -0.338564 + 207: 0b1.10.01111 1 -2 -0.345977 -0.345977 + 208: 0b1.10.10000 1 -2 -0.353553 -0.353553 + 209: 0b1.10.10001 1 -2 -0.361295 -0.361295 + 210: 0b1.10.10010 1 -2 -0.369207 -0.369207 + 211: 0b1.10.10011 1 -2 -0.377291 -0.377291 + 212: 0b1.10.10100 1 -2 -0.385553 -0.385553 + 213: 0b1.10.10101 1 -2 -0.393995 -0.393995 + 214: 0b1.10.10110 1 -2 -0.402623 -0.402623 + 215: 0b1.10.10111 1 -2 -0.411439 -0.411439 + 216: 0b1.10.11000 1 -2 -0.420448 -0.420448 + 217: 0b1.10.11001 1 -2 -0.429655 -0.429655 + 218: 0b1.10.11010 1 -2 -0.439063 -0.439063 + 219: 0b1.10.11011 1 -2 -0.448677 -0.448677 + 220: 0b1.10.11100 1 -2 -0.458502 -0.458502 + 221: 0b1.10.11101 1 -2 -0.468542 -0.468542 + 222: 0b1.10.11110 1 -2 -0.478802 -0.478802 + 223: 0b1.10.11111 1 -2 -0.489286 -0.489286 + 224: 0b1.11.00000 1 -1 -0.5 -0.5 + 225: 0b1.11.00001 1 -1 -0.510949 -0.510949 + 226: 0b1.11.00010 1 -1 -0.522137 -0.522137 + 227: 0b1.11.00011 1 -1 -0.53357 -0.53357 + 228: 0b1.11.00100 1 -1 -0.545254 -0.545254 + 229: 0b1.11.00101 1 -1 -0.557193 -0.557193 + 230: 0b1.11.00110 1 -1 -0.569394 -0.569394 + 231: 0b1.11.00111 1 -1 -0.581862 -0.581862 + 232: 0b1.11.01000 1 -1 -0.594604 -0.594604 + 233: 0b1.11.01001 1 -1 -0.607624 -0.607624 + 234: 0b1.11.01010 1 -1 -0.620929 -0.620929 + 235: 0b1.11.01011 1 -1 -0.634525 -0.634525 + 236: 0b1.11.01100 1 -1 -0.64842 -0.64842 + 237: 0b1.11.01101 1 -1 -0.662618 -0.662618 + 238: 0b1.11.01110 1 -1 -0.677128 -0.677128 + 239: 0b1.11.01111 1 -1 -0.691955 -0.691955 + 240: 0b1.11.10000 1 -1 -0.707107 -0.707107 + 241: 0b1.11.10001 1 -1 -0.72259 -0.72259 + 242: 0b1.11.10010 1 -1 -0.738413 -0.738413 + 243: 0b1.11.10011 1 -1 -0.754582 -0.754582 + 244: 0b1.11.10100 1 -1 -0.771105 -0.771105 + 245: 0b1.11.10101 1 -1 -0.78799 -0.78799 + 246: 0b1.11.10110 1 -1 -0.805245 -0.805245 + 247: 0b1.11.10111 1 -1 -0.822878 -0.822878 + 248: 0b1.11.11000 1 -1 -0.840896 -0.840896 + 249: 0b1.11.11001 1 -1 -0.85931 -0.85931 + 250: 0b1.11.11010 1 -1 -0.878126 -0.878126 + 251: 0b1.11.11011 1 -1 -0.897355 -0.897355 + 252: 0b1.11.11100 1 -1 -0.917004 -0.917004 + 253: 0b1.11.11101 1 -1 -0.937084 -0.937084 + 254: 0b1.11.11110 1 -1 -0.957603 -0.957603 + 255: 0b1.11.11111 1 -1 -0.978572 -0.978572 +Generate Value table for an LNS<8,6> in TXT format + # Binary sign scale value format + 0: 0b0.0.000000 0 0 1 1 + 1: 0b0.0.000001 0 0 1.01089 1.01089 + 2: 0b0.0.000010 0 0 1.0219 1.0219 + 3: 0b0.0.000011 0 0 1.03302 1.03302 + 4: 0b0.0.000100 0 0 1.04427 1.04427 + 5: 0b0.0.000101 0 0 1.05565 1.05565 + 6: 0b0.0.000110 0 0 1.06714 1.06714 + 7: 0b0.0.000111 0 0 1.07876 1.07876 + 8: 0b0.0.001000 0 0 1.09051 1.09051 + 9: 0b0.0.001001 0 0 1.10238 1.10238 + 10: 0b0.0.001010 0 0 1.11439 1.11439 + 11: 0b0.0.001011 0 0 1.12652 1.12652 + 12: 0b0.0.001100 0 0 1.13879 1.13879 + 13: 0b0.0.001101 0 0 1.15119 1.15119 + 14: 0b0.0.001110 0 0 1.16372 1.16372 + 15: 0b0.0.001111 0 0 1.1764 1.1764 + 16: 0b0.0.010000 0 0 1.18921 1.18921 + 17: 0b0.0.010001 0 0 1.20216 1.20216 + 18: 0b0.0.010010 0 0 1.21525 1.21525 + 19: 0b0.0.010011 0 0 1.22848 1.22848 + 20: 0b0.0.010100 0 0 1.24186 1.24186 + 21: 0b0.0.010101 0 0 1.25538 1.25538 + 22: 0b0.0.010110 0 0 1.26905 1.26905 + 23: 0b0.0.010111 0 0 1.28287 1.28287 + 24: 0b0.0.011000 0 0 1.29684 1.29684 + 25: 0b0.0.011001 0 0 1.31096 1.31096 + 26: 0b0.0.011010 0 0 1.32524 1.32524 + 27: 0b0.0.011011 0 0 1.33967 1.33967 + 28: 0b0.0.011100 0 0 1.35426 1.35426 + 29: 0b0.0.011101 0 0 1.369 1.369 + 30: 0b0.0.011110 0 0 1.38391 1.38391 + 31: 0b0.0.011111 0 0 1.39898 1.39898 + 32: 0b0.0.100000 0 0 1.41421 1.41421 + 33: 0b0.0.100001 0 0 1.42961 1.42961 + 34: 0b0.0.100010 0 0 1.44518 1.44518 + 35: 0b0.0.100011 0 0 1.46092 1.46092 + 36: 0b0.0.100100 0 0 1.47683 1.47683 + 37: 0b0.0.100101 0 0 1.49291 1.49291 + 38: 0b0.0.100110 0 0 1.50916 1.50916 + 39: 0b0.0.100111 0 0 1.5256 1.5256 + 40: 0b0.0.101000 0 0 1.54221 1.54221 + 41: 0b0.0.101001 0 0 1.559 1.559 + 42: 0b0.0.101010 0 0 1.57598 1.57598 + 43: 0b0.0.101011 0 0 1.59314 1.59314 + 44: 0b0.0.101100 0 0 1.61049 1.61049 + 45: 0b0.0.101101 0 0 1.62803 1.62803 + 46: 0b0.0.101110 0 0 1.64576 1.64576 + 47: 0b0.0.101111 0 0 1.66368 1.66368 + 48: 0b0.0.110000 0 0 1.68179 1.68179 + 49: 0b0.0.110001 0 0 1.70011 1.70011 + 50: 0b0.0.110010 0 0 1.71862 1.71862 + 51: 0b0.0.110011 0 0 1.73733 1.73733 + 52: 0b0.0.110100 0 0 1.75625 1.75625 + 53: 0b0.0.110101 0 0 1.77538 1.77538 + 54: 0b0.0.110110 0 0 1.79471 1.79471 + 55: 0b0.0.110111 0 0 1.81425 1.81425 + 56: 0b0.0.111000 0 0 1.83401 1.83401 + 57: 0b0.0.111001 0 0 1.85398 1.85398 + 58: 0b0.0.111010 0 0 1.87417 1.87417 + 59: 0b0.0.111011 0 0 1.89458 1.89458 + 60: 0b0.0.111100 0 0 1.91521 1.91521 + 61: 0b0.0.111101 0 0 1.93606 1.93606 + 62: 0b0.0.111110 0 0 1.95714 1.95714 + 63: 0b0.0.111111 0 0 1.97846 1.97846 + 64: 0b0.1.000000 0 -1 0 0 + 65: 0b0.1.000001 0 -1 0.505445 0.505445 + 66: 0b0.1.000010 0 -1 0.510949 0.510949 + 67: 0b0.1.000011 0 -1 0.516512 0.516512 + 68: 0b0.1.000100 0 -1 0.522137 0.522137 + 69: 0b0.1.000101 0 -1 0.527823 0.527823 + 70: 0b0.1.000110 0 -1 0.53357 0.53357 + 71: 0b0.1.000111 0 -1 0.53938 0.53938 + 72: 0b0.1.001000 0 -1 0.545254 0.545254 + 73: 0b0.1.001001 0 -1 0.551191 0.551191 + 74: 0b0.1.001010 0 -1 0.557193 0.557193 + 75: 0b0.1.001011 0 -1 0.563261 0.563261 + 76: 0b0.1.001100 0 -1 0.569394 0.569394 + 77: 0b0.1.001101 0 -1 0.575595 0.575595 + 78: 0b0.1.001110 0 -1 0.581862 0.581862 + 79: 0b0.1.001111 0 -1 0.588198 0.588198 + 80: 0b0.1.010000 0 -1 0.594604 0.594604 + 81: 0b0.1.010001 0 -1 0.601078 0.601078 + 82: 0b0.1.010010 0 -1 0.607624 0.607624 + 83: 0b0.1.010011 0 -1 0.61424 0.61424 + 84: 0b0.1.010100 0 -1 0.620929 0.620929 + 85: 0b0.1.010101 0 -1 0.62769 0.62769 + 86: 0b0.1.010110 0 -1 0.634525 0.634525 + 87: 0b0.1.010111 0 -1 0.641435 0.641435 + 88: 0b0.1.011000 0 -1 0.64842 0.64842 + 89: 0b0.1.011001 0 -1 0.655481 0.655481 + 90: 0b0.1.011010 0 -1 0.662618 0.662618 + 91: 0b0.1.011011 0 -1 0.669834 0.669834 + 92: 0b0.1.011100 0 -1 0.677128 0.677128 + 93: 0b0.1.011101 0 -1 0.684501 0.684501 + 94: 0b0.1.011110 0 -1 0.691955 0.691955 + 95: 0b0.1.011111 0 -1 0.69949 0.69949 + 96: 0b0.1.100000 0 -1 0.707107 0.707107 + 97: 0b0.1.100001 0 -1 0.714807 0.714807 + 98: 0b0.1.100010 0 -1 0.72259 0.72259 + 99: 0b0.1.100011 0 -1 0.730459 0.730459 + 100: 0b0.1.100100 0 -1 0.738413 0.738413 + 101: 0b0.1.100101 0 -1 0.746454 0.746454 + 102: 0b0.1.100110 0 -1 0.754582 0.754582 + 103: 0b0.1.100111 0 -1 0.762799 0.762799 + 104: 0b0.1.101000 0 -1 0.771105 0.771105 + 105: 0b0.1.101001 0 -1 0.779502 0.779502 + 106: 0b0.1.101010 0 -1 0.78799 0.78799 + 107: 0b0.1.101011 0 -1 0.796571 0.796571 + 108: 0b0.1.101100 0 -1 0.805245 0.805245 + 109: 0b0.1.101101 0 -1 0.814014 0.814014 + 110: 0b0.1.101110 0 -1 0.822878 0.822878 + 111: 0b0.1.101111 0 -1 0.831838 0.831838 + 112: 0b0.1.110000 0 -1 0.840896 0.840896 + 113: 0b0.1.110001 0 -1 0.850053 0.850053 + 114: 0b0.1.110010 0 -1 0.85931 0.85931 + 115: 0b0.1.110011 0 -1 0.868667 0.868667 + 116: 0b0.1.110100 0 -1 0.878126 0.878126 + 117: 0b0.1.110101 0 -1 0.887688 0.887688 + 118: 0b0.1.110110 0 -1 0.897355 0.897355 + 119: 0b0.1.110111 0 -1 0.907126 0.907126 + 120: 0b0.1.111000 0 -1 0.917004 0.917004 + 121: 0b0.1.111001 0 -1 0.92699 0.92699 + 122: 0b0.1.111010 0 -1 0.937084 0.937084 + 123: 0b0.1.111011 0 -1 0.947288 0.947288 + 124: 0b0.1.111100 0 -1 0.957603 0.957603 + 125: 0b0.1.111101 0 -1 0.968031 0.968031 + 126: 0b0.1.111110 0 -1 0.978572 0.978572 + 127: 0b0.1.111111 0 -1 0.989228 0.989228 + 128: 0b1.0.000000 1 0 -1 -1 + 129: 0b1.0.000001 1 0 -1.01089 -1.01089 + 130: 0b1.0.000010 1 0 -1.0219 -1.0219 + 131: 0b1.0.000011 1 0 -1.03302 -1.03302 + 132: 0b1.0.000100 1 0 -1.04427 -1.04427 + 133: 0b1.0.000101 1 0 -1.05565 -1.05565 + 134: 0b1.0.000110 1 0 -1.06714 -1.06714 + 135: 0b1.0.000111 1 0 -1.07876 -1.07876 + 136: 0b1.0.001000 1 0 -1.09051 -1.09051 + 137: 0b1.0.001001 1 0 -1.10238 -1.10238 + 138: 0b1.0.001010 1 0 -1.11439 -1.11439 + 139: 0b1.0.001011 1 0 -1.12652 -1.12652 + 140: 0b1.0.001100 1 0 -1.13879 -1.13879 + 141: 0b1.0.001101 1 0 -1.15119 -1.15119 + 142: 0b1.0.001110 1 0 -1.16372 -1.16372 + 143: 0b1.0.001111 1 0 -1.1764 -1.1764 + 144: 0b1.0.010000 1 0 -1.18921 -1.18921 + 145: 0b1.0.010001 1 0 -1.20216 -1.20216 + 146: 0b1.0.010010 1 0 -1.21525 -1.21525 + 147: 0b1.0.010011 1 0 -1.22848 -1.22848 + 148: 0b1.0.010100 1 0 -1.24186 -1.24186 + 149: 0b1.0.010101 1 0 -1.25538 -1.25538 + 150: 0b1.0.010110 1 0 -1.26905 -1.26905 + 151: 0b1.0.010111 1 0 -1.28287 -1.28287 + 152: 0b1.0.011000 1 0 -1.29684 -1.29684 + 153: 0b1.0.011001 1 0 -1.31096 -1.31096 + 154: 0b1.0.011010 1 0 -1.32524 -1.32524 + 155: 0b1.0.011011 1 0 -1.33967 -1.33967 + 156: 0b1.0.011100 1 0 -1.35426 -1.35426 + 157: 0b1.0.011101 1 0 -1.369 -1.369 + 158: 0b1.0.011110 1 0 -1.38391 -1.38391 + 159: 0b1.0.011111 1 0 -1.39898 -1.39898 + 160: 0b1.0.100000 1 0 -1.41421 -1.41421 + 161: 0b1.0.100001 1 0 -1.42961 -1.42961 + 162: 0b1.0.100010 1 0 -1.44518 -1.44518 + 163: 0b1.0.100011 1 0 -1.46092 -1.46092 + 164: 0b1.0.100100 1 0 -1.47683 -1.47683 + 165: 0b1.0.100101 1 0 -1.49291 -1.49291 + 166: 0b1.0.100110 1 0 -1.50916 -1.50916 + 167: 0b1.0.100111 1 0 -1.5256 -1.5256 + 168: 0b1.0.101000 1 0 -1.54221 -1.54221 + 169: 0b1.0.101001 1 0 -1.559 -1.559 + 170: 0b1.0.101010 1 0 -1.57598 -1.57598 + 171: 0b1.0.101011 1 0 -1.59314 -1.59314 + 172: 0b1.0.101100 1 0 -1.61049 -1.61049 + 173: 0b1.0.101101 1 0 -1.62803 -1.62803 + 174: 0b1.0.101110 1 0 -1.64576 -1.64576 + 175: 0b1.0.101111 1 0 -1.66368 -1.66368 + 176: 0b1.0.110000 1 0 -1.68179 -1.68179 + 177: 0b1.0.110001 1 0 -1.70011 -1.70011 + 178: 0b1.0.110010 1 0 -1.71862 -1.71862 + 179: 0b1.0.110011 1 0 -1.73733 -1.73733 + 180: 0b1.0.110100 1 0 -1.75625 -1.75625 + 181: 0b1.0.110101 1 0 -1.77538 -1.77538 + 182: 0b1.0.110110 1 0 -1.79471 -1.79471 + 183: 0b1.0.110111 1 0 -1.81425 -1.81425 + 184: 0b1.0.111000 1 0 -1.83401 -1.83401 + 185: 0b1.0.111001 1 0 -1.85398 -1.85398 + 186: 0b1.0.111010 1 0 -1.87417 -1.87417 + 187: 0b1.0.111011 1 0 -1.89458 -1.89458 + 188: 0b1.0.111100 1 0 -1.91521 -1.91521 + 189: 0b1.0.111101 1 0 -1.93606 -1.93606 + 190: 0b1.0.111110 1 0 -1.95714 -1.95714 + 191: 0b1.0.111111 1 0 -1.97846 -1.97846 + 192: 0b1.1.000000 1 -1 -nan(ind) -nan(ind) + 193: 0b1.1.000001 1 -1 -0.505445 -0.505445 + 194: 0b1.1.000010 1 -1 -0.510949 -0.510949 + 195: 0b1.1.000011 1 -1 -0.516512 -0.516512 + 196: 0b1.1.000100 1 -1 -0.522137 -0.522137 + 197: 0b1.1.000101 1 -1 -0.527823 -0.527823 + 198: 0b1.1.000110 1 -1 -0.53357 -0.53357 + 199: 0b1.1.000111 1 -1 -0.53938 -0.53938 + 200: 0b1.1.001000 1 -1 -0.545254 -0.545254 + 201: 0b1.1.001001 1 -1 -0.551191 -0.551191 + 202: 0b1.1.001010 1 -1 -0.557193 -0.557193 + 203: 0b1.1.001011 1 -1 -0.563261 -0.563261 + 204: 0b1.1.001100 1 -1 -0.569394 -0.569394 + 205: 0b1.1.001101 1 -1 -0.575595 -0.575595 + 206: 0b1.1.001110 1 -1 -0.581862 -0.581862 + 207: 0b1.1.001111 1 -1 -0.588198 -0.588198 + 208: 0b1.1.010000 1 -1 -0.594604 -0.594604 + 209: 0b1.1.010001 1 -1 -0.601078 -0.601078 + 210: 0b1.1.010010 1 -1 -0.607624 -0.607624 + 211: 0b1.1.010011 1 -1 -0.61424 -0.61424 + 212: 0b1.1.010100 1 -1 -0.620929 -0.620929 + 213: 0b1.1.010101 1 -1 -0.62769 -0.62769 + 214: 0b1.1.010110 1 -1 -0.634525 -0.634525 + 215: 0b1.1.010111 1 -1 -0.641435 -0.641435 + 216: 0b1.1.011000 1 -1 -0.64842 -0.64842 + 217: 0b1.1.011001 1 -1 -0.655481 -0.655481 + 218: 0b1.1.011010 1 -1 -0.662618 -0.662618 + 219: 0b1.1.011011 1 -1 -0.669834 -0.669834 + 220: 0b1.1.011100 1 -1 -0.677128 -0.677128 + 221: 0b1.1.011101 1 -1 -0.684501 -0.684501 + 222: 0b1.1.011110 1 -1 -0.691955 -0.691955 + 223: 0b1.1.011111 1 -1 -0.69949 -0.69949 + 224: 0b1.1.100000 1 -1 -0.707107 -0.707107 + 225: 0b1.1.100001 1 -1 -0.714807 -0.714807 + 226: 0b1.1.100010 1 -1 -0.72259 -0.72259 + 227: 0b1.1.100011 1 -1 -0.730459 -0.730459 + 228: 0b1.1.100100 1 -1 -0.738413 -0.738413 + 229: 0b1.1.100101 1 -1 -0.746454 -0.746454 + 230: 0b1.1.100110 1 -1 -0.754582 -0.754582 + 231: 0b1.1.100111 1 -1 -0.762799 -0.762799 + 232: 0b1.1.101000 1 -1 -0.771105 -0.771105 + 233: 0b1.1.101001 1 -1 -0.779502 -0.779502 + 234: 0b1.1.101010 1 -1 -0.78799 -0.78799 + 235: 0b1.1.101011 1 -1 -0.796571 -0.796571 + 236: 0b1.1.101100 1 -1 -0.805245 -0.805245 + 237: 0b1.1.101101 1 -1 -0.814014 -0.814014 + 238: 0b1.1.101110 1 -1 -0.822878 -0.822878 + 239: 0b1.1.101111 1 -1 -0.831838 -0.831838 + 240: 0b1.1.110000 1 -1 -0.840896 -0.840896 + 241: 0b1.1.110001 1 -1 -0.850053 -0.850053 + 242: 0b1.1.110010 1 -1 -0.85931 -0.85931 + 243: 0b1.1.110011 1 -1 -0.868667 -0.868667 + 244: 0b1.1.110100 1 -1 -0.878126 -0.878126 + 245: 0b1.1.110101 1 -1 -0.887688 -0.887688 + 246: 0b1.1.110110 1 -1 -0.897355 -0.897355 + 247: 0b1.1.110111 1 -1 -0.907126 -0.907126 + 248: 0b1.1.111000 1 -1 -0.917004 -0.917004 + 249: 0b1.1.111001 1 -1 -0.92699 -0.92699 + 250: 0b1.1.111010 1 -1 -0.937084 -0.937084 + 251: 0b1.1.111011 1 -1 -0.947288 -0.947288 + 252: 0b1.1.111100 1 -1 -0.957603 -0.957603 + 253: 0b1.1.111101 1 -1 -0.968031 -0.968031 + 254: 0b1.1.111110 1 -1 -0.978572 -0.978572 + 255: 0b1.1.111111 1 -1 -0.989228 -0.989228 +Generate Value table for an LNS<8,7> in TXT format + # Binary sign scale value format + 0: 0b0..0000000 0 0 1 1 + 1: 0b0..0000001 0 0 1.00543 1.00543 + 2: 0b0..0000010 0 0 1.01089 1.01089 + 3: 0b0..0000011 0 0 1.01638 1.01638 + 4: 0b0..0000100 0 0 1.0219 1.0219 + 5: 0b0..0000101 0 0 1.02745 1.02745 + 6: 0b0..0000110 0 0 1.03302 1.03302 + 7: 0b0..0000111 0 0 1.03863 1.03863 + 8: 0b0..0001000 0 0 1.04427 1.04427 + 9: 0b0..0001001 0 0 1.04994 1.04994 + 10: 0b0..0001010 0 0 1.05565 1.05565 + 11: 0b0..0001011 0 0 1.06138 1.06138 + 12: 0b0..0001100 0 0 1.06714 1.06714 + 13: 0b0..0001101 0 0 1.07293 1.07293 + 14: 0b0..0001110 0 0 1.07876 1.07876 + 15: 0b0..0001111 0 0 1.08462 1.08462 + 16: 0b0..0010000 0 0 1.09051 1.09051 + 17: 0b0..0010001 0 0 1.09643 1.09643 + 18: 0b0..0010010 0 0 1.10238 1.10238 + 19: 0b0..0010011 0 0 1.10837 1.10837 + 20: 0b0..0010100 0 0 1.11439 1.11439 + 21: 0b0..0010101 0 0 1.12044 1.12044 + 22: 0b0..0010110 0 0 1.12652 1.12652 + 23: 0b0..0010111 0 0 1.13264 1.13264 + 24: 0b0..0011000 0 0 1.13879 1.13879 + 25: 0b0..0011001 0 0 1.14497 1.14497 + 26: 0b0..0011010 0 0 1.15119 1.15119 + 27: 0b0..0011011 0 0 1.15744 1.15744 + 28: 0b0..0011100 0 0 1.16372 1.16372 + 29: 0b0..0011101 0 0 1.17004 1.17004 + 30: 0b0..0011110 0 0 1.1764 1.1764 + 31: 0b0..0011111 0 0 1.18278 1.18278 + 32: 0b0..0100000 0 0 1.18921 1.18921 + 33: 0b0..0100001 0 0 1.19566 1.19566 + 34: 0b0..0100010 0 0 1.20216 1.20216 + 35: 0b0..0100011 0 0 1.20868 1.20868 + 36: 0b0..0100100 0 0 1.21525 1.21525 + 37: 0b0..0100101 0 0 1.22185 1.22185 + 38: 0b0..0100110 0 0 1.22848 1.22848 + 39: 0b0..0100111 0 0 1.23515 1.23515 + 40: 0b0..0101000 0 0 1.24186 1.24186 + 41: 0b0..0101001 0 0 1.2486 1.2486 + 42: 0b0..0101010 0 0 1.25538 1.25538 + 43: 0b0..0101011 0 0 1.2622 1.2622 + 44: 0b0..0101100 0 0 1.26905 1.26905 + 45: 0b0..0101101 0 0 1.27594 1.27594 + 46: 0b0..0101110 0 0 1.28287 1.28287 + 47: 0b0..0101111 0 0 1.28984 1.28984 + 48: 0b0..0110000 0 0 1.29684 1.29684 + 49: 0b0..0110001 0 0 1.30388 1.30388 + 50: 0b0..0110010 0 0 1.31096 1.31096 + 51: 0b0..0110011 0 0 1.31808 1.31808 + 52: 0b0..0110100 0 0 1.32524 1.32524 + 53: 0b0..0110101 0 0 1.33243 1.33243 + 54: 0b0..0110110 0 0 1.33967 1.33967 + 55: 0b0..0110111 0 0 1.34694 1.34694 + 56: 0b0..0111000 0 0 1.35426 1.35426 + 57: 0b0..0111001 0 0 1.36161 1.36161 + 58: 0b0..0111010 0 0 1.369 1.369 + 59: 0b0..0111011 0 0 1.37644 1.37644 + 60: 0b0..0111100 0 0 1.38391 1.38391 + 61: 0b0..0111101 0 0 1.39142 1.39142 + 62: 0b0..0111110 0 0 1.39898 1.39898 + 63: 0b0..0111111 0 0 1.40658 1.40658 + 64: 0b0..1000000 0 0 0 0 + 65: 0b0..1000001 0 0 0.710946 0.710946 + 66: 0b0..1000010 0 0 0.714807 0.714807 + 67: 0b0..1000011 0 0 0.718688 0.718688 + 68: 0b0..1000100 0 0 0.72259 0.72259 + 69: 0b0..1000101 0 0 0.726514 0.726514 + 70: 0b0..1000110 0 0 0.730459 0.730459 + 71: 0b0..1000111 0 0 0.734425 0.734425 + 72: 0b0..1001000 0 0 0.738413 0.738413 + 73: 0b0..1001001 0 0 0.742423 0.742423 + 74: 0b0..1001010 0 0 0.746454 0.746454 + 75: 0b0..1001011 0 0 0.750507 0.750507 + 76: 0b0..1001100 0 0 0.754582 0.754582 + 77: 0b0..1001101 0 0 0.75868 0.75868 + 78: 0b0..1001110 0 0 0.762799 0.762799 + 79: 0b0..1001111 0 0 0.766941 0.766941 + 80: 0b0..1010000 0 0 0.771105 0.771105 + 81: 0b0..1010001 0 0 0.775292 0.775292 + 82: 0b0..1010010 0 0 0.779502 0.779502 + 83: 0b0..1010011 0 0 0.783735 0.783735 + 84: 0b0..1010100 0 0 0.78799 0.78799 + 85: 0b0..1010101 0 0 0.792269 0.792269 + 86: 0b0..1010110 0 0 0.796571 0.796571 + 87: 0b0..1010111 0 0 0.800896 0.800896 + 88: 0b0..1011000 0 0 0.805245 0.805245 + 89: 0b0..1011001 0 0 0.809618 0.809618 + 90: 0b0..1011010 0 0 0.814014 0.814014 + 91: 0b0..1011011 0 0 0.818434 0.818434 + 92: 0b0..1011100 0 0 0.822878 0.822878 + 93: 0b0..1011101 0 0 0.827346 0.827346 + 94: 0b0..1011110 0 0 0.831838 0.831838 + 95: 0b0..1011111 0 0 0.836355 0.836355 + 96: 0b0..1100000 0 0 0.840896 0.840896 + 97: 0b0..1100001 0 0 0.845462 0.845462 + 98: 0b0..1100010 0 0 0.850053 0.850053 + 99: 0b0..1100011 0 0 0.854669 0.854669 + 100: 0b0..1100100 0 0 0.85931 0.85931 + 101: 0b0..1100101 0 0 0.863976 0.863976 + 102: 0b0..1100110 0 0 0.868667 0.868667 + 103: 0b0..1100111 0 0 0.873384 0.873384 + 104: 0b0..1101000 0 0 0.878126 0.878126 + 105: 0b0..1101001 0 0 0.882894 0.882894 + 106: 0b0..1101010 0 0 0.887688 0.887688 + 107: 0b0..1101011 0 0 0.892508 0.892508 + 108: 0b0..1101100 0 0 0.897355 0.897355 + 109: 0b0..1101101 0 0 0.902227 0.902227 + 110: 0b0..1101110 0 0 0.907126 0.907126 + 111: 0b0..1101111 0 0 0.912052 0.912052 + 112: 0b0..1110000 0 0 0.917004 0.917004 + 113: 0b0..1110001 0 0 0.921983 0.921983 + 114: 0b0..1110010 0 0 0.92699 0.92699 + 115: 0b0..1110011 0 0 0.932023 0.932023 + 116: 0b0..1110100 0 0 0.937084 0.937084 + 117: 0b0..1110101 0 0 0.942172 0.942172 + 118: 0b0..1110110 0 0 0.947288 0.947288 + 119: 0b0..1110111 0 0 0.952432 0.952432 + 120: 0b0..1111000 0 0 0.957603 0.957603 + 121: 0b0..1111001 0 0 0.962803 0.962803 + 122: 0b0..1111010 0 0 0.968031 0.968031 + 123: 0b0..1111011 0 0 0.973287 0.973287 + 124: 0b0..1111100 0 0 0.978572 0.978572 + 125: 0b0..1111101 0 0 0.983886 0.983886 + 126: 0b0..1111110 0 0 0.989228 0.989228 + 127: 0b0..1111111 0 0 0.994599 0.994599 + 128: 0b1..0000000 1 0 -1 -1 + 129: 0b1..0000001 1 0 -1.00543 -1.00543 + 130: 0b1..0000010 1 0 -1.01089 -1.01089 + 131: 0b1..0000011 1 0 -1.01638 -1.01638 + 132: 0b1..0000100 1 0 -1.0219 -1.0219 + 133: 0b1..0000101 1 0 -1.02745 -1.02745 + 134: 0b1..0000110 1 0 -1.03302 -1.03302 + 135: 0b1..0000111 1 0 -1.03863 -1.03863 + 136: 0b1..0001000 1 0 -1.04427 -1.04427 + 137: 0b1..0001001 1 0 -1.04994 -1.04994 + 138: 0b1..0001010 1 0 -1.05565 -1.05565 + 139: 0b1..0001011 1 0 -1.06138 -1.06138 + 140: 0b1..0001100 1 0 -1.06714 -1.06714 + 141: 0b1..0001101 1 0 -1.07293 -1.07293 + 142: 0b1..0001110 1 0 -1.07876 -1.07876 + 143: 0b1..0001111 1 0 -1.08462 -1.08462 + 144: 0b1..0010000 1 0 -1.09051 -1.09051 + 145: 0b1..0010001 1 0 -1.09643 -1.09643 + 146: 0b1..0010010 1 0 -1.10238 -1.10238 + 147: 0b1..0010011 1 0 -1.10837 -1.10837 + 148: 0b1..0010100 1 0 -1.11439 -1.11439 + 149: 0b1..0010101 1 0 -1.12044 -1.12044 + 150: 0b1..0010110 1 0 -1.12652 -1.12652 + 151: 0b1..0010111 1 0 -1.13264 -1.13264 + 152: 0b1..0011000 1 0 -1.13879 -1.13879 + 153: 0b1..0011001 1 0 -1.14497 -1.14497 + 154: 0b1..0011010 1 0 -1.15119 -1.15119 + 155: 0b1..0011011 1 0 -1.15744 -1.15744 + 156: 0b1..0011100 1 0 -1.16372 -1.16372 + 157: 0b1..0011101 1 0 -1.17004 -1.17004 + 158: 0b1..0011110 1 0 -1.1764 -1.1764 + 159: 0b1..0011111 1 0 -1.18278 -1.18278 + 160: 0b1..0100000 1 0 -1.18921 -1.18921 + 161: 0b1..0100001 1 0 -1.19566 -1.19566 + 162: 0b1..0100010 1 0 -1.20216 -1.20216 + 163: 0b1..0100011 1 0 -1.20868 -1.20868 + 164: 0b1..0100100 1 0 -1.21525 -1.21525 + 165: 0b1..0100101 1 0 -1.22185 -1.22185 + 166: 0b1..0100110 1 0 -1.22848 -1.22848 + 167: 0b1..0100111 1 0 -1.23515 -1.23515 + 168: 0b1..0101000 1 0 -1.24186 -1.24186 + 169: 0b1..0101001 1 0 -1.2486 -1.2486 + 170: 0b1..0101010 1 0 -1.25538 -1.25538 + 171: 0b1..0101011 1 0 -1.2622 -1.2622 + 172: 0b1..0101100 1 0 -1.26905 -1.26905 + 173: 0b1..0101101 1 0 -1.27594 -1.27594 + 174: 0b1..0101110 1 0 -1.28287 -1.28287 + 175: 0b1..0101111 1 0 -1.28984 -1.28984 + 176: 0b1..0110000 1 0 -1.29684 -1.29684 + 177: 0b1..0110001 1 0 -1.30388 -1.30388 + 178: 0b1..0110010 1 0 -1.31096 -1.31096 + 179: 0b1..0110011 1 0 -1.31808 -1.31808 + 180: 0b1..0110100 1 0 -1.32524 -1.32524 + 181: 0b1..0110101 1 0 -1.33243 -1.33243 + 182: 0b1..0110110 1 0 -1.33967 -1.33967 + 183: 0b1..0110111 1 0 -1.34694 -1.34694 + 184: 0b1..0111000 1 0 -1.35426 -1.35426 + 185: 0b1..0111001 1 0 -1.36161 -1.36161 + 186: 0b1..0111010 1 0 -1.369 -1.369 + 187: 0b1..0111011 1 0 -1.37644 -1.37644 + 188: 0b1..0111100 1 0 -1.38391 -1.38391 + 189: 0b1..0111101 1 0 -1.39142 -1.39142 + 190: 0b1..0111110 1 0 -1.39898 -1.39898 + 191: 0b1..0111111 1 0 -1.40658 -1.40658 + 192: 0b1..1000000 1 0 -nan(ind) -nan(ind) + 193: 0b1..1000001 1 0 -0.710946 -0.710946 + 194: 0b1..1000010 1 0 -0.714807 -0.714807 + 195: 0b1..1000011 1 0 -0.718688 -0.718688 + 196: 0b1..1000100 1 0 -0.72259 -0.72259 + 197: 0b1..1000101 1 0 -0.726514 -0.726514 + 198: 0b1..1000110 1 0 -0.730459 -0.730459 + 199: 0b1..1000111 1 0 -0.734425 -0.734425 + 200: 0b1..1001000 1 0 -0.738413 -0.738413 + 201: 0b1..1001001 1 0 -0.742423 -0.742423 + 202: 0b1..1001010 1 0 -0.746454 -0.746454 + 203: 0b1..1001011 1 0 -0.750507 -0.750507 + 204: 0b1..1001100 1 0 -0.754582 -0.754582 + 205: 0b1..1001101 1 0 -0.75868 -0.75868 + 206: 0b1..1001110 1 0 -0.762799 -0.762799 + 207: 0b1..1001111 1 0 -0.766941 -0.766941 + 208: 0b1..1010000 1 0 -0.771105 -0.771105 + 209: 0b1..1010001 1 0 -0.775292 -0.775292 + 210: 0b1..1010010 1 0 -0.779502 -0.779502 + 211: 0b1..1010011 1 0 -0.783735 -0.783735 + 212: 0b1..1010100 1 0 -0.78799 -0.78799 + 213: 0b1..1010101 1 0 -0.792269 -0.792269 + 214: 0b1..1010110 1 0 -0.796571 -0.796571 + 215: 0b1..1010111 1 0 -0.800896 -0.800896 + 216: 0b1..1011000 1 0 -0.805245 -0.805245 + 217: 0b1..1011001 1 0 -0.809618 -0.809618 + 218: 0b1..1011010 1 0 -0.814014 -0.814014 + 219: 0b1..1011011 1 0 -0.818434 -0.818434 + 220: 0b1..1011100 1 0 -0.822878 -0.822878 + 221: 0b1..1011101 1 0 -0.827346 -0.827346 + 222: 0b1..1011110 1 0 -0.831838 -0.831838 + 223: 0b1..1011111 1 0 -0.836355 -0.836355 + 224: 0b1..1100000 1 0 -0.840896 -0.840896 + 225: 0b1..1100001 1 0 -0.845462 -0.845462 + 226: 0b1..1100010 1 0 -0.850053 -0.850053 + 227: 0b1..1100011 1 0 -0.854669 -0.854669 + 228: 0b1..1100100 1 0 -0.85931 -0.85931 + 229: 0b1..1100101 1 0 -0.863976 -0.863976 + 230: 0b1..1100110 1 0 -0.868667 -0.868667 + 231: 0b1..1100111 1 0 -0.873384 -0.873384 + 232: 0b1..1101000 1 0 -0.878126 -0.878126 + 233: 0b1..1101001 1 0 -0.882894 -0.882894 + 234: 0b1..1101010 1 0 -0.887688 -0.887688 + 235: 0b1..1101011 1 0 -0.892508 -0.892508 + 236: 0b1..1101100 1 0 -0.897355 -0.897355 + 237: 0b1..1101101 1 0 -0.902227 -0.902227 + 238: 0b1..1101110 1 0 -0.907126 -0.907126 + 239: 0b1..1101111 1 0 -0.912052 -0.912052 + 240: 0b1..1110000 1 0 -0.917004 -0.917004 + 241: 0b1..1110001 1 0 -0.921983 -0.921983 + 242: 0b1..1110010 1 0 -0.92699 -0.92699 + 243: 0b1..1110011 1 0 -0.932023 -0.932023 + 244: 0b1..1110100 1 0 -0.937084 -0.937084 + 245: 0b1..1110101 1 0 -0.942172 -0.942172 + 246: 0b1..1110110 1 0 -0.947288 -0.947288 + 247: 0b1..1110111 1 0 -0.952432 -0.952432 + 248: 0b1..1111000 1 0 -0.957603 -0.957603 + 249: 0b1..1111001 1 0 -0.962803 -0.962803 + 250: 0b1..1111010 1 0 -0.968031 -0.968031 + 251: 0b1..1111011 1 0 -0.973287 -0.973287 + 252: 0b1..1111100 1 0 -0.978572 -0.978572 + 253: 0b1..1111101 1 0 -0.983886 -0.983886 + 254: 0b1..1111110 1 0 -0.989228 -0.989228 + 255: 0b1..1111111 1 0 -0.994599 -0.994599 +Generate Value table for an LNS<9,2> in TXT format + # Binary sign scale value format + 0: 0b0.000000.00 0 0 1 1 + 1: 0b0.000000.01 0 0 1.18921 1.18921 + 2: 0b0.000000.10 0 0 1.41421 1.41421 + 3: 0b0.000000.11 0 0 1.68179 1.68179 + 4: 0b0.000001.00 0 1 2 2 + 5: 0b0.000001.01 0 1 2.37841 2.37841 + 6: 0b0.000001.10 0 1 2.82843 2.82843 + 7: 0b0.000001.11 0 1 3.36359 3.36359 + 8: 0b0.000010.00 0 2 4 4 + 9: 0b0.000010.01 0 2 4.75683 4.75683 + 10: 0b0.000010.10 0 2 5.65685 5.65685 + 11: 0b0.000010.11 0 2 6.72717 6.72717 + 12: 0b0.000011.00 0 3 8 8 + 13: 0b0.000011.01 0 3 9.51366 9.51366 + 14: 0b0.000011.10 0 3 11.3137 11.3137 + 15: 0b0.000011.11 0 3 13.4543 13.4543 + 16: 0b0.000100.00 0 4 16 16 + 17: 0b0.000100.01 0 4 19.0273 19.0273 + 18: 0b0.000100.10 0 4 22.6274 22.6274 + 19: 0b0.000100.11 0 4 26.9087 26.9087 + 20: 0b0.000101.00 0 5 32 32 + 21: 0b0.000101.01 0 5 38.0546 38.0546 + 22: 0b0.000101.10 0 5 45.2548 45.2548 + 23: 0b0.000101.11 0 5 53.8174 53.8174 + 24: 0b0.000110.00 0 6 64 64 + 25: 0b0.000110.01 0 6 76.1093 76.1093 + 26: 0b0.000110.10 0 6 90.5097 90.5097 + 27: 0b0.000110.11 0 6 107.635 107.635 + 28: 0b0.000111.00 0 7 128 128 + 29: 0b0.000111.01 0 7 152.219 152.219 + 30: 0b0.000111.10 0 7 181.019 181.019 + 31: 0b0.000111.11 0 7 215.269 215.269 + 32: 0b0.001000.00 0 8 256 256 + 33: 0b0.001000.01 0 8 304.437 304.437 + 34: 0b0.001000.10 0 8 362.039 362.039 + 35: 0b0.001000.11 0 8 430.539 430.539 + 36: 0b0.001001.00 0 9 512 512 + 37: 0b0.001001.01 0 9 608.874 608.874 + 38: 0b0.001001.10 0 9 724.077 724.077 + 39: 0b0.001001.11 0 9 861.078 861.078 + 40: 0b0.001010.00 0 10 1024 1024 + 41: 0b0.001010.01 0 10 1217.75 1217.75 + 42: 0b0.001010.10 0 10 1448.15 1448.15 + 43: 0b0.001010.11 0 10 1722.16 1722.16 + 44: 0b0.001011.00 0 11 2048 2048 + 45: 0b0.001011.01 0 11 2435.5 2435.5 + 46: 0b0.001011.10 0 11 2896.31 2896.31 + 47: 0b0.001011.11 0 11 3444.31 3444.31 + 48: 0b0.001100.00 0 12 4096 4096 + 49: 0b0.001100.01 0 12 4870.99 4870.99 + 50: 0b0.001100.10 0 12 5792.62 5792.62 + 51: 0b0.001100.11 0 12 6888.62 6888.62 + 52: 0b0.001101.00 0 13 8192 8192 + 53: 0b0.001101.01 0 13 9741.98 9741.98 + 54: 0b0.001101.10 0 13 11585.2 11585.2 + 55: 0b0.001101.11 0 13 13777.2 13777.2 + 56: 0b0.001110.00 0 14 16384 16384 + 57: 0b0.001110.01 0 14 19484 19484 + 58: 0b0.001110.10 0 14 23170.5 23170.5 + 59: 0b0.001110.11 0 14 27554.5 27554.5 + 60: 0b0.001111.00 0 15 32768 32768 + 61: 0b0.001111.01 0 15 38967.9 38967.9 + 62: 0b0.001111.10 0 15 46341 46341 + 63: 0b0.001111.11 0 15 55109 55109 + 64: 0b0.010000.00 0 16 65536 65536 + 65: 0b0.010000.01 0 16 77935.9 77935.9 + 66: 0b0.010000.10 0 16 92681.9 92681.9 + 67: 0b0.010000.11 0 16 110218 110218 + 68: 0b0.010001.00 0 17 131072 131072 + 69: 0b0.010001.01 0 17 155872 155872 + 70: 0b0.010001.10 0 17 185364 185364 + 71: 0b0.010001.11 0 17 220436 220436 + 72: 0b0.010010.00 0 18 262144 262144 + 73: 0b0.010010.01 0 18 311744 311744 + 74: 0b0.010010.10 0 18 370728 370728 + 75: 0b0.010010.11 0 18 440872 440872 + 76: 0b0.010011.00 0 19 524288 524288 + 77: 0b0.010011.01 0 19 623487 623487 + 78: 0b0.010011.10 0 19 741455 741455 + 79: 0b0.010011.11 0 19 881744 881744 + 80: 0b0.010100.00 0 20 1.04858e+06 1.04858e+06 + 81: 0b0.010100.01 0 20 1.24697e+06 1.24697e+06 + 82: 0b0.010100.10 0 20 1.48291e+06 1.48291e+06 + 83: 0b0.010100.11 0 20 1.76349e+06 1.76349e+06 + 84: 0b0.010101.00 0 21 2.09715e+06 2.09715e+06 + 85: 0b0.010101.01 0 21 2.49395e+06 2.49395e+06 + 86: 0b0.010101.10 0 21 2.96582e+06 2.96582e+06 + 87: 0b0.010101.11 0 21 3.52698e+06 3.52698e+06 + 88: 0b0.010110.00 0 22 4.1943e+06 4.1943e+06 + 89: 0b0.010110.01 0 22 4.9879e+06 4.9879e+06 + 90: 0b0.010110.10 0 22 5.93164e+06 5.93164e+06 + 91: 0b0.010110.11 0 22 7.05395e+06 7.05395e+06 + 92: 0b0.010111.00 0 23 8.38861e+06 8.38861e+06 + 93: 0b0.010111.01 0 23 9.97579e+06 9.97579e+06 + 94: 0b0.010111.10 0 23 1.18633e+07 1.18633e+07 + 95: 0b0.010111.11 0 23 1.41079e+07 1.41079e+07 + 96: 0b0.011000.00 0 24 1.67772e+07 1.67772e+07 + 97: 0b0.011000.01 0 24 1.99516e+07 1.99516e+07 + 98: 0b0.011000.10 0 24 2.37266e+07 2.37266e+07 + 99: 0b0.011000.11 0 24 2.82158e+07 2.82158e+07 + 100: 0b0.011001.00 0 25 3.35544e+07 3.35544e+07 + 101: 0b0.011001.01 0 25 3.99032e+07 3.99032e+07 + 102: 0b0.011001.10 0 25 4.74531e+07 4.74531e+07 + 103: 0b0.011001.11 0 25 5.64316e+07 5.64316e+07 + 104: 0b0.011010.00 0 26 6.71089e+07 6.71089e+07 + 105: 0b0.011010.01 0 26 7.98063e+07 7.98063e+07 + 106: 0b0.011010.10 0 26 9.49063e+07 9.49063e+07 + 107: 0b0.011010.11 0 26 1.12863e+08 1.12863e+08 + 108: 0b0.011011.00 0 27 1.34218e+08 1.34218e+08 + 109: 0b0.011011.01 0 27 1.59613e+08 1.59613e+08 + 110: 0b0.011011.10 0 27 1.89813e+08 1.89813e+08 + 111: 0b0.011011.11 0 27 2.25726e+08 2.25726e+08 + 112: 0b0.011100.00 0 28 2.68435e+08 2.68435e+08 + 113: 0b0.011100.01 0 28 3.19225e+08 3.19225e+08 + 114: 0b0.011100.10 0 28 3.79625e+08 3.79625e+08 + 115: 0b0.011100.11 0 28 4.51453e+08 4.51453e+08 + 116: 0b0.011101.00 0 29 5.36871e+08 5.36871e+08 + 117: 0b0.011101.01 0 29 6.38451e+08 6.38451e+08 + 118: 0b0.011101.10 0 29 7.5925e+08 7.5925e+08 + 119: 0b0.011101.11 0 29 9.02906e+08 9.02906e+08 + 120: 0b0.011110.00 0 30 1.07374e+09 1.07374e+09 + 121: 0b0.011110.01 0 30 1.2769e+09 1.2769e+09 + 122: 0b0.011110.10 0 30 1.5185e+09 1.5185e+09 + 123: 0b0.011110.11 0 30 1.80581e+09 1.80581e+09 + 124: 0b0.011111.00 0 31 2.14748e+09 2.14748e+09 + 125: 0b0.011111.01 0 31 2.5538e+09 2.5538e+09 + 126: 0b0.011111.10 0 31 3.037e+09 3.037e+09 + 127: 0b0.011111.11 0 31 3.61162e+09 3.61162e+09 + 128: 0b0.100000.00 0 -32 0 0 + 129: 0b0.100000.01 0 -32 2.76884e-10 2.76884e-10 + 130: 0b0.100000.10 0 -32 3.29272e-10 3.29272e-10 + 131: 0b0.100000.11 0 -32 3.91573e-10 3.91573e-10 + 132: 0b0.100001.00 0 -31 4.65661e-10 4.65661e-10 + 133: 0b0.100001.01 0 -31 5.53768e-10 5.53768e-10 + 134: 0b0.100001.10 0 -31 6.58545e-10 6.58545e-10 + 135: 0b0.100001.11 0 -31 7.83146e-10 7.83146e-10 + 136: 0b0.100010.00 0 -30 9.31323e-10 9.31323e-10 + 137: 0b0.100010.01 0 -30 1.10754e-09 1.10754e-09 + 138: 0b0.100010.10 0 -30 1.31709e-09 1.31709e-09 + 139: 0b0.100010.11 0 -30 1.56629e-09 1.56629e-09 + 140: 0b0.100011.00 0 -29 1.86265e-09 1.86265e-09 + 141: 0b0.100011.01 0 -29 2.21507e-09 2.21507e-09 + 142: 0b0.100011.10 0 -29 2.63418e-09 2.63418e-09 + 143: 0b0.100011.11 0 -29 3.13258e-09 3.13258e-09 + 144: 0b0.100100.00 0 -28 3.72529e-09 3.72529e-09 + 145: 0b0.100100.01 0 -28 4.43014e-09 4.43014e-09 + 146: 0b0.100100.10 0 -28 5.26836e-09 5.26836e-09 + 147: 0b0.100100.11 0 -28 6.26517e-09 6.26517e-09 + 148: 0b0.100101.00 0 -27 7.45058e-09 7.45058e-09 + 149: 0b0.100101.01 0 -27 8.86028e-09 8.86028e-09 + 150: 0b0.100101.10 0 -27 1.05367e-08 1.05367e-08 + 151: 0b0.100101.11 0 -27 1.25303e-08 1.25303e-08 + 152: 0b0.100110.00 0 -26 1.49012e-08 1.49012e-08 + 153: 0b0.100110.01 0 -26 1.77206e-08 1.77206e-08 + 154: 0b0.100110.10 0 -26 2.10734e-08 2.10734e-08 + 155: 0b0.100110.11 0 -26 2.50607e-08 2.50607e-08 + 156: 0b0.100111.00 0 -25 2.98023e-08 2.98023e-08 + 157: 0b0.100111.01 0 -25 3.54411e-08 3.54411e-08 + 158: 0b0.100111.10 0 -25 4.21468e-08 4.21468e-08 + 159: 0b0.100111.11 0 -25 5.01213e-08 5.01213e-08 + 160: 0b0.101000.00 0 -24 5.96046e-08 5.96046e-08 + 161: 0b0.101000.01 0 -24 7.08823e-08 7.08823e-08 + 162: 0b0.101000.10 0 -24 8.42937e-08 8.42937e-08 + 163: 0b0.101000.11 0 -24 1.00243e-07 1.00243e-07 + 164: 0b0.101001.00 0 -23 1.19209e-07 1.19209e-07 + 165: 0b0.101001.01 0 -23 1.41765e-07 1.41765e-07 + 166: 0b0.101001.10 0 -23 1.68587e-07 1.68587e-07 + 167: 0b0.101001.11 0 -23 2.00485e-07 2.00485e-07 + 168: 0b0.101010.00 0 -22 2.38419e-07 2.38419e-07 + 169: 0b0.101010.01 0 -22 2.83529e-07 2.83529e-07 + 170: 0b0.101010.10 0 -22 3.37175e-07 3.37175e-07 + 171: 0b0.101010.11 0 -22 4.00971e-07 4.00971e-07 + 172: 0b0.101011.00 0 -21 4.76837e-07 4.76837e-07 + 173: 0b0.101011.01 0 -21 5.67058e-07 5.67058e-07 + 174: 0b0.101011.10 0 -21 6.7435e-07 6.7435e-07 + 175: 0b0.101011.11 0 -21 8.01941e-07 8.01941e-07 + 176: 0b0.101100.00 0 -20 9.53674e-07 9.53674e-07 + 177: 0b0.101100.01 0 -20 1.13412e-06 1.13412e-06 + 178: 0b0.101100.10 0 -20 1.3487e-06 1.3487e-06 + 179: 0b0.101100.11 0 -20 1.60388e-06 1.60388e-06 + 180: 0b0.101101.00 0 -19 1.90735e-06 1.90735e-06 + 181: 0b0.101101.01 0 -19 2.26823e-06 2.26823e-06 + 182: 0b0.101101.10 0 -19 2.6974e-06 2.6974e-06 + 183: 0b0.101101.11 0 -19 3.20777e-06 3.20777e-06 + 184: 0b0.101110.00 0 -18 3.8147e-06 3.8147e-06 + 185: 0b0.101110.01 0 -18 4.53647e-06 4.53647e-06 + 186: 0b0.101110.10 0 -18 5.3948e-06 5.3948e-06 + 187: 0b0.101110.11 0 -18 6.41553e-06 6.41553e-06 + 188: 0b0.101111.00 0 -17 7.62939e-06 7.62939e-06 + 189: 0b0.101111.01 0 -17 9.07293e-06 9.07293e-06 + 190: 0b0.101111.10 0 -17 1.07896e-05 1.07896e-05 + 191: 0b0.101111.11 0 -17 1.28311e-05 1.28311e-05 + 192: 0b0.110000.00 0 -16 1.52588e-05 1.52588e-05 + 193: 0b0.110000.01 0 -16 1.81459e-05 1.81459e-05 + 194: 0b0.110000.10 0 -16 2.15792e-05 2.15792e-05 + 195: 0b0.110000.11 0 -16 2.56621e-05 2.56621e-05 + 196: 0b0.110001.00 0 -15 3.05176e-05 3.05176e-05 + 197: 0b0.110001.01 0 -15 3.62917e-05 3.62917e-05 + 198: 0b0.110001.10 0 -15 4.31584e-05 4.31584e-05 + 199: 0b0.110001.11 0 -15 5.13242e-05 5.13242e-05 + 200: 0b0.110010.00 0 -14 6.10352e-05 6.10352e-05 + 201: 0b0.110010.01 0 -14 7.25834e-05 7.25834e-05 + 202: 0b0.110010.10 0 -14 8.63167e-05 8.63167e-05 + 203: 0b0.110010.11 0 -14 0.000102648 0.000102648 + 204: 0b0.110011.00 0 -13 0.00012207 0.00012207 + 205: 0b0.110011.01 0 -13 0.000145167 0.000145167 + 206: 0b0.110011.10 0 -13 0.000172633 0.000172633 + 207: 0b0.110011.11 0 -13 0.000205297 0.000205297 + 208: 0b0.110100.00 0 -12 0.000244141 0.000244141 + 209: 0b0.110100.01 0 -12 0.000290334 0.000290334 + 210: 0b0.110100.10 0 -12 0.000345267 0.000345267 + 211: 0b0.110100.11 0 -12 0.000410594 0.000410594 + 212: 0b0.110101.00 0 -11 0.000488281 0.000488281 + 213: 0b0.110101.01 0 -11 0.000580668 0.000580668 + 214: 0b0.110101.10 0 -11 0.000690534 0.000690534 + 215: 0b0.110101.11 0 -11 0.000821188 0.000821188 + 216: 0b0.110110.00 0 -10 0.000976562 0.000976562 + 217: 0b0.110110.01 0 -10 0.00116134 0.00116134 + 218: 0b0.110110.10 0 -10 0.00138107 0.00138107 + 219: 0b0.110110.11 0 -10 0.00164238 0.00164238 + 220: 0b0.110111.00 0 -9 0.00195312 0.00195312 + 221: 0b0.110111.01 0 -9 0.00232267 0.00232267 + 222: 0b0.110111.10 0 -9 0.00276214 0.00276214 + 223: 0b0.110111.11 0 -9 0.00328475 0.00328475 + 224: 0b0.111000.00 0 -8 0.00390625 0.00390625 + 225: 0b0.111000.01 0 -8 0.00464534 0.00464534 + 226: 0b0.111000.10 0 -8 0.00552427 0.00552427 + 227: 0b0.111000.11 0 -8 0.0065695 0.0065695 + 228: 0b0.111001.00 0 -7 0.0078125 0.0078125 + 229: 0b0.111001.01 0 -7 0.00929068 0.00929068 + 230: 0b0.111001.10 0 -7 0.0110485 0.0110485 + 231: 0b0.111001.11 0 -7 0.013139 0.013139 + 232: 0b0.111010.00 0 -6 0.015625 0.015625 + 233: 0b0.111010.01 0 -6 0.0185814 0.0185814 + 234: 0b0.111010.10 0 -6 0.0220971 0.0220971 + 235: 0b0.111010.11 0 -6 0.026278 0.026278 + 236: 0b0.111011.00 0 -5 0.03125 0.03125 + 237: 0b0.111011.01 0 -5 0.0371627 0.0371627 + 238: 0b0.111011.10 0 -5 0.0441942 0.0441942 + 239: 0b0.111011.11 0 -5 0.052556 0.052556 + 240: 0b0.111100.00 0 -4 0.0625 0.0625 + 241: 0b0.111100.01 0 -4 0.0743254 0.0743254 + 242: 0b0.111100.10 0 -4 0.0883883 0.0883883 + 243: 0b0.111100.11 0 -4 0.105112 0.105112 + 244: 0b0.111101.00 0 -3 0.125 0.125 + 245: 0b0.111101.01 0 -3 0.148651 0.148651 + 246: 0b0.111101.10 0 -3 0.176777 0.176777 + 247: 0b0.111101.11 0 -3 0.210224 0.210224 + 248: 0b0.111110.00 0 -2 0.25 0.25 + 249: 0b0.111110.01 0 -2 0.297302 0.297302 + 250: 0b0.111110.10 0 -2 0.353553 0.353553 + 251: 0b0.111110.11 0 -2 0.420448 0.420448 + 252: 0b0.111111.00 0 -1 0.5 0.5 + 253: 0b0.111111.01 0 -1 0.594604 0.594604 + 254: 0b0.111111.10 0 -1 0.707107 0.707107 + 255: 0b0.111111.11 0 -1 0.840896 0.840896 + 256: 0b1.000000.00 1 0 -1 -1 + 257: 0b1.000000.01 1 0 -1.18921 -1.18921 + 258: 0b1.000000.10 1 0 -1.41421 -1.41421 + 259: 0b1.000000.11 1 0 -1.68179 -1.68179 + 260: 0b1.000001.00 1 1 -2 -2 + 261: 0b1.000001.01 1 1 -2.37841 -2.37841 + 262: 0b1.000001.10 1 1 -2.82843 -2.82843 + 263: 0b1.000001.11 1 1 -3.36359 -3.36359 + 264: 0b1.000010.00 1 2 -4 -4 + 265: 0b1.000010.01 1 2 -4.75683 -4.75683 + 266: 0b1.000010.10 1 2 -5.65685 -5.65685 + 267: 0b1.000010.11 1 2 -6.72717 -6.72717 + 268: 0b1.000011.00 1 3 -8 -8 + 269: 0b1.000011.01 1 3 -9.51366 -9.51366 + 270: 0b1.000011.10 1 3 -11.3137 -11.3137 + 271: 0b1.000011.11 1 3 -13.4543 -13.4543 + 272: 0b1.000100.00 1 4 -16 -16 + 273: 0b1.000100.01 1 4 -19.0273 -19.0273 + 274: 0b1.000100.10 1 4 -22.6274 -22.6274 + 275: 0b1.000100.11 1 4 -26.9087 -26.9087 + 276: 0b1.000101.00 1 5 -32 -32 + 277: 0b1.000101.01 1 5 -38.0546 -38.0546 + 278: 0b1.000101.10 1 5 -45.2548 -45.2548 + 279: 0b1.000101.11 1 5 -53.8174 -53.8174 + 280: 0b1.000110.00 1 6 -64 -64 + 281: 0b1.000110.01 1 6 -76.1093 -76.1093 + 282: 0b1.000110.10 1 6 -90.5097 -90.5097 + 283: 0b1.000110.11 1 6 -107.635 -107.635 + 284: 0b1.000111.00 1 7 -128 -128 + 285: 0b1.000111.01 1 7 -152.219 -152.219 + 286: 0b1.000111.10 1 7 -181.019 -181.019 + 287: 0b1.000111.11 1 7 -215.269 -215.269 + 288: 0b1.001000.00 1 8 -256 -256 + 289: 0b1.001000.01 1 8 -304.437 -304.437 + 290: 0b1.001000.10 1 8 -362.039 -362.039 + 291: 0b1.001000.11 1 8 -430.539 -430.539 + 292: 0b1.001001.00 1 9 -512 -512 + 293: 0b1.001001.01 1 9 -608.874 -608.874 + 294: 0b1.001001.10 1 9 -724.077 -724.077 + 295: 0b1.001001.11 1 9 -861.078 -861.078 + 296: 0b1.001010.00 1 10 -1024 -1024 + 297: 0b1.001010.01 1 10 -1217.75 -1217.75 + 298: 0b1.001010.10 1 10 -1448.15 -1448.15 + 299: 0b1.001010.11 1 10 -1722.16 -1722.16 + 300: 0b1.001011.00 1 11 -2048 -2048 + 301: 0b1.001011.01 1 11 -2435.5 -2435.5 + 302: 0b1.001011.10 1 11 -2896.31 -2896.31 + 303: 0b1.001011.11 1 11 -3444.31 -3444.31 + 304: 0b1.001100.00 1 12 -4096 -4096 + 305: 0b1.001100.01 1 12 -4870.99 -4870.99 + 306: 0b1.001100.10 1 12 -5792.62 -5792.62 + 307: 0b1.001100.11 1 12 -6888.62 -6888.62 + 308: 0b1.001101.00 1 13 -8192 -8192 + 309: 0b1.001101.01 1 13 -9741.98 -9741.98 + 310: 0b1.001101.10 1 13 -11585.2 -11585.2 + 311: 0b1.001101.11 1 13 -13777.2 -13777.2 + 312: 0b1.001110.00 1 14 -16384 -16384 + 313: 0b1.001110.01 1 14 -19484 -19484 + 314: 0b1.001110.10 1 14 -23170.5 -23170.5 + 315: 0b1.001110.11 1 14 -27554.5 -27554.5 + 316: 0b1.001111.00 1 15 -32768 -32768 + 317: 0b1.001111.01 1 15 -38967.9 -38967.9 + 318: 0b1.001111.10 1 15 -46341 -46341 + 319: 0b1.001111.11 1 15 -55109 -55109 + 320: 0b1.010000.00 1 16 -65536 -65536 + 321: 0b1.010000.01 1 16 -77935.9 -77935.9 + 322: 0b1.010000.10 1 16 -92681.9 -92681.9 + 323: 0b1.010000.11 1 16 -110218 -110218 + 324: 0b1.010001.00 1 17 -131072 -131072 + 325: 0b1.010001.01 1 17 -155872 -155872 + 326: 0b1.010001.10 1 17 -185364 -185364 + 327: 0b1.010001.11 1 17 -220436 -220436 + 328: 0b1.010010.00 1 18 -262144 -262144 + 329: 0b1.010010.01 1 18 -311744 -311744 + 330: 0b1.010010.10 1 18 -370728 -370728 + 331: 0b1.010010.11 1 18 -440872 -440872 + 332: 0b1.010011.00 1 19 -524288 -524288 + 333: 0b1.010011.01 1 19 -623487 -623487 + 334: 0b1.010011.10 1 19 -741455 -741455 + 335: 0b1.010011.11 1 19 -881744 -881744 + 336: 0b1.010100.00 1 20 -1.04858e+06 -1.04858e+06 + 337: 0b1.010100.01 1 20 -1.24697e+06 -1.24697e+06 + 338: 0b1.010100.10 1 20 -1.48291e+06 -1.48291e+06 + 339: 0b1.010100.11 1 20 -1.76349e+06 -1.76349e+06 + 340: 0b1.010101.00 1 21 -2.09715e+06 -2.09715e+06 + 341: 0b1.010101.01 1 21 -2.49395e+06 -2.49395e+06 + 342: 0b1.010101.10 1 21 -2.96582e+06 -2.96582e+06 + 343: 0b1.010101.11 1 21 -3.52698e+06 -3.52698e+06 + 344: 0b1.010110.00 1 22 -4.1943e+06 -4.1943e+06 + 345: 0b1.010110.01 1 22 -4.9879e+06 -4.9879e+06 + 346: 0b1.010110.10 1 22 -5.93164e+06 -5.93164e+06 + 347: 0b1.010110.11 1 22 -7.05395e+06 -7.05395e+06 + 348: 0b1.010111.00 1 23 -8.38861e+06 -8.38861e+06 + 349: 0b1.010111.01 1 23 -9.97579e+06 -9.97579e+06 + 350: 0b1.010111.10 1 23 -1.18633e+07 -1.18633e+07 + 351: 0b1.010111.11 1 23 -1.41079e+07 -1.41079e+07 + 352: 0b1.011000.00 1 24 -1.67772e+07 -1.67772e+07 + 353: 0b1.011000.01 1 24 -1.99516e+07 -1.99516e+07 + 354: 0b1.011000.10 1 24 -2.37266e+07 -2.37266e+07 + 355: 0b1.011000.11 1 24 -2.82158e+07 -2.82158e+07 + 356: 0b1.011001.00 1 25 -3.35544e+07 -3.35544e+07 + 357: 0b1.011001.01 1 25 -3.99032e+07 -3.99032e+07 + 358: 0b1.011001.10 1 25 -4.74531e+07 -4.74531e+07 + 359: 0b1.011001.11 1 25 -5.64316e+07 -5.64316e+07 + 360: 0b1.011010.00 1 26 -6.71089e+07 -6.71089e+07 + 361: 0b1.011010.01 1 26 -7.98063e+07 -7.98063e+07 + 362: 0b1.011010.10 1 26 -9.49063e+07 -9.49063e+07 + 363: 0b1.011010.11 1 26 -1.12863e+08 -1.12863e+08 + 364: 0b1.011011.00 1 27 -1.34218e+08 -1.34218e+08 + 365: 0b1.011011.01 1 27 -1.59613e+08 -1.59613e+08 + 366: 0b1.011011.10 1 27 -1.89813e+08 -1.89813e+08 + 367: 0b1.011011.11 1 27 -2.25726e+08 -2.25726e+08 + 368: 0b1.011100.00 1 28 -2.68435e+08 -2.68435e+08 + 369: 0b1.011100.01 1 28 -3.19225e+08 -3.19225e+08 + 370: 0b1.011100.10 1 28 -3.79625e+08 -3.79625e+08 + 371: 0b1.011100.11 1 28 -4.51453e+08 -4.51453e+08 + 372: 0b1.011101.00 1 29 -5.36871e+08 -5.36871e+08 + 373: 0b1.011101.01 1 29 -6.38451e+08 -6.38451e+08 + 374: 0b1.011101.10 1 29 -7.5925e+08 -7.5925e+08 + 375: 0b1.011101.11 1 29 -9.02906e+08 -9.02906e+08 + 376: 0b1.011110.00 1 30 -1.07374e+09 -1.07374e+09 + 377: 0b1.011110.01 1 30 -1.2769e+09 -1.2769e+09 + 378: 0b1.011110.10 1 30 -1.5185e+09 -1.5185e+09 + 379: 0b1.011110.11 1 30 -1.80581e+09 -1.80581e+09 + 380: 0b1.011111.00 1 31 -2.14748e+09 -2.14748e+09 + 381: 0b1.011111.01 1 31 -2.5538e+09 -2.5538e+09 + 382: 0b1.011111.10 1 31 -3.037e+09 -3.037e+09 + 383: 0b1.011111.11 1 31 -3.61162e+09 -3.61162e+09 + 384: 0b1.100000.00 1 -32 -nan(ind) -nan(ind) + 385: 0b1.100000.01 1 -32 -2.76884e-10 -2.76884e-10 + 386: 0b1.100000.10 1 -32 -3.29272e-10 -3.29272e-10 + 387: 0b1.100000.11 1 -32 -3.91573e-10 -3.91573e-10 + 388: 0b1.100001.00 1 -31 -4.65661e-10 -4.65661e-10 + 389: 0b1.100001.01 1 -31 -5.53768e-10 -5.53768e-10 + 390: 0b1.100001.10 1 -31 -6.58545e-10 -6.58545e-10 + 391: 0b1.100001.11 1 -31 -7.83146e-10 -7.83146e-10 + 392: 0b1.100010.00 1 -30 -9.31323e-10 -9.31323e-10 + 393: 0b1.100010.01 1 -30 -1.10754e-09 -1.10754e-09 + 394: 0b1.100010.10 1 -30 -1.31709e-09 -1.31709e-09 + 395: 0b1.100010.11 1 -30 -1.56629e-09 -1.56629e-09 + 396: 0b1.100011.00 1 -29 -1.86265e-09 -1.86265e-09 + 397: 0b1.100011.01 1 -29 -2.21507e-09 -2.21507e-09 + 398: 0b1.100011.10 1 -29 -2.63418e-09 -2.63418e-09 + 399: 0b1.100011.11 1 -29 -3.13258e-09 -3.13258e-09 + 400: 0b1.100100.00 1 -28 -3.72529e-09 -3.72529e-09 + 401: 0b1.100100.01 1 -28 -4.43014e-09 -4.43014e-09 + 402: 0b1.100100.10 1 -28 -5.26836e-09 -5.26836e-09 + 403: 0b1.100100.11 1 -28 -6.26517e-09 -6.26517e-09 + 404: 0b1.100101.00 1 -27 -7.45058e-09 -7.45058e-09 + 405: 0b1.100101.01 1 -27 -8.86028e-09 -8.86028e-09 + 406: 0b1.100101.10 1 -27 -1.05367e-08 -1.05367e-08 + 407: 0b1.100101.11 1 -27 -1.25303e-08 -1.25303e-08 + 408: 0b1.100110.00 1 -26 -1.49012e-08 -1.49012e-08 + 409: 0b1.100110.01 1 -26 -1.77206e-08 -1.77206e-08 + 410: 0b1.100110.10 1 -26 -2.10734e-08 -2.10734e-08 + 411: 0b1.100110.11 1 -26 -2.50607e-08 -2.50607e-08 + 412: 0b1.100111.00 1 -25 -2.98023e-08 -2.98023e-08 + 413: 0b1.100111.01 1 -25 -3.54411e-08 -3.54411e-08 + 414: 0b1.100111.10 1 -25 -4.21468e-08 -4.21468e-08 + 415: 0b1.100111.11 1 -25 -5.01213e-08 -5.01213e-08 + 416: 0b1.101000.00 1 -24 -5.96046e-08 -5.96046e-08 + 417: 0b1.101000.01 1 -24 -7.08823e-08 -7.08823e-08 + 418: 0b1.101000.10 1 -24 -8.42937e-08 -8.42937e-08 + 419: 0b1.101000.11 1 -24 -1.00243e-07 -1.00243e-07 + 420: 0b1.101001.00 1 -23 -1.19209e-07 -1.19209e-07 + 421: 0b1.101001.01 1 -23 -1.41765e-07 -1.41765e-07 + 422: 0b1.101001.10 1 -23 -1.68587e-07 -1.68587e-07 + 423: 0b1.101001.11 1 -23 -2.00485e-07 -2.00485e-07 + 424: 0b1.101010.00 1 -22 -2.38419e-07 -2.38419e-07 + 425: 0b1.101010.01 1 -22 -2.83529e-07 -2.83529e-07 + 426: 0b1.101010.10 1 -22 -3.37175e-07 -3.37175e-07 + 427: 0b1.101010.11 1 -22 -4.00971e-07 -4.00971e-07 + 428: 0b1.101011.00 1 -21 -4.76837e-07 -4.76837e-07 + 429: 0b1.101011.01 1 -21 -5.67058e-07 -5.67058e-07 + 430: 0b1.101011.10 1 -21 -6.7435e-07 -6.7435e-07 + 431: 0b1.101011.11 1 -21 -8.01941e-07 -8.01941e-07 + 432: 0b1.101100.00 1 -20 -9.53674e-07 -9.53674e-07 + 433: 0b1.101100.01 1 -20 -1.13412e-06 -1.13412e-06 + 434: 0b1.101100.10 1 -20 -1.3487e-06 -1.3487e-06 + 435: 0b1.101100.11 1 -20 -1.60388e-06 -1.60388e-06 + 436: 0b1.101101.00 1 -19 -1.90735e-06 -1.90735e-06 + 437: 0b1.101101.01 1 -19 -2.26823e-06 -2.26823e-06 + 438: 0b1.101101.10 1 -19 -2.6974e-06 -2.6974e-06 + 439: 0b1.101101.11 1 -19 -3.20777e-06 -3.20777e-06 + 440: 0b1.101110.00 1 -18 -3.8147e-06 -3.8147e-06 + 441: 0b1.101110.01 1 -18 -4.53647e-06 -4.53647e-06 + 442: 0b1.101110.10 1 -18 -5.3948e-06 -5.3948e-06 + 443: 0b1.101110.11 1 -18 -6.41553e-06 -6.41553e-06 + 444: 0b1.101111.00 1 -17 -7.62939e-06 -7.62939e-06 + 445: 0b1.101111.01 1 -17 -9.07293e-06 -9.07293e-06 + 446: 0b1.101111.10 1 -17 -1.07896e-05 -1.07896e-05 + 447: 0b1.101111.11 1 -17 -1.28311e-05 -1.28311e-05 + 448: 0b1.110000.00 1 -16 -1.52588e-05 -1.52588e-05 + 449: 0b1.110000.01 1 -16 -1.81459e-05 -1.81459e-05 + 450: 0b1.110000.10 1 -16 -2.15792e-05 -2.15792e-05 + 451: 0b1.110000.11 1 -16 -2.56621e-05 -2.56621e-05 + 452: 0b1.110001.00 1 -15 -3.05176e-05 -3.05176e-05 + 453: 0b1.110001.01 1 -15 -3.62917e-05 -3.62917e-05 + 454: 0b1.110001.10 1 -15 -4.31584e-05 -4.31584e-05 + 455: 0b1.110001.11 1 -15 -5.13242e-05 -5.13242e-05 + 456: 0b1.110010.00 1 -14 -6.10352e-05 -6.10352e-05 + 457: 0b1.110010.01 1 -14 -7.25834e-05 -7.25834e-05 + 458: 0b1.110010.10 1 -14 -8.63167e-05 -8.63167e-05 + 459: 0b1.110010.11 1 -14 -0.000102648 -0.000102648 + 460: 0b1.110011.00 1 -13 -0.00012207 -0.00012207 + 461: 0b1.110011.01 1 -13 -0.000145167 -0.000145167 + 462: 0b1.110011.10 1 -13 -0.000172633 -0.000172633 + 463: 0b1.110011.11 1 -13 -0.000205297 -0.000205297 + 464: 0b1.110100.00 1 -12 -0.000244141 -0.000244141 + 465: 0b1.110100.01 1 -12 -0.000290334 -0.000290334 + 466: 0b1.110100.10 1 -12 -0.000345267 -0.000345267 + 467: 0b1.110100.11 1 -12 -0.000410594 -0.000410594 + 468: 0b1.110101.00 1 -11 -0.000488281 -0.000488281 + 469: 0b1.110101.01 1 -11 -0.000580668 -0.000580668 + 470: 0b1.110101.10 1 -11 -0.000690534 -0.000690534 + 471: 0b1.110101.11 1 -11 -0.000821188 -0.000821188 + 472: 0b1.110110.00 1 -10 -0.000976562 -0.000976562 + 473: 0b1.110110.01 1 -10 -0.00116134 -0.00116134 + 474: 0b1.110110.10 1 -10 -0.00138107 -0.00138107 + 475: 0b1.110110.11 1 -10 -0.00164238 -0.00164238 + 476: 0b1.110111.00 1 -9 -0.00195312 -0.00195312 + 477: 0b1.110111.01 1 -9 -0.00232267 -0.00232267 + 478: 0b1.110111.10 1 -9 -0.00276214 -0.00276214 + 479: 0b1.110111.11 1 -9 -0.00328475 -0.00328475 + 480: 0b1.111000.00 1 -8 -0.00390625 -0.00390625 + 481: 0b1.111000.01 1 -8 -0.00464534 -0.00464534 + 482: 0b1.111000.10 1 -8 -0.00552427 -0.00552427 + 483: 0b1.111000.11 1 -8 -0.0065695 -0.0065695 + 484: 0b1.111001.00 1 -7 -0.0078125 -0.0078125 + 485: 0b1.111001.01 1 -7 -0.00929068 -0.00929068 + 486: 0b1.111001.10 1 -7 -0.0110485 -0.0110485 + 487: 0b1.111001.11 1 -7 -0.013139 -0.013139 + 488: 0b1.111010.00 1 -6 -0.015625 -0.015625 + 489: 0b1.111010.01 1 -6 -0.0185814 -0.0185814 + 490: 0b1.111010.10 1 -6 -0.0220971 -0.0220971 + 491: 0b1.111010.11 1 -6 -0.026278 -0.026278 + 492: 0b1.111011.00 1 -5 -0.03125 -0.03125 + 493: 0b1.111011.01 1 -5 -0.0371627 -0.0371627 + 494: 0b1.111011.10 1 -5 -0.0441942 -0.0441942 + 495: 0b1.111011.11 1 -5 -0.052556 -0.052556 + 496: 0b1.111100.00 1 -4 -0.0625 -0.0625 + 497: 0b1.111100.01 1 -4 -0.0743254 -0.0743254 + 498: 0b1.111100.10 1 -4 -0.0883883 -0.0883883 + 499: 0b1.111100.11 1 -4 -0.105112 -0.105112 + 500: 0b1.111101.00 1 -3 -0.125 -0.125 + 501: 0b1.111101.01 1 -3 -0.148651 -0.148651 + 502: 0b1.111101.10 1 -3 -0.176777 -0.176777 + 503: 0b1.111101.11 1 -3 -0.210224 -0.210224 + 504: 0b1.111110.00 1 -2 -0.25 -0.25 + 505: 0b1.111110.01 1 -2 -0.297302 -0.297302 + 506: 0b1.111110.10 1 -2 -0.353553 -0.353553 + 507: 0b1.111110.11 1 -2 -0.420448 -0.420448 + 508: 0b1.111111.00 1 -1 -0.5 -0.5 + 509: 0b1.111111.01 1 -1 -0.594604 -0.594604 + 510: 0b1.111111.10 1 -1 -0.707107 -0.707107 + 511: 0b1.111111.11 1 -1 -0.840896 -0.840896 +Generate Value table for an LNS<9,4> in TXT format + # Binary sign scale value format + 0: 0b0.0000.0000 0 0 1 1 + 1: 0b0.0000.0001 0 0 1.04427 1.04427 + 2: 0b0.0000.0010 0 0 1.09051 1.09051 + 3: 0b0.0000.0011 0 0 1.13879 1.13879 + 4: 0b0.0000.0100 0 0 1.18921 1.18921 + 5: 0b0.0000.0101 0 0 1.24186 1.24186 + 6: 0b0.0000.0110 0 0 1.29684 1.29684 + 7: 0b0.0000.0111 0 0 1.35426 1.35426 + 8: 0b0.0000.1000 0 0 1.41421 1.41421 + 9: 0b0.0000.1001 0 0 1.47683 1.47683 + 10: 0b0.0000.1010 0 0 1.54221 1.54221 + 11: 0b0.0000.1011 0 0 1.61049 1.61049 + 12: 0b0.0000.1100 0 0 1.68179 1.68179 + 13: 0b0.0000.1101 0 0 1.75625 1.75625 + 14: 0b0.0000.1110 0 0 1.83401 1.83401 + 15: 0b0.0000.1111 0 0 1.91521 1.91521 + 16: 0b0.0001.0000 0 1 2 2 + 17: 0b0.0001.0001 0 1 2.08855 2.08855 + 18: 0b0.0001.0010 0 1 2.18102 2.18102 + 19: 0b0.0001.0011 0 1 2.27758 2.27758 + 20: 0b0.0001.0100 0 1 2.37841 2.37841 + 21: 0b0.0001.0101 0 1 2.48372 2.48372 + 22: 0b0.0001.0110 0 1 2.59368 2.59368 + 23: 0b0.0001.0111 0 1 2.70851 2.70851 + 24: 0b0.0001.1000 0 1 2.82843 2.82843 + 25: 0b0.0001.1001 0 1 2.95365 2.95365 + 26: 0b0.0001.1010 0 1 3.08442 3.08442 + 27: 0b0.0001.1011 0 1 3.22098 3.22098 + 28: 0b0.0001.1100 0 1 3.36359 3.36359 + 29: 0b0.0001.1101 0 1 3.5125 3.5125 + 30: 0b0.0001.1110 0 1 3.66802 3.66802 + 31: 0b0.0001.1111 0 1 3.83041 3.83041 + 32: 0b0.0010.0000 0 2 4 4 + 33: 0b0.0010.0001 0 2 4.1771 4.1771 + 34: 0b0.0010.0010 0 2 4.36203 4.36203 + 35: 0b0.0010.0011 0 2 4.55515 4.55515 + 36: 0b0.0010.0100 0 2 4.75683 4.75683 + 37: 0b0.0010.0101 0 2 4.96743 4.96743 + 38: 0b0.0010.0110 0 2 5.18736 5.18736 + 39: 0b0.0010.0111 0 2 5.41702 5.41702 + 40: 0b0.0010.1000 0 2 5.65685 5.65685 + 41: 0b0.0010.1001 0 2 5.9073 5.9073 + 42: 0b0.0010.1010 0 2 6.16884 6.16884 + 43: 0b0.0010.1011 0 2 6.44196 6.44196 + 44: 0b0.0010.1100 0 2 6.72717 6.72717 + 45: 0b0.0010.1101 0 2 7.02501 7.02501 + 46: 0b0.0010.1110 0 2 7.33603 7.33603 + 47: 0b0.0010.1111 0 2 7.66083 7.66083 + 48: 0b0.0011.0000 0 3 8 8 + 49: 0b0.0011.0001 0 3 8.35419 8.35419 + 50: 0b0.0011.0010 0 3 8.72406 8.72406 + 51: 0b0.0011.0011 0 3 9.11031 9.11031 + 52: 0b0.0011.0100 0 3 9.51366 9.51366 + 53: 0b0.0011.0101 0 3 9.93486 9.93486 + 54: 0b0.0011.0110 0 3 10.3747 10.3747 + 55: 0b0.0011.0111 0 3 10.834 10.834 + 56: 0b0.0011.1000 0 3 11.3137 11.3137 + 57: 0b0.0011.1001 0 3 11.8146 11.8146 + 58: 0b0.0011.1010 0 3 12.3377 12.3377 + 59: 0b0.0011.1011 0 3 12.8839 12.8839 + 60: 0b0.0011.1100 0 3 13.4543 13.4543 + 61: 0b0.0011.1101 0 3 14.05 14.05 + 62: 0b0.0011.1110 0 3 14.6721 14.6721 + 63: 0b0.0011.1111 0 3 15.3217 15.3217 + 64: 0b0.0100.0000 0 4 16 16 + 65: 0b0.0100.0001 0 4 16.7084 16.7084 + 66: 0b0.0100.0010 0 4 17.4481 17.4481 + 67: 0b0.0100.0011 0 4 18.2206 18.2206 + 68: 0b0.0100.0100 0 4 19.0273 19.0273 + 69: 0b0.0100.0101 0 4 19.8697 19.8697 + 70: 0b0.0100.0110 0 4 20.7494 20.7494 + 71: 0b0.0100.0111 0 4 21.6681 21.6681 + 72: 0b0.0100.1000 0 4 22.6274 22.6274 + 73: 0b0.0100.1001 0 4 23.6292 23.6292 + 74: 0b0.0100.1010 0 4 24.6754 24.6754 + 75: 0b0.0100.1011 0 4 25.7678 25.7678 + 76: 0b0.0100.1100 0 4 26.9087 26.9087 + 77: 0b0.0100.1101 0 4 28.1 28.1 + 78: 0b0.0100.1110 0 4 29.3441 29.3441 + 79: 0b0.0100.1111 0 4 30.6433 30.6433 + 80: 0b0.0101.0000 0 5 32 32 + 81: 0b0.0101.0001 0 5 33.4168 33.4168 + 82: 0b0.0101.0010 0 5 34.8962 34.8962 + 83: 0b0.0101.0011 0 5 36.4412 36.4412 + 84: 0b0.0101.0100 0 5 38.0546 38.0546 + 85: 0b0.0101.0101 0 5 39.7394 39.7394 + 86: 0b0.0101.0110 0 5 41.4989 41.4989 + 87: 0b0.0101.0111 0 5 43.3362 43.3362 + 88: 0b0.0101.1000 0 5 45.2548 45.2548 + 89: 0b0.0101.1001 0 5 47.2584 47.2584 + 90: 0b0.0101.1010 0 5 49.3507 49.3507 + 91: 0b0.0101.1011 0 5 51.5357 51.5357 + 92: 0b0.0101.1100 0 5 53.8174 53.8174 + 93: 0b0.0101.1101 0 5 56.2001 56.2001 + 94: 0b0.0101.1110 0 5 58.6883 58.6883 + 95: 0b0.0101.1111 0 5 61.2866 61.2866 + 96: 0b0.0110.0000 0 6 64 64 + 97: 0b0.0110.0001 0 6 66.8335 66.8335 + 98: 0b0.0110.0010 0 6 69.7925 69.7925 + 99: 0b0.0110.0011 0 6 72.8825 72.8825 + 100: 0b0.0110.0100 0 6 76.1093 76.1093 + 101: 0b0.0110.0101 0 6 79.4789 79.4789 + 102: 0b0.0110.0110 0 6 82.9977 82.9977 + 103: 0b0.0110.0111 0 6 86.6724 86.6724 + 104: 0b0.0110.1000 0 6 90.5097 90.5097 + 105: 0b0.0110.1001 0 6 94.5169 94.5169 + 106: 0b0.0110.1010 0 6 98.7015 98.7015 + 107: 0b0.0110.1011 0 6 103.071 103.071 + 108: 0b0.0110.1100 0 6 107.635 107.635 + 109: 0b0.0110.1101 0 6 112.4 112.4 + 110: 0b0.0110.1110 0 6 117.377 117.377 + 111: 0b0.0110.1111 0 6 122.573 122.573 + 112: 0b0.0111.0000 0 7 128 128 + 113: 0b0.0111.0001 0 7 133.667 133.667 + 114: 0b0.0111.0010 0 7 139.585 139.585 + 115: 0b0.0111.0011 0 7 145.765 145.765 + 116: 0b0.0111.0100 0 7 152.219 152.219 + 117: 0b0.0111.0101 0 7 158.958 158.958 + 118: 0b0.0111.0110 0 7 165.995 165.995 + 119: 0b0.0111.0111 0 7 173.345 173.345 + 120: 0b0.0111.1000 0 7 181.019 181.019 + 121: 0b0.0111.1001 0 7 189.034 189.034 + 122: 0b0.0111.1010 0 7 197.403 197.403 + 123: 0b0.0111.1011 0 7 206.143 206.143 + 124: 0b0.0111.1100 0 7 215.269 215.269 + 125: 0b0.0111.1101 0 7 224.8 224.8 + 126: 0b0.0111.1110 0 7 234.753 234.753 + 127: 0b0.0111.1111 0 7 245.146 245.146 + 128: 0b0.1000.0000 0 -8 0 0 + 129: 0b0.1000.0001 0 -8 0.00407919 0.00407919 + 130: 0b0.1000.0010 0 -8 0.0042598 0.0042598 + 131: 0b0.1000.0011 0 -8 0.00444839 0.00444839 + 132: 0b0.1000.0100 0 -8 0.00464534 0.00464534 + 133: 0b0.1000.0101 0 -8 0.00485101 0.00485101 + 134: 0b0.1000.0110 0 -8 0.00506578 0.00506578 + 135: 0b0.1000.0111 0 -8 0.00529006 0.00529006 + 136: 0b0.1000.1000 0 -8 0.00552427 0.00552427 + 137: 0b0.1000.1001 0 -8 0.00576885 0.00576885 + 138: 0b0.1000.1010 0 -8 0.00602426 0.00602426 + 139: 0b0.1000.1011 0 -8 0.00629098 0.00629098 + 140: 0b0.1000.1100 0 -8 0.0065695 0.0065695 + 141: 0b0.1000.1101 0 -8 0.00686036 0.00686036 + 142: 0b0.1000.1110 0 -8 0.00716409 0.00716409 + 143: 0b0.1000.1111 0 -8 0.00748128 0.00748128 + 144: 0b0.1001.0000 0 -7 0.0078125 0.0078125 + 145: 0b0.1001.0001 0 -7 0.00815839 0.00815839 + 146: 0b0.1001.0010 0 -7 0.00851959 0.00851959 + 147: 0b0.1001.0011 0 -7 0.00889679 0.00889679 + 148: 0b0.1001.0100 0 -7 0.00929068 0.00929068 + 149: 0b0.1001.0101 0 -7 0.00970201 0.00970201 + 150: 0b0.1001.0110 0 -7 0.0101316 0.0101316 + 151: 0b0.1001.0111 0 -7 0.0105801 0.0105801 + 152: 0b0.1001.1000 0 -7 0.0110485 0.0110485 + 153: 0b0.1001.1001 0 -7 0.0115377 0.0115377 + 154: 0b0.1001.1010 0 -7 0.0120485 0.0120485 + 155: 0b0.1001.1011 0 -7 0.012582 0.012582 + 156: 0b0.1001.1100 0 -7 0.013139 0.013139 + 157: 0b0.1001.1101 0 -7 0.0137207 0.0137207 + 158: 0b0.1001.1110 0 -7 0.0143282 0.0143282 + 159: 0b0.1001.1111 0 -7 0.0149626 0.0149626 + 160: 0b0.1010.0000 0 -6 0.015625 0.015625 + 161: 0b0.1010.0001 0 -6 0.0163168 0.0163168 + 162: 0b0.1010.0010 0 -6 0.0170392 0.0170392 + 163: 0b0.1010.0011 0 -6 0.0177936 0.0177936 + 164: 0b0.1010.0100 0 -6 0.0185814 0.0185814 + 165: 0b0.1010.0101 0 -6 0.019404 0.019404 + 166: 0b0.1010.0110 0 -6 0.0202631 0.0202631 + 167: 0b0.1010.0111 0 -6 0.0211602 0.0211602 + 168: 0b0.1010.1000 0 -6 0.0220971 0.0220971 + 169: 0b0.1010.1001 0 -6 0.0230754 0.0230754 + 170: 0b0.1010.1010 0 -6 0.024097 0.024097 + 171: 0b0.1010.1011 0 -6 0.0251639 0.0251639 + 172: 0b0.1010.1100 0 -6 0.026278 0.026278 + 173: 0b0.1010.1101 0 -6 0.0274414 0.0274414 + 174: 0b0.1010.1110 0 -6 0.0286564 0.0286564 + 175: 0b0.1010.1111 0 -6 0.0299251 0.0299251 + 176: 0b0.1011.0000 0 -5 0.03125 0.03125 + 177: 0b0.1011.0001 0 -5 0.0326336 0.0326336 + 178: 0b0.1011.0010 0 -5 0.0340784 0.0340784 + 179: 0b0.1011.0011 0 -5 0.0355871 0.0355871 + 180: 0b0.1011.0100 0 -5 0.0371627 0.0371627 + 181: 0b0.1011.0101 0 -5 0.0388081 0.0388081 + 182: 0b0.1011.0110 0 -5 0.0405262 0.0405262 + 183: 0b0.1011.0111 0 -5 0.0423205 0.0423205 + 184: 0b0.1011.1000 0 -5 0.0441942 0.0441942 + 185: 0b0.1011.1001 0 -5 0.0461508 0.0461508 + 186: 0b0.1011.1010 0 -5 0.0481941 0.0481941 + 187: 0b0.1011.1011 0 -5 0.0503278 0.0503278 + 188: 0b0.1011.1100 0 -5 0.052556 0.052556 + 189: 0b0.1011.1101 0 -5 0.0548829 0.0548829 + 190: 0b0.1011.1110 0 -5 0.0573128 0.0573128 + 191: 0b0.1011.1111 0 -5 0.0598502 0.0598502 + 192: 0b0.1100.0000 0 -4 0.0625 0.0625 + 193: 0b0.1100.0001 0 -4 0.0652671 0.0652671 + 194: 0b0.1100.0010 0 -4 0.0681567 0.0681567 + 195: 0b0.1100.0011 0 -4 0.0711743 0.0711743 + 196: 0b0.1100.0100 0 -4 0.0743254 0.0743254 + 197: 0b0.1100.0101 0 -4 0.0776161 0.0776161 + 198: 0b0.1100.0110 0 -4 0.0810525 0.0810525 + 199: 0b0.1100.0111 0 -4 0.084641 0.084641 + 200: 0b0.1100.1000 0 -4 0.0883883 0.0883883 + 201: 0b0.1100.1001 0 -4 0.0923016 0.0923016 + 202: 0b0.1100.1010 0 -4 0.0963882 0.0963882 + 203: 0b0.1100.1011 0 -4 0.100656 0.100656 + 204: 0b0.1100.1100 0 -4 0.105112 0.105112 + 205: 0b0.1100.1101 0 -4 0.109766 0.109766 + 206: 0b0.1100.1110 0 -4 0.114626 0.114626 + 207: 0b0.1100.1111 0 -4 0.1197 0.1197 + 208: 0b0.1101.0000 0 -3 0.125 0.125 + 209: 0b0.1101.0001 0 -3 0.130534 0.130534 + 210: 0b0.1101.0010 0 -3 0.136313 0.136313 + 211: 0b0.1101.0011 0 -3 0.142349 0.142349 + 212: 0b0.1101.0100 0 -3 0.148651 0.148651 + 213: 0b0.1101.0101 0 -3 0.155232 0.155232 + 214: 0b0.1101.0110 0 -3 0.162105 0.162105 + 215: 0b0.1101.0111 0 -3 0.169282 0.169282 + 216: 0b0.1101.1000 0 -3 0.176777 0.176777 + 217: 0b0.1101.1001 0 -3 0.184603 0.184603 + 218: 0b0.1101.1010 0 -3 0.192776 0.192776 + 219: 0b0.1101.1011 0 -3 0.201311 0.201311 + 220: 0b0.1101.1100 0 -3 0.210224 0.210224 + 221: 0b0.1101.1101 0 -3 0.219532 0.219532 + 222: 0b0.1101.1110 0 -3 0.229251 0.229251 + 223: 0b0.1101.1111 0 -3 0.239401 0.239401 + 224: 0b0.1110.0000 0 -2 0.25 0.25 + 225: 0b0.1110.0001 0 -2 0.261068 0.261068 + 226: 0b0.1110.0010 0 -2 0.272627 0.272627 + 227: 0b0.1110.0011 0 -2 0.284697 0.284697 + 228: 0b0.1110.0100 0 -2 0.297302 0.297302 + 229: 0b0.1110.0101 0 -2 0.310464 0.310464 + 230: 0b0.1110.0110 0 -2 0.32421 0.32421 + 231: 0b0.1110.0111 0 -2 0.338564 0.338564 + 232: 0b0.1110.1000 0 -2 0.353553 0.353553 + 233: 0b0.1110.1001 0 -2 0.369207 0.369207 + 234: 0b0.1110.1010 0 -2 0.385553 0.385553 + 235: 0b0.1110.1011 0 -2 0.402623 0.402623 + 236: 0b0.1110.1100 0 -2 0.420448 0.420448 + 237: 0b0.1110.1101 0 -2 0.439063 0.439063 + 238: 0b0.1110.1110 0 -2 0.458502 0.458502 + 239: 0b0.1110.1111 0 -2 0.478802 0.478802 + 240: 0b0.1111.0000 0 -1 0.5 0.5 + 241: 0b0.1111.0001 0 -1 0.522137 0.522137 + 242: 0b0.1111.0010 0 -1 0.545254 0.545254 + 243: 0b0.1111.0011 0 -1 0.569394 0.569394 + 244: 0b0.1111.0100 0 -1 0.594604 0.594604 + 245: 0b0.1111.0101 0 -1 0.620929 0.620929 + 246: 0b0.1111.0110 0 -1 0.64842 0.64842 + 247: 0b0.1111.0111 0 -1 0.677128 0.677128 + 248: 0b0.1111.1000 0 -1 0.707107 0.707107 + 249: 0b0.1111.1001 0 -1 0.738413 0.738413 + 250: 0b0.1111.1010 0 -1 0.771105 0.771105 + 251: 0b0.1111.1011 0 -1 0.805245 0.805245 + 252: 0b0.1111.1100 0 -1 0.840896 0.840896 + 253: 0b0.1111.1101 0 -1 0.878126 0.878126 + 254: 0b0.1111.1110 0 -1 0.917004 0.917004 + 255: 0b0.1111.1111 0 -1 0.957603 0.957603 + 256: 0b1.0000.0000 1 0 -1 -1 + 257: 0b1.0000.0001 1 0 -1.04427 -1.04427 + 258: 0b1.0000.0010 1 0 -1.09051 -1.09051 + 259: 0b1.0000.0011 1 0 -1.13879 -1.13879 + 260: 0b1.0000.0100 1 0 -1.18921 -1.18921 + 261: 0b1.0000.0101 1 0 -1.24186 -1.24186 + 262: 0b1.0000.0110 1 0 -1.29684 -1.29684 + 263: 0b1.0000.0111 1 0 -1.35426 -1.35426 + 264: 0b1.0000.1000 1 0 -1.41421 -1.41421 + 265: 0b1.0000.1001 1 0 -1.47683 -1.47683 + 266: 0b1.0000.1010 1 0 -1.54221 -1.54221 + 267: 0b1.0000.1011 1 0 -1.61049 -1.61049 + 268: 0b1.0000.1100 1 0 -1.68179 -1.68179 + 269: 0b1.0000.1101 1 0 -1.75625 -1.75625 + 270: 0b1.0000.1110 1 0 -1.83401 -1.83401 + 271: 0b1.0000.1111 1 0 -1.91521 -1.91521 + 272: 0b1.0001.0000 1 1 -2 -2 + 273: 0b1.0001.0001 1 1 -2.08855 -2.08855 + 274: 0b1.0001.0010 1 1 -2.18102 -2.18102 + 275: 0b1.0001.0011 1 1 -2.27758 -2.27758 + 276: 0b1.0001.0100 1 1 -2.37841 -2.37841 + 277: 0b1.0001.0101 1 1 -2.48372 -2.48372 + 278: 0b1.0001.0110 1 1 -2.59368 -2.59368 + 279: 0b1.0001.0111 1 1 -2.70851 -2.70851 + 280: 0b1.0001.1000 1 1 -2.82843 -2.82843 + 281: 0b1.0001.1001 1 1 -2.95365 -2.95365 + 282: 0b1.0001.1010 1 1 -3.08442 -3.08442 + 283: 0b1.0001.1011 1 1 -3.22098 -3.22098 + 284: 0b1.0001.1100 1 1 -3.36359 -3.36359 + 285: 0b1.0001.1101 1 1 -3.5125 -3.5125 + 286: 0b1.0001.1110 1 1 -3.66802 -3.66802 + 287: 0b1.0001.1111 1 1 -3.83041 -3.83041 + 288: 0b1.0010.0000 1 2 -4 -4 + 289: 0b1.0010.0001 1 2 -4.1771 -4.1771 + 290: 0b1.0010.0010 1 2 -4.36203 -4.36203 + 291: 0b1.0010.0011 1 2 -4.55515 -4.55515 + 292: 0b1.0010.0100 1 2 -4.75683 -4.75683 + 293: 0b1.0010.0101 1 2 -4.96743 -4.96743 + 294: 0b1.0010.0110 1 2 -5.18736 -5.18736 + 295: 0b1.0010.0111 1 2 -5.41702 -5.41702 + 296: 0b1.0010.1000 1 2 -5.65685 -5.65685 + 297: 0b1.0010.1001 1 2 -5.9073 -5.9073 + 298: 0b1.0010.1010 1 2 -6.16884 -6.16884 + 299: 0b1.0010.1011 1 2 -6.44196 -6.44196 + 300: 0b1.0010.1100 1 2 -6.72717 -6.72717 + 301: 0b1.0010.1101 1 2 -7.02501 -7.02501 + 302: 0b1.0010.1110 1 2 -7.33603 -7.33603 + 303: 0b1.0010.1111 1 2 -7.66083 -7.66083 + 304: 0b1.0011.0000 1 3 -8 -8 + 305: 0b1.0011.0001 1 3 -8.35419 -8.35419 + 306: 0b1.0011.0010 1 3 -8.72406 -8.72406 + 307: 0b1.0011.0011 1 3 -9.11031 -9.11031 + 308: 0b1.0011.0100 1 3 -9.51366 -9.51366 + 309: 0b1.0011.0101 1 3 -9.93486 -9.93486 + 310: 0b1.0011.0110 1 3 -10.3747 -10.3747 + 311: 0b1.0011.0111 1 3 -10.834 -10.834 + 312: 0b1.0011.1000 1 3 -11.3137 -11.3137 + 313: 0b1.0011.1001 1 3 -11.8146 -11.8146 + 314: 0b1.0011.1010 1 3 -12.3377 -12.3377 + 315: 0b1.0011.1011 1 3 -12.8839 -12.8839 + 316: 0b1.0011.1100 1 3 -13.4543 -13.4543 + 317: 0b1.0011.1101 1 3 -14.05 -14.05 + 318: 0b1.0011.1110 1 3 -14.6721 -14.6721 + 319: 0b1.0011.1111 1 3 -15.3217 -15.3217 + 320: 0b1.0100.0000 1 4 -16 -16 + 321: 0b1.0100.0001 1 4 -16.7084 -16.7084 + 322: 0b1.0100.0010 1 4 -17.4481 -17.4481 + 323: 0b1.0100.0011 1 4 -18.2206 -18.2206 + 324: 0b1.0100.0100 1 4 -19.0273 -19.0273 + 325: 0b1.0100.0101 1 4 -19.8697 -19.8697 + 326: 0b1.0100.0110 1 4 -20.7494 -20.7494 + 327: 0b1.0100.0111 1 4 -21.6681 -21.6681 + 328: 0b1.0100.1000 1 4 -22.6274 -22.6274 + 329: 0b1.0100.1001 1 4 -23.6292 -23.6292 + 330: 0b1.0100.1010 1 4 -24.6754 -24.6754 + 331: 0b1.0100.1011 1 4 -25.7678 -25.7678 + 332: 0b1.0100.1100 1 4 -26.9087 -26.9087 + 333: 0b1.0100.1101 1 4 -28.1 -28.1 + 334: 0b1.0100.1110 1 4 -29.3441 -29.3441 + 335: 0b1.0100.1111 1 4 -30.6433 -30.6433 + 336: 0b1.0101.0000 1 5 -32 -32 + 337: 0b1.0101.0001 1 5 -33.4168 -33.4168 + 338: 0b1.0101.0010 1 5 -34.8962 -34.8962 + 339: 0b1.0101.0011 1 5 -36.4412 -36.4412 + 340: 0b1.0101.0100 1 5 -38.0546 -38.0546 + 341: 0b1.0101.0101 1 5 -39.7394 -39.7394 + 342: 0b1.0101.0110 1 5 -41.4989 -41.4989 + 343: 0b1.0101.0111 1 5 -43.3362 -43.3362 + 344: 0b1.0101.1000 1 5 -45.2548 -45.2548 + 345: 0b1.0101.1001 1 5 -47.2584 -47.2584 + 346: 0b1.0101.1010 1 5 -49.3507 -49.3507 + 347: 0b1.0101.1011 1 5 -51.5357 -51.5357 + 348: 0b1.0101.1100 1 5 -53.8174 -53.8174 + 349: 0b1.0101.1101 1 5 -56.2001 -56.2001 + 350: 0b1.0101.1110 1 5 -58.6883 -58.6883 + 351: 0b1.0101.1111 1 5 -61.2866 -61.2866 + 352: 0b1.0110.0000 1 6 -64 -64 + 353: 0b1.0110.0001 1 6 -66.8335 -66.8335 + 354: 0b1.0110.0010 1 6 -69.7925 -69.7925 + 355: 0b1.0110.0011 1 6 -72.8825 -72.8825 + 356: 0b1.0110.0100 1 6 -76.1093 -76.1093 + 357: 0b1.0110.0101 1 6 -79.4789 -79.4789 + 358: 0b1.0110.0110 1 6 -82.9977 -82.9977 + 359: 0b1.0110.0111 1 6 -86.6724 -86.6724 + 360: 0b1.0110.1000 1 6 -90.5097 -90.5097 + 361: 0b1.0110.1001 1 6 -94.5169 -94.5169 + 362: 0b1.0110.1010 1 6 -98.7015 -98.7015 + 363: 0b1.0110.1011 1 6 -103.071 -103.071 + 364: 0b1.0110.1100 1 6 -107.635 -107.635 + 365: 0b1.0110.1101 1 6 -112.4 -112.4 + 366: 0b1.0110.1110 1 6 -117.377 -117.377 + 367: 0b1.0110.1111 1 6 -122.573 -122.573 + 368: 0b1.0111.0000 1 7 -128 -128 + 369: 0b1.0111.0001 1 7 -133.667 -133.667 + 370: 0b1.0111.0010 1 7 -139.585 -139.585 + 371: 0b1.0111.0011 1 7 -145.765 -145.765 + 372: 0b1.0111.0100 1 7 -152.219 -152.219 + 373: 0b1.0111.0101 1 7 -158.958 -158.958 + 374: 0b1.0111.0110 1 7 -165.995 -165.995 + 375: 0b1.0111.0111 1 7 -173.345 -173.345 + 376: 0b1.0111.1000 1 7 -181.019 -181.019 + 377: 0b1.0111.1001 1 7 -189.034 -189.034 + 378: 0b1.0111.1010 1 7 -197.403 -197.403 + 379: 0b1.0111.1011 1 7 -206.143 -206.143 + 380: 0b1.0111.1100 1 7 -215.269 -215.269 + 381: 0b1.0111.1101 1 7 -224.8 -224.8 + 382: 0b1.0111.1110 1 7 -234.753 -234.753 + 383: 0b1.0111.1111 1 7 -245.146 -245.146 + 384: 0b1.1000.0000 1 -8 -nan(ind) -nan(ind) + 385: 0b1.1000.0001 1 -8 -0.00407919 -0.00407919 + 386: 0b1.1000.0010 1 -8 -0.0042598 -0.0042598 + 387: 0b1.1000.0011 1 -8 -0.00444839 -0.00444839 + 388: 0b1.1000.0100 1 -8 -0.00464534 -0.00464534 + 389: 0b1.1000.0101 1 -8 -0.00485101 -0.00485101 + 390: 0b1.1000.0110 1 -8 -0.00506578 -0.00506578 + 391: 0b1.1000.0111 1 -8 -0.00529006 -0.00529006 + 392: 0b1.1000.1000 1 -8 -0.00552427 -0.00552427 + 393: 0b1.1000.1001 1 -8 -0.00576885 -0.00576885 + 394: 0b1.1000.1010 1 -8 -0.00602426 -0.00602426 + 395: 0b1.1000.1011 1 -8 -0.00629098 -0.00629098 + 396: 0b1.1000.1100 1 -8 -0.0065695 -0.0065695 + 397: 0b1.1000.1101 1 -8 -0.00686036 -0.00686036 + 398: 0b1.1000.1110 1 -8 -0.00716409 -0.00716409 + 399: 0b1.1000.1111 1 -8 -0.00748128 -0.00748128 + 400: 0b1.1001.0000 1 -7 -0.0078125 -0.0078125 + 401: 0b1.1001.0001 1 -7 -0.00815839 -0.00815839 + 402: 0b1.1001.0010 1 -7 -0.00851959 -0.00851959 + 403: 0b1.1001.0011 1 -7 -0.00889679 -0.00889679 + 404: 0b1.1001.0100 1 -7 -0.00929068 -0.00929068 + 405: 0b1.1001.0101 1 -7 -0.00970201 -0.00970201 + 406: 0b1.1001.0110 1 -7 -0.0101316 -0.0101316 + 407: 0b1.1001.0111 1 -7 -0.0105801 -0.0105801 + 408: 0b1.1001.1000 1 -7 -0.0110485 -0.0110485 + 409: 0b1.1001.1001 1 -7 -0.0115377 -0.0115377 + 410: 0b1.1001.1010 1 -7 -0.0120485 -0.0120485 + 411: 0b1.1001.1011 1 -7 -0.012582 -0.012582 + 412: 0b1.1001.1100 1 -7 -0.013139 -0.013139 + 413: 0b1.1001.1101 1 -7 -0.0137207 -0.0137207 + 414: 0b1.1001.1110 1 -7 -0.0143282 -0.0143282 + 415: 0b1.1001.1111 1 -7 -0.0149626 -0.0149626 + 416: 0b1.1010.0000 1 -6 -0.015625 -0.015625 + 417: 0b1.1010.0001 1 -6 -0.0163168 -0.0163168 + 418: 0b1.1010.0010 1 -6 -0.0170392 -0.0170392 + 419: 0b1.1010.0011 1 -6 -0.0177936 -0.0177936 + 420: 0b1.1010.0100 1 -6 -0.0185814 -0.0185814 + 421: 0b1.1010.0101 1 -6 -0.019404 -0.019404 + 422: 0b1.1010.0110 1 -6 -0.0202631 -0.0202631 + 423: 0b1.1010.0111 1 -6 -0.0211602 -0.0211602 + 424: 0b1.1010.1000 1 -6 -0.0220971 -0.0220971 + 425: 0b1.1010.1001 1 -6 -0.0230754 -0.0230754 + 426: 0b1.1010.1010 1 -6 -0.024097 -0.024097 + 427: 0b1.1010.1011 1 -6 -0.0251639 -0.0251639 + 428: 0b1.1010.1100 1 -6 -0.026278 -0.026278 + 429: 0b1.1010.1101 1 -6 -0.0274414 -0.0274414 + 430: 0b1.1010.1110 1 -6 -0.0286564 -0.0286564 + 431: 0b1.1010.1111 1 -6 -0.0299251 -0.0299251 + 432: 0b1.1011.0000 1 -5 -0.03125 -0.03125 + 433: 0b1.1011.0001 1 -5 -0.0326336 -0.0326336 + 434: 0b1.1011.0010 1 -5 -0.0340784 -0.0340784 + 435: 0b1.1011.0011 1 -5 -0.0355871 -0.0355871 + 436: 0b1.1011.0100 1 -5 -0.0371627 -0.0371627 + 437: 0b1.1011.0101 1 -5 -0.0388081 -0.0388081 + 438: 0b1.1011.0110 1 -5 -0.0405262 -0.0405262 + 439: 0b1.1011.0111 1 -5 -0.0423205 -0.0423205 + 440: 0b1.1011.1000 1 -5 -0.0441942 -0.0441942 + 441: 0b1.1011.1001 1 -5 -0.0461508 -0.0461508 + 442: 0b1.1011.1010 1 -5 -0.0481941 -0.0481941 + 443: 0b1.1011.1011 1 -5 -0.0503278 -0.0503278 + 444: 0b1.1011.1100 1 -5 -0.052556 -0.052556 + 445: 0b1.1011.1101 1 -5 -0.0548829 -0.0548829 + 446: 0b1.1011.1110 1 -5 -0.0573128 -0.0573128 + 447: 0b1.1011.1111 1 -5 -0.0598502 -0.0598502 + 448: 0b1.1100.0000 1 -4 -0.0625 -0.0625 + 449: 0b1.1100.0001 1 -4 -0.0652671 -0.0652671 + 450: 0b1.1100.0010 1 -4 -0.0681567 -0.0681567 + 451: 0b1.1100.0011 1 -4 -0.0711743 -0.0711743 + 452: 0b1.1100.0100 1 -4 -0.0743254 -0.0743254 + 453: 0b1.1100.0101 1 -4 -0.0776161 -0.0776161 + 454: 0b1.1100.0110 1 -4 -0.0810525 -0.0810525 + 455: 0b1.1100.0111 1 -4 -0.084641 -0.084641 + 456: 0b1.1100.1000 1 -4 -0.0883883 -0.0883883 + 457: 0b1.1100.1001 1 -4 -0.0923016 -0.0923016 + 458: 0b1.1100.1010 1 -4 -0.0963882 -0.0963882 + 459: 0b1.1100.1011 1 -4 -0.100656 -0.100656 + 460: 0b1.1100.1100 1 -4 -0.105112 -0.105112 + 461: 0b1.1100.1101 1 -4 -0.109766 -0.109766 + 462: 0b1.1100.1110 1 -4 -0.114626 -0.114626 + 463: 0b1.1100.1111 1 -4 -0.1197 -0.1197 + 464: 0b1.1101.0000 1 -3 -0.125 -0.125 + 465: 0b1.1101.0001 1 -3 -0.130534 -0.130534 + 466: 0b1.1101.0010 1 -3 -0.136313 -0.136313 + 467: 0b1.1101.0011 1 -3 -0.142349 -0.142349 + 468: 0b1.1101.0100 1 -3 -0.148651 -0.148651 + 469: 0b1.1101.0101 1 -3 -0.155232 -0.155232 + 470: 0b1.1101.0110 1 -3 -0.162105 -0.162105 + 471: 0b1.1101.0111 1 -3 -0.169282 -0.169282 + 472: 0b1.1101.1000 1 -3 -0.176777 -0.176777 + 473: 0b1.1101.1001 1 -3 -0.184603 -0.184603 + 474: 0b1.1101.1010 1 -3 -0.192776 -0.192776 + 475: 0b1.1101.1011 1 -3 -0.201311 -0.201311 + 476: 0b1.1101.1100 1 -3 -0.210224 -0.210224 + 477: 0b1.1101.1101 1 -3 -0.219532 -0.219532 + 478: 0b1.1101.1110 1 -3 -0.229251 -0.229251 + 479: 0b1.1101.1111 1 -3 -0.239401 -0.239401 + 480: 0b1.1110.0000 1 -2 -0.25 -0.25 + 481: 0b1.1110.0001 1 -2 -0.261068 -0.261068 + 482: 0b1.1110.0010 1 -2 -0.272627 -0.272627 + 483: 0b1.1110.0011 1 -2 -0.284697 -0.284697 + 484: 0b1.1110.0100 1 -2 -0.297302 -0.297302 + 485: 0b1.1110.0101 1 -2 -0.310464 -0.310464 + 486: 0b1.1110.0110 1 -2 -0.32421 -0.32421 + 487: 0b1.1110.0111 1 -2 -0.338564 -0.338564 + 488: 0b1.1110.1000 1 -2 -0.353553 -0.353553 + 489: 0b1.1110.1001 1 -2 -0.369207 -0.369207 + 490: 0b1.1110.1010 1 -2 -0.385553 -0.385553 + 491: 0b1.1110.1011 1 -2 -0.402623 -0.402623 + 492: 0b1.1110.1100 1 -2 -0.420448 -0.420448 + 493: 0b1.1110.1101 1 -2 -0.439063 -0.439063 + 494: 0b1.1110.1110 1 -2 -0.458502 -0.458502 + 495: 0b1.1110.1111 1 -2 -0.478802 -0.478802 + 496: 0b1.1111.0000 1 -1 -0.5 -0.5 + 497: 0b1.1111.0001 1 -1 -0.522137 -0.522137 + 498: 0b1.1111.0010 1 -1 -0.545254 -0.545254 + 499: 0b1.1111.0011 1 -1 -0.569394 -0.569394 + 500: 0b1.1111.0100 1 -1 -0.594604 -0.594604 + 501: 0b1.1111.0101 1 -1 -0.620929 -0.620929 + 502: 0b1.1111.0110 1 -1 -0.64842 -0.64842 + 503: 0b1.1111.0111 1 -1 -0.677128 -0.677128 + 504: 0b1.1111.1000 1 -1 -0.707107 -0.707107 + 505: 0b1.1111.1001 1 -1 -0.738413 -0.738413 + 506: 0b1.1111.1010 1 -1 -0.771105 -0.771105 + 507: 0b1.1111.1011 1 -1 -0.805245 -0.805245 + 508: 0b1.1111.1100 1 -1 -0.840896 -0.840896 + 509: 0b1.1111.1101 1 -1 -0.878126 -0.878126 + 510: 0b1.1111.1110 1 -1 -0.917004 -0.917004 + 511: 0b1.1111.1111 1 -1 -0.957603 -0.957603 +Generate Value table for an LNS<9,6> in TXT format + # Binary sign scale value format + 0: 0b0.00.000000 0 0 1 1 + 1: 0b0.00.000001 0 0 1.01089 1.01089 + 2: 0b0.00.000010 0 0 1.0219 1.0219 + 3: 0b0.00.000011 0 0 1.03302 1.03302 + 4: 0b0.00.000100 0 0 1.04427 1.04427 + 5: 0b0.00.000101 0 0 1.05565 1.05565 + 6: 0b0.00.000110 0 0 1.06714 1.06714 + 7: 0b0.00.000111 0 0 1.07876 1.07876 + 8: 0b0.00.001000 0 0 1.09051 1.09051 + 9: 0b0.00.001001 0 0 1.10238 1.10238 + 10: 0b0.00.001010 0 0 1.11439 1.11439 + 11: 0b0.00.001011 0 0 1.12652 1.12652 + 12: 0b0.00.001100 0 0 1.13879 1.13879 + 13: 0b0.00.001101 0 0 1.15119 1.15119 + 14: 0b0.00.001110 0 0 1.16372 1.16372 + 15: 0b0.00.001111 0 0 1.1764 1.1764 + 16: 0b0.00.010000 0 0 1.18921 1.18921 + 17: 0b0.00.010001 0 0 1.20216 1.20216 + 18: 0b0.00.010010 0 0 1.21525 1.21525 + 19: 0b0.00.010011 0 0 1.22848 1.22848 + 20: 0b0.00.010100 0 0 1.24186 1.24186 + 21: 0b0.00.010101 0 0 1.25538 1.25538 + 22: 0b0.00.010110 0 0 1.26905 1.26905 + 23: 0b0.00.010111 0 0 1.28287 1.28287 + 24: 0b0.00.011000 0 0 1.29684 1.29684 + 25: 0b0.00.011001 0 0 1.31096 1.31096 + 26: 0b0.00.011010 0 0 1.32524 1.32524 + 27: 0b0.00.011011 0 0 1.33967 1.33967 + 28: 0b0.00.011100 0 0 1.35426 1.35426 + 29: 0b0.00.011101 0 0 1.369 1.369 + 30: 0b0.00.011110 0 0 1.38391 1.38391 + 31: 0b0.00.011111 0 0 1.39898 1.39898 + 32: 0b0.00.100000 0 0 1.41421 1.41421 + 33: 0b0.00.100001 0 0 1.42961 1.42961 + 34: 0b0.00.100010 0 0 1.44518 1.44518 + 35: 0b0.00.100011 0 0 1.46092 1.46092 + 36: 0b0.00.100100 0 0 1.47683 1.47683 + 37: 0b0.00.100101 0 0 1.49291 1.49291 + 38: 0b0.00.100110 0 0 1.50916 1.50916 + 39: 0b0.00.100111 0 0 1.5256 1.5256 + 40: 0b0.00.101000 0 0 1.54221 1.54221 + 41: 0b0.00.101001 0 0 1.559 1.559 + 42: 0b0.00.101010 0 0 1.57598 1.57598 + 43: 0b0.00.101011 0 0 1.59314 1.59314 + 44: 0b0.00.101100 0 0 1.61049 1.61049 + 45: 0b0.00.101101 0 0 1.62803 1.62803 + 46: 0b0.00.101110 0 0 1.64576 1.64576 + 47: 0b0.00.101111 0 0 1.66368 1.66368 + 48: 0b0.00.110000 0 0 1.68179 1.68179 + 49: 0b0.00.110001 0 0 1.70011 1.70011 + 50: 0b0.00.110010 0 0 1.71862 1.71862 + 51: 0b0.00.110011 0 0 1.73733 1.73733 + 52: 0b0.00.110100 0 0 1.75625 1.75625 + 53: 0b0.00.110101 0 0 1.77538 1.77538 + 54: 0b0.00.110110 0 0 1.79471 1.79471 + 55: 0b0.00.110111 0 0 1.81425 1.81425 + 56: 0b0.00.111000 0 0 1.83401 1.83401 + 57: 0b0.00.111001 0 0 1.85398 1.85398 + 58: 0b0.00.111010 0 0 1.87417 1.87417 + 59: 0b0.00.111011 0 0 1.89458 1.89458 + 60: 0b0.00.111100 0 0 1.91521 1.91521 + 61: 0b0.00.111101 0 0 1.93606 1.93606 + 62: 0b0.00.111110 0 0 1.95714 1.95714 + 63: 0b0.00.111111 0 0 1.97846 1.97846 + 64: 0b0.01.000000 0 1 2 2 + 65: 0b0.01.000001 0 1 2.02178 2.02178 + 66: 0b0.01.000010 0 1 2.04379 2.04379 + 67: 0b0.01.000011 0 1 2.06605 2.06605 + 68: 0b0.01.000100 0 1 2.08855 2.08855 + 69: 0b0.01.000101 0 1 2.11129 2.11129 + 70: 0b0.01.000110 0 1 2.13428 2.13428 + 71: 0b0.01.000111 0 1 2.15752 2.15752 + 72: 0b0.01.001000 0 1 2.18102 2.18102 + 73: 0b0.01.001001 0 1 2.20477 2.20477 + 74: 0b0.01.001010 0 1 2.22877 2.22877 + 75: 0b0.01.001011 0 1 2.25304 2.25304 + 76: 0b0.01.001100 0 1 2.27758 2.27758 + 77: 0b0.01.001101 0 1 2.30238 2.30238 + 78: 0b0.01.001110 0 1 2.32745 2.32745 + 79: 0b0.01.001111 0 1 2.35279 2.35279 + 80: 0b0.01.010000 0 1 2.37841 2.37841 + 81: 0b0.01.010001 0 1 2.40431 2.40431 + 82: 0b0.01.010010 0 1 2.43049 2.43049 + 83: 0b0.01.010011 0 1 2.45696 2.45696 + 84: 0b0.01.010100 0 1 2.48372 2.48372 + 85: 0b0.01.010101 0 1 2.51076 2.51076 + 86: 0b0.01.010110 0 1 2.5381 2.5381 + 87: 0b0.01.010111 0 1 2.56574 2.56574 + 88: 0b0.01.011000 0 1 2.59368 2.59368 + 89: 0b0.01.011001 0 1 2.62192 2.62192 + 90: 0b0.01.011010 0 1 2.65047 2.65047 + 91: 0b0.01.011011 0 1 2.67934 2.67934 + 92: 0b0.01.011100 0 1 2.70851 2.70851 + 93: 0b0.01.011101 0 1 2.738 2.738 + 94: 0b0.01.011110 0 1 2.76782 2.76782 + 95: 0b0.01.011111 0 1 2.79796 2.79796 + 96: 0b0.01.100000 0 1 2.82843 2.82843 + 97: 0b0.01.100001 0 1 2.85923 2.85923 + 98: 0b0.01.100010 0 1 2.89036 2.89036 + 99: 0b0.01.100011 0 1 2.92184 2.92184 + 100: 0b0.01.100100 0 1 2.95365 2.95365 + 101: 0b0.01.100101 0 1 2.98582 2.98582 + 102: 0b0.01.100110 0 1 3.01833 3.01833 + 103: 0b0.01.100111 0 1 3.0512 3.0512 + 104: 0b0.01.101000 0 1 3.08442 3.08442 + 105: 0b0.01.101001 0 1 3.11801 3.11801 + 106: 0b0.01.101010 0 1 3.15196 3.15196 + 107: 0b0.01.101011 0 1 3.18628 3.18628 + 108: 0b0.01.101100 0 1 3.22098 3.22098 + 109: 0b0.01.101101 0 1 3.25605 3.25605 + 110: 0b0.01.101110 0 1 3.29151 3.29151 + 111: 0b0.01.101111 0 1 3.32735 3.32735 + 112: 0b0.01.110000 0 1 3.36359 3.36359 + 113: 0b0.01.110001 0 1 3.40021 3.40021 + 114: 0b0.01.110010 0 1 3.43724 3.43724 + 115: 0b0.01.110011 0 1 3.47467 3.47467 + 116: 0b0.01.110100 0 1 3.5125 3.5125 + 117: 0b0.01.110101 0 1 3.55075 3.55075 + 118: 0b0.01.110110 0 1 3.58942 3.58942 + 119: 0b0.01.110111 0 1 3.6285 3.6285 + 120: 0b0.01.111000 0 1 3.66802 3.66802 + 121: 0b0.01.111001 0 1 3.70796 3.70796 + 122: 0b0.01.111010 0 1 3.74834 3.74834 + 123: 0b0.01.111011 0 1 3.78915 3.78915 + 124: 0b0.01.111100 0 1 3.83041 3.83041 + 125: 0b0.01.111101 0 1 3.87212 3.87212 + 126: 0b0.01.111110 0 1 3.91429 3.91429 + 127: 0b0.01.111111 0 1 3.95691 3.95691 + 128: 0b0.10.000000 0 -2 0 0 + 129: 0b0.10.000001 0 -2 0.252722 0.252722 + 130: 0b0.10.000010 0 -2 0.255474 0.255474 + 131: 0b0.10.000011 0 -2 0.258256 0.258256 + 132: 0b0.10.000100 0 -2 0.261068 0.261068 + 133: 0b0.10.000101 0 -2 0.263911 0.263911 + 134: 0b0.10.000110 0 -2 0.266785 0.266785 + 135: 0b0.10.000111 0 -2 0.26969 0.26969 + 136: 0b0.10.001000 0 -2 0.272627 0.272627 + 137: 0b0.10.001001 0 -2 0.275596 0.275596 + 138: 0b0.10.001010 0 -2 0.278597 0.278597 + 139: 0b0.10.001011 0 -2 0.28163 0.28163 + 140: 0b0.10.001100 0 -2 0.284697 0.284697 + 141: 0b0.10.001101 0 -2 0.287797 0.287797 + 142: 0b0.10.001110 0 -2 0.290931 0.290931 + 143: 0b0.10.001111 0 -2 0.294099 0.294099 + 144: 0b0.10.010000 0 -2 0.297302 0.297302 + 145: 0b0.10.010001 0 -2 0.300539 0.300539 + 146: 0b0.10.010010 0 -2 0.303812 0.303812 + 147: 0b0.10.010011 0 -2 0.30712 0.30712 + 148: 0b0.10.010100 0 -2 0.310464 0.310464 + 149: 0b0.10.010101 0 -2 0.313845 0.313845 + 150: 0b0.10.010110 0 -2 0.317263 0.317263 + 151: 0b0.10.010111 0 -2 0.320718 0.320718 + 152: 0b0.10.011000 0 -2 0.32421 0.32421 + 153: 0b0.10.011001 0 -2 0.32774 0.32774 + 154: 0b0.10.011010 0 -2 0.331309 0.331309 + 155: 0b0.10.011011 0 -2 0.334917 0.334917 + 156: 0b0.10.011100 0 -2 0.338564 0.338564 + 157: 0b0.10.011101 0 -2 0.342251 0.342251 + 158: 0b0.10.011110 0 -2 0.345977 0.345977 + 159: 0b0.10.011111 0 -2 0.349745 0.349745 + 160: 0b0.10.100000 0 -2 0.353553 0.353553 + 161: 0b0.10.100001 0 -2 0.357403 0.357403 + 162: 0b0.10.100010 0 -2 0.361295 0.361295 + 163: 0b0.10.100011 0 -2 0.365229 0.365229 + 164: 0b0.10.100100 0 -2 0.369207 0.369207 + 165: 0b0.10.100101 0 -2 0.373227 0.373227 + 166: 0b0.10.100110 0 -2 0.377291 0.377291 + 167: 0b0.10.100111 0 -2 0.3814 0.3814 + 168: 0b0.10.101000 0 -2 0.385553 0.385553 + 169: 0b0.10.101001 0 -2 0.389751 0.389751 + 170: 0b0.10.101010 0 -2 0.393995 0.393995 + 171: 0b0.10.101011 0 -2 0.398286 0.398286 + 172: 0b0.10.101100 0 -2 0.402623 0.402623 + 173: 0b0.10.101101 0 -2 0.407007 0.407007 + 174: 0b0.10.101110 0 -2 0.411439 0.411439 + 175: 0b0.10.101111 0 -2 0.415919 0.415919 + 176: 0b0.10.110000 0 -2 0.420448 0.420448 + 177: 0b0.10.110001 0 -2 0.425027 0.425027 + 178: 0b0.10.110010 0 -2 0.429655 0.429655 + 179: 0b0.10.110011 0 -2 0.434333 0.434333 + 180: 0b0.10.110100 0 -2 0.439063 0.439063 + 181: 0b0.10.110101 0 -2 0.443844 0.443844 + 182: 0b0.10.110110 0 -2 0.448677 0.448677 + 183: 0b0.10.110111 0 -2 0.453563 0.453563 + 184: 0b0.10.111000 0 -2 0.458502 0.458502 + 185: 0b0.10.111001 0 -2 0.463495 0.463495 + 186: 0b0.10.111010 0 -2 0.468542 0.468542 + 187: 0b0.10.111011 0 -2 0.473644 0.473644 + 188: 0b0.10.111100 0 -2 0.478802 0.478802 + 189: 0b0.10.111101 0 -2 0.484015 0.484015 + 190: 0b0.10.111110 0 -2 0.489286 0.489286 + 191: 0b0.10.111111 0 -2 0.494614 0.494614 + 192: 0b0.11.000000 0 -1 0.5 0.5 + 193: 0b0.11.000001 0 -1 0.505445 0.505445 + 194: 0b0.11.000010 0 -1 0.510949 0.510949 + 195: 0b0.11.000011 0 -1 0.516512 0.516512 + 196: 0b0.11.000100 0 -1 0.522137 0.522137 + 197: 0b0.11.000101 0 -1 0.527823 0.527823 + 198: 0b0.11.000110 0 -1 0.53357 0.53357 + 199: 0b0.11.000111 0 -1 0.53938 0.53938 + 200: 0b0.11.001000 0 -1 0.545254 0.545254 + 201: 0b0.11.001001 0 -1 0.551191 0.551191 + 202: 0b0.11.001010 0 -1 0.557193 0.557193 + 203: 0b0.11.001011 0 -1 0.563261 0.563261 + 204: 0b0.11.001100 0 -1 0.569394 0.569394 + 205: 0b0.11.001101 0 -1 0.575595 0.575595 + 206: 0b0.11.001110 0 -1 0.581862 0.581862 + 207: 0b0.11.001111 0 -1 0.588198 0.588198 + 208: 0b0.11.010000 0 -1 0.594604 0.594604 + 209: 0b0.11.010001 0 -1 0.601078 0.601078 + 210: 0b0.11.010010 0 -1 0.607624 0.607624 + 211: 0b0.11.010011 0 -1 0.61424 0.61424 + 212: 0b0.11.010100 0 -1 0.620929 0.620929 + 213: 0b0.11.010101 0 -1 0.62769 0.62769 + 214: 0b0.11.010110 0 -1 0.634525 0.634525 + 215: 0b0.11.010111 0 -1 0.641435 0.641435 + 216: 0b0.11.011000 0 -1 0.64842 0.64842 + 217: 0b0.11.011001 0 -1 0.655481 0.655481 + 218: 0b0.11.011010 0 -1 0.662618 0.662618 + 219: 0b0.11.011011 0 -1 0.669834 0.669834 + 220: 0b0.11.011100 0 -1 0.677128 0.677128 + 221: 0b0.11.011101 0 -1 0.684501 0.684501 + 222: 0b0.11.011110 0 -1 0.691955 0.691955 + 223: 0b0.11.011111 0 -1 0.69949 0.69949 + 224: 0b0.11.100000 0 -1 0.707107 0.707107 + 225: 0b0.11.100001 0 -1 0.714807 0.714807 + 226: 0b0.11.100010 0 -1 0.72259 0.72259 + 227: 0b0.11.100011 0 -1 0.730459 0.730459 + 228: 0b0.11.100100 0 -1 0.738413 0.738413 + 229: 0b0.11.100101 0 -1 0.746454 0.746454 + 230: 0b0.11.100110 0 -1 0.754582 0.754582 + 231: 0b0.11.100111 0 -1 0.762799 0.762799 + 232: 0b0.11.101000 0 -1 0.771105 0.771105 + 233: 0b0.11.101001 0 -1 0.779502 0.779502 + 234: 0b0.11.101010 0 -1 0.78799 0.78799 + 235: 0b0.11.101011 0 -1 0.796571 0.796571 + 236: 0b0.11.101100 0 -1 0.805245 0.805245 + 237: 0b0.11.101101 0 -1 0.814014 0.814014 + 238: 0b0.11.101110 0 -1 0.822878 0.822878 + 239: 0b0.11.101111 0 -1 0.831838 0.831838 + 240: 0b0.11.110000 0 -1 0.840896 0.840896 + 241: 0b0.11.110001 0 -1 0.850053 0.850053 + 242: 0b0.11.110010 0 -1 0.85931 0.85931 + 243: 0b0.11.110011 0 -1 0.868667 0.868667 + 244: 0b0.11.110100 0 -1 0.878126 0.878126 + 245: 0b0.11.110101 0 -1 0.887688 0.887688 + 246: 0b0.11.110110 0 -1 0.897355 0.897355 + 247: 0b0.11.110111 0 -1 0.907126 0.907126 + 248: 0b0.11.111000 0 -1 0.917004 0.917004 + 249: 0b0.11.111001 0 -1 0.92699 0.92699 + 250: 0b0.11.111010 0 -1 0.937084 0.937084 + 251: 0b0.11.111011 0 -1 0.947288 0.947288 + 252: 0b0.11.111100 0 -1 0.957603 0.957603 + 253: 0b0.11.111101 0 -1 0.968031 0.968031 + 254: 0b0.11.111110 0 -1 0.978572 0.978572 + 255: 0b0.11.111111 0 -1 0.989228 0.989228 + 256: 0b1.00.000000 1 0 -1 -1 + 257: 0b1.00.000001 1 0 -1.01089 -1.01089 + 258: 0b1.00.000010 1 0 -1.0219 -1.0219 + 259: 0b1.00.000011 1 0 -1.03302 -1.03302 + 260: 0b1.00.000100 1 0 -1.04427 -1.04427 + 261: 0b1.00.000101 1 0 -1.05565 -1.05565 + 262: 0b1.00.000110 1 0 -1.06714 -1.06714 + 263: 0b1.00.000111 1 0 -1.07876 -1.07876 + 264: 0b1.00.001000 1 0 -1.09051 -1.09051 + 265: 0b1.00.001001 1 0 -1.10238 -1.10238 + 266: 0b1.00.001010 1 0 -1.11439 -1.11439 + 267: 0b1.00.001011 1 0 -1.12652 -1.12652 + 268: 0b1.00.001100 1 0 -1.13879 -1.13879 + 269: 0b1.00.001101 1 0 -1.15119 -1.15119 + 270: 0b1.00.001110 1 0 -1.16372 -1.16372 + 271: 0b1.00.001111 1 0 -1.1764 -1.1764 + 272: 0b1.00.010000 1 0 -1.18921 -1.18921 + 273: 0b1.00.010001 1 0 -1.20216 -1.20216 + 274: 0b1.00.010010 1 0 -1.21525 -1.21525 + 275: 0b1.00.010011 1 0 -1.22848 -1.22848 + 276: 0b1.00.010100 1 0 -1.24186 -1.24186 + 277: 0b1.00.010101 1 0 -1.25538 -1.25538 + 278: 0b1.00.010110 1 0 -1.26905 -1.26905 + 279: 0b1.00.010111 1 0 -1.28287 -1.28287 + 280: 0b1.00.011000 1 0 -1.29684 -1.29684 + 281: 0b1.00.011001 1 0 -1.31096 -1.31096 + 282: 0b1.00.011010 1 0 -1.32524 -1.32524 + 283: 0b1.00.011011 1 0 -1.33967 -1.33967 + 284: 0b1.00.011100 1 0 -1.35426 -1.35426 + 285: 0b1.00.011101 1 0 -1.369 -1.369 + 286: 0b1.00.011110 1 0 -1.38391 -1.38391 + 287: 0b1.00.011111 1 0 -1.39898 -1.39898 + 288: 0b1.00.100000 1 0 -1.41421 -1.41421 + 289: 0b1.00.100001 1 0 -1.42961 -1.42961 + 290: 0b1.00.100010 1 0 -1.44518 -1.44518 + 291: 0b1.00.100011 1 0 -1.46092 -1.46092 + 292: 0b1.00.100100 1 0 -1.47683 -1.47683 + 293: 0b1.00.100101 1 0 -1.49291 -1.49291 + 294: 0b1.00.100110 1 0 -1.50916 -1.50916 + 295: 0b1.00.100111 1 0 -1.5256 -1.5256 + 296: 0b1.00.101000 1 0 -1.54221 -1.54221 + 297: 0b1.00.101001 1 0 -1.559 -1.559 + 298: 0b1.00.101010 1 0 -1.57598 -1.57598 + 299: 0b1.00.101011 1 0 -1.59314 -1.59314 + 300: 0b1.00.101100 1 0 -1.61049 -1.61049 + 301: 0b1.00.101101 1 0 -1.62803 -1.62803 + 302: 0b1.00.101110 1 0 -1.64576 -1.64576 + 303: 0b1.00.101111 1 0 -1.66368 -1.66368 + 304: 0b1.00.110000 1 0 -1.68179 -1.68179 + 305: 0b1.00.110001 1 0 -1.70011 -1.70011 + 306: 0b1.00.110010 1 0 -1.71862 -1.71862 + 307: 0b1.00.110011 1 0 -1.73733 -1.73733 + 308: 0b1.00.110100 1 0 -1.75625 -1.75625 + 309: 0b1.00.110101 1 0 -1.77538 -1.77538 + 310: 0b1.00.110110 1 0 -1.79471 -1.79471 + 311: 0b1.00.110111 1 0 -1.81425 -1.81425 + 312: 0b1.00.111000 1 0 -1.83401 -1.83401 + 313: 0b1.00.111001 1 0 -1.85398 -1.85398 + 314: 0b1.00.111010 1 0 -1.87417 -1.87417 + 315: 0b1.00.111011 1 0 -1.89458 -1.89458 + 316: 0b1.00.111100 1 0 -1.91521 -1.91521 + 317: 0b1.00.111101 1 0 -1.93606 -1.93606 + 318: 0b1.00.111110 1 0 -1.95714 -1.95714 + 319: 0b1.00.111111 1 0 -1.97846 -1.97846 + 320: 0b1.01.000000 1 1 -2 -2 + 321: 0b1.01.000001 1 1 -2.02178 -2.02178 + 322: 0b1.01.000010 1 1 -2.04379 -2.04379 + 323: 0b1.01.000011 1 1 -2.06605 -2.06605 + 324: 0b1.01.000100 1 1 -2.08855 -2.08855 + 325: 0b1.01.000101 1 1 -2.11129 -2.11129 + 326: 0b1.01.000110 1 1 -2.13428 -2.13428 + 327: 0b1.01.000111 1 1 -2.15752 -2.15752 + 328: 0b1.01.001000 1 1 -2.18102 -2.18102 + 329: 0b1.01.001001 1 1 -2.20477 -2.20477 + 330: 0b1.01.001010 1 1 -2.22877 -2.22877 + 331: 0b1.01.001011 1 1 -2.25304 -2.25304 + 332: 0b1.01.001100 1 1 -2.27758 -2.27758 + 333: 0b1.01.001101 1 1 -2.30238 -2.30238 + 334: 0b1.01.001110 1 1 -2.32745 -2.32745 + 335: 0b1.01.001111 1 1 -2.35279 -2.35279 + 336: 0b1.01.010000 1 1 -2.37841 -2.37841 + 337: 0b1.01.010001 1 1 -2.40431 -2.40431 + 338: 0b1.01.010010 1 1 -2.43049 -2.43049 + 339: 0b1.01.010011 1 1 -2.45696 -2.45696 + 340: 0b1.01.010100 1 1 -2.48372 -2.48372 + 341: 0b1.01.010101 1 1 -2.51076 -2.51076 + 342: 0b1.01.010110 1 1 -2.5381 -2.5381 + 343: 0b1.01.010111 1 1 -2.56574 -2.56574 + 344: 0b1.01.011000 1 1 -2.59368 -2.59368 + 345: 0b1.01.011001 1 1 -2.62192 -2.62192 + 346: 0b1.01.011010 1 1 -2.65047 -2.65047 + 347: 0b1.01.011011 1 1 -2.67934 -2.67934 + 348: 0b1.01.011100 1 1 -2.70851 -2.70851 + 349: 0b1.01.011101 1 1 -2.738 -2.738 + 350: 0b1.01.011110 1 1 -2.76782 -2.76782 + 351: 0b1.01.011111 1 1 -2.79796 -2.79796 + 352: 0b1.01.100000 1 1 -2.82843 -2.82843 + 353: 0b1.01.100001 1 1 -2.85923 -2.85923 + 354: 0b1.01.100010 1 1 -2.89036 -2.89036 + 355: 0b1.01.100011 1 1 -2.92184 -2.92184 + 356: 0b1.01.100100 1 1 -2.95365 -2.95365 + 357: 0b1.01.100101 1 1 -2.98582 -2.98582 + 358: 0b1.01.100110 1 1 -3.01833 -3.01833 + 359: 0b1.01.100111 1 1 -3.0512 -3.0512 + 360: 0b1.01.101000 1 1 -3.08442 -3.08442 + 361: 0b1.01.101001 1 1 -3.11801 -3.11801 + 362: 0b1.01.101010 1 1 -3.15196 -3.15196 + 363: 0b1.01.101011 1 1 -3.18628 -3.18628 + 364: 0b1.01.101100 1 1 -3.22098 -3.22098 + 365: 0b1.01.101101 1 1 -3.25605 -3.25605 + 366: 0b1.01.101110 1 1 -3.29151 -3.29151 + 367: 0b1.01.101111 1 1 -3.32735 -3.32735 + 368: 0b1.01.110000 1 1 -3.36359 -3.36359 + 369: 0b1.01.110001 1 1 -3.40021 -3.40021 + 370: 0b1.01.110010 1 1 -3.43724 -3.43724 + 371: 0b1.01.110011 1 1 -3.47467 -3.47467 + 372: 0b1.01.110100 1 1 -3.5125 -3.5125 + 373: 0b1.01.110101 1 1 -3.55075 -3.55075 + 374: 0b1.01.110110 1 1 -3.58942 -3.58942 + 375: 0b1.01.110111 1 1 -3.6285 -3.6285 + 376: 0b1.01.111000 1 1 -3.66802 -3.66802 + 377: 0b1.01.111001 1 1 -3.70796 -3.70796 + 378: 0b1.01.111010 1 1 -3.74834 -3.74834 + 379: 0b1.01.111011 1 1 -3.78915 -3.78915 + 380: 0b1.01.111100 1 1 -3.83041 -3.83041 + 381: 0b1.01.111101 1 1 -3.87212 -3.87212 + 382: 0b1.01.111110 1 1 -3.91429 -3.91429 + 383: 0b1.01.111111 1 1 -3.95691 -3.95691 + 384: 0b1.10.000000 1 -2 -nan(ind) -nan(ind) + 385: 0b1.10.000001 1 -2 -0.252722 -0.252722 + 386: 0b1.10.000010 1 -2 -0.255474 -0.255474 + 387: 0b1.10.000011 1 -2 -0.258256 -0.258256 + 388: 0b1.10.000100 1 -2 -0.261068 -0.261068 + 389: 0b1.10.000101 1 -2 -0.263911 -0.263911 + 390: 0b1.10.000110 1 -2 -0.266785 -0.266785 + 391: 0b1.10.000111 1 -2 -0.26969 -0.26969 + 392: 0b1.10.001000 1 -2 -0.272627 -0.272627 + 393: 0b1.10.001001 1 -2 -0.275596 -0.275596 + 394: 0b1.10.001010 1 -2 -0.278597 -0.278597 + 395: 0b1.10.001011 1 -2 -0.28163 -0.28163 + 396: 0b1.10.001100 1 -2 -0.284697 -0.284697 + 397: 0b1.10.001101 1 -2 -0.287797 -0.287797 + 398: 0b1.10.001110 1 -2 -0.290931 -0.290931 + 399: 0b1.10.001111 1 -2 -0.294099 -0.294099 + 400: 0b1.10.010000 1 -2 -0.297302 -0.297302 + 401: 0b1.10.010001 1 -2 -0.300539 -0.300539 + 402: 0b1.10.010010 1 -2 -0.303812 -0.303812 + 403: 0b1.10.010011 1 -2 -0.30712 -0.30712 + 404: 0b1.10.010100 1 -2 -0.310464 -0.310464 + 405: 0b1.10.010101 1 -2 -0.313845 -0.313845 + 406: 0b1.10.010110 1 -2 -0.317263 -0.317263 + 407: 0b1.10.010111 1 -2 -0.320718 -0.320718 + 408: 0b1.10.011000 1 -2 -0.32421 -0.32421 + 409: 0b1.10.011001 1 -2 -0.32774 -0.32774 + 410: 0b1.10.011010 1 -2 -0.331309 -0.331309 + 411: 0b1.10.011011 1 -2 -0.334917 -0.334917 + 412: 0b1.10.011100 1 -2 -0.338564 -0.338564 + 413: 0b1.10.011101 1 -2 -0.342251 -0.342251 + 414: 0b1.10.011110 1 -2 -0.345977 -0.345977 + 415: 0b1.10.011111 1 -2 -0.349745 -0.349745 + 416: 0b1.10.100000 1 -2 -0.353553 -0.353553 + 417: 0b1.10.100001 1 -2 -0.357403 -0.357403 + 418: 0b1.10.100010 1 -2 -0.361295 -0.361295 + 419: 0b1.10.100011 1 -2 -0.365229 -0.365229 + 420: 0b1.10.100100 1 -2 -0.369207 -0.369207 + 421: 0b1.10.100101 1 -2 -0.373227 -0.373227 + 422: 0b1.10.100110 1 -2 -0.377291 -0.377291 + 423: 0b1.10.100111 1 -2 -0.3814 -0.3814 + 424: 0b1.10.101000 1 -2 -0.385553 -0.385553 + 425: 0b1.10.101001 1 -2 -0.389751 -0.389751 + 426: 0b1.10.101010 1 -2 -0.393995 -0.393995 + 427: 0b1.10.101011 1 -2 -0.398286 -0.398286 + 428: 0b1.10.101100 1 -2 -0.402623 -0.402623 + 429: 0b1.10.101101 1 -2 -0.407007 -0.407007 + 430: 0b1.10.101110 1 -2 -0.411439 -0.411439 + 431: 0b1.10.101111 1 -2 -0.415919 -0.415919 + 432: 0b1.10.110000 1 -2 -0.420448 -0.420448 + 433: 0b1.10.110001 1 -2 -0.425027 -0.425027 + 434: 0b1.10.110010 1 -2 -0.429655 -0.429655 + 435: 0b1.10.110011 1 -2 -0.434333 -0.434333 + 436: 0b1.10.110100 1 -2 -0.439063 -0.439063 + 437: 0b1.10.110101 1 -2 -0.443844 -0.443844 + 438: 0b1.10.110110 1 -2 -0.448677 -0.448677 + 439: 0b1.10.110111 1 -2 -0.453563 -0.453563 + 440: 0b1.10.111000 1 -2 -0.458502 -0.458502 + 441: 0b1.10.111001 1 -2 -0.463495 -0.463495 + 442: 0b1.10.111010 1 -2 -0.468542 -0.468542 + 443: 0b1.10.111011 1 -2 -0.473644 -0.473644 + 444: 0b1.10.111100 1 -2 -0.478802 -0.478802 + 445: 0b1.10.111101 1 -2 -0.484015 -0.484015 + 446: 0b1.10.111110 1 -2 -0.489286 -0.489286 + 447: 0b1.10.111111 1 -2 -0.494614 -0.494614 + 448: 0b1.11.000000 1 -1 -0.5 -0.5 + 449: 0b1.11.000001 1 -1 -0.505445 -0.505445 + 450: 0b1.11.000010 1 -1 -0.510949 -0.510949 + 451: 0b1.11.000011 1 -1 -0.516512 -0.516512 + 452: 0b1.11.000100 1 -1 -0.522137 -0.522137 + 453: 0b1.11.000101 1 -1 -0.527823 -0.527823 + 454: 0b1.11.000110 1 -1 -0.53357 -0.53357 + 455: 0b1.11.000111 1 -1 -0.53938 -0.53938 + 456: 0b1.11.001000 1 -1 -0.545254 -0.545254 + 457: 0b1.11.001001 1 -1 -0.551191 -0.551191 + 458: 0b1.11.001010 1 -1 -0.557193 -0.557193 + 459: 0b1.11.001011 1 -1 -0.563261 -0.563261 + 460: 0b1.11.001100 1 -1 -0.569394 -0.569394 + 461: 0b1.11.001101 1 -1 -0.575595 -0.575595 + 462: 0b1.11.001110 1 -1 -0.581862 -0.581862 + 463: 0b1.11.001111 1 -1 -0.588198 -0.588198 + 464: 0b1.11.010000 1 -1 -0.594604 -0.594604 + 465: 0b1.11.010001 1 -1 -0.601078 -0.601078 + 466: 0b1.11.010010 1 -1 -0.607624 -0.607624 + 467: 0b1.11.010011 1 -1 -0.61424 -0.61424 + 468: 0b1.11.010100 1 -1 -0.620929 -0.620929 + 469: 0b1.11.010101 1 -1 -0.62769 -0.62769 + 470: 0b1.11.010110 1 -1 -0.634525 -0.634525 + 471: 0b1.11.010111 1 -1 -0.641435 -0.641435 + 472: 0b1.11.011000 1 -1 -0.64842 -0.64842 + 473: 0b1.11.011001 1 -1 -0.655481 -0.655481 + 474: 0b1.11.011010 1 -1 -0.662618 -0.662618 + 475: 0b1.11.011011 1 -1 -0.669834 -0.669834 + 476: 0b1.11.011100 1 -1 -0.677128 -0.677128 + 477: 0b1.11.011101 1 -1 -0.684501 -0.684501 + 478: 0b1.11.011110 1 -1 -0.691955 -0.691955 + 479: 0b1.11.011111 1 -1 -0.69949 -0.69949 + 480: 0b1.11.100000 1 -1 -0.707107 -0.707107 + 481: 0b1.11.100001 1 -1 -0.714807 -0.714807 + 482: 0b1.11.100010 1 -1 -0.72259 -0.72259 + 483: 0b1.11.100011 1 -1 -0.730459 -0.730459 + 484: 0b1.11.100100 1 -1 -0.738413 -0.738413 + 485: 0b1.11.100101 1 -1 -0.746454 -0.746454 + 486: 0b1.11.100110 1 -1 -0.754582 -0.754582 + 487: 0b1.11.100111 1 -1 -0.762799 -0.762799 + 488: 0b1.11.101000 1 -1 -0.771105 -0.771105 + 489: 0b1.11.101001 1 -1 -0.779502 -0.779502 + 490: 0b1.11.101010 1 -1 -0.78799 -0.78799 + 491: 0b1.11.101011 1 -1 -0.796571 -0.796571 + 492: 0b1.11.101100 1 -1 -0.805245 -0.805245 + 493: 0b1.11.101101 1 -1 -0.814014 -0.814014 + 494: 0b1.11.101110 1 -1 -0.822878 -0.822878 + 495: 0b1.11.101111 1 -1 -0.831838 -0.831838 + 496: 0b1.11.110000 1 -1 -0.840896 -0.840896 + 497: 0b1.11.110001 1 -1 -0.850053 -0.850053 + 498: 0b1.11.110010 1 -1 -0.85931 -0.85931 + 499: 0b1.11.110011 1 -1 -0.868667 -0.868667 + 500: 0b1.11.110100 1 -1 -0.878126 -0.878126 + 501: 0b1.11.110101 1 -1 -0.887688 -0.887688 + 502: 0b1.11.110110 1 -1 -0.897355 -0.897355 + 503: 0b1.11.110111 1 -1 -0.907126 -0.907126 + 504: 0b1.11.111000 1 -1 -0.917004 -0.917004 + 505: 0b1.11.111001 1 -1 -0.92699 -0.92699 + 506: 0b1.11.111010 1 -1 -0.937084 -0.937084 + 507: 0b1.11.111011 1 -1 -0.947288 -0.947288 + 508: 0b1.11.111100 1 -1 -0.957603 -0.957603 + 509: 0b1.11.111101 1 -1 -0.968031 -0.968031 + 510: 0b1.11.111110 1 -1 -0.978572 -0.978572 + 511: 0b1.11.111111 1 -1 -0.989228 -0.989228 diff --git a/docs/weblinks.txt b/docs/weblinks.txt new file mode 100644 index 000000000..07da45434 --- /dev/null +++ b/docs/weblinks.txt @@ -0,0 +1,7 @@ +Wilkinson's polynomial +https://en.wikipedia.org/wiki/Wilkinson's_polynomial + +In numerical analysis, Wilkinson's polynomial is a specific polynomial +which was used by James H. Wilkinson in 1963 to illustrate a difficulty +when finding the root of a polynomial: the location of the roots can be +very sensitive to perturbations in the coefficients of the polynomial. diff --git a/education/number/lns/basic_operators.cpp b/education/number/lns/basic_operators.cpp index 857ebaedb..8610a73e7 100644 --- a/education/number/lns/basic_operators.cpp +++ b/education/number/lns/basic_operators.cpp @@ -6,8 +6,8 @@ #include // quick helper to report on a posit's specialness -template -void checkSpecialCases(sw::universal::lns p) { +template +void checkSpecialCases(sw::universal::lns p) { std::cout << "lns is " << (p.iszero() ? "zero " : "non-zero ") << (p.ispos() ? "positive " : "negative ") << (p.isnan() ? "Not a Number" : "Its a Real") << std::endl; } @@ -18,7 +18,7 @@ try { constexpr size_t nbits = 16; constexpr size_t rbits = 5; - using LNS16 = lns; + using LNS16 = lns; LNS16 p1, p2, p3, p4, p5, p6; // /* constexpr */ double minpos = minpos_value(); diff --git a/include/universal/behavior/arithmetic.hpp b/include/universal/behavior/arithmetic.hpp index 63561cc96..7cf97e177 100644 --- a/include/universal/behavior/arithmetic.hpp +++ b/include/universal/behavior/arithmetic.hpp @@ -1,5 +1,7 @@ #pragma once -// arithmetic.hpp: enum types used to classify arithmetic behavior, such as Modular vs Saturating arithmetic, Projective vs Real arithmetic, etc. +// arithmetic.hpp: enum types used to classify arithmetic behavior, +// such as Modular vs Saturating arithmetic, Projective vs Real arithmetic + // // Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. // diff --git a/include/universal/functions/loss.hpp b/include/universal/functions/loss.hpp index 590342a4b..85f256b46 100644 --- a/include/universal/functions/loss.hpp +++ b/include/universal/functions/loss.hpp @@ -1,7 +1,7 @@ #pragma once -// loss.hpp: definition of a loss functions function +// loss.hpp: definition of different loss functions // -// Copyright (C) 2017-2020 Stillwater Supercomputing, Inc. +// 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. @@ -9,8 +9,8 @@ Taken from: Robust Bi-Tempered Logistic Loss Based on Bregman Divergences -Ehsan Amid: Manfred K. Warmuth : Rohan Anil : Tomer Koren : - Department of Computer Science, University of California, Santa Cruz +Ehsan Amid: Manfred K. Warmuth: Rohan Anil : Tomer Koren : + Department of Computer Science, University of California, Santa Cruz : Google Brain {eamid, manfred, rohananil, tkoren}@google.com @@ -27,11 +27,11 @@ recovered at the limit t -> 1. Unlike the standard log, the logt function is bou by –1 / (1 – t) for 0 <= t < 1. This property will be used to define bounded loss functions that are significantly more robust to outliers.Similarly, our heavy - tailed alternative for the softmax function is based on the tempered exponential function.The function expt : R -> R+ with temperature t E R -is defined as the inverse1 of logt, that is, +is defined as the inverse of logt, that is, - expt(x) : = [1 + (1 – t) x]+^(1 / (1–t)) + expt(x) : = ([1 + (1 – t) x]+) ^ (1 / (1–t)) - where [.]+ = max{ . , 0 }. + where [ . ]+ = max{ . , 0 }. The standard exp function is again recovered at the limit t -> 1. Compared to the exp function, a heavier tail (for negative values of x) is achieved for t > 1. We use this property @@ -43,33 +43,28 @@ classical convex duality, using the fact that the probability assignment functio dual function to the entropy on the simplex.When the logt1 and expt2 are substituted instead, this duality still holds whenever t1 = t2, albeit with a different Bregman divergence, and the induced loss remains convex2.However, for t1 < t2, the loss becomes non - convex in the output activations.In -particular, 0 ¤ t1 < 1 leads to a bounded loss, while t2 > 1 provides tail - heaviness.Figure 1 illustrates -the tempered logt and expt functions as well as examples of our proposed bi - tempered logistic loss -function for a 2 - class problem expressed as a function of the activation of the first class.The true -label is assumed to be class one. +particular, 0 <= t1 < 1 leads to a bounded loss, while t2 > 1 provides tail - heaviness. -Tempered generalizations of the logistic regression have been introduced before[6, 7, 21, 2].The -most recent two - temperature method[2] is based on the Tsallis divergence and contains all the -previous methods as special cases.However, the Tsallis based divergences do not result in proper -loss functions.In contrast, we show that the Bregman based construction introduced in this paper is -indeed proper, which is a requirement for many real - world applications. */ namespace sw { namespace universal { -// tempered logarithm +// tempered logarithm logt(x) := (1/(1 – t)) * (x^(1–t) – 1) +// Unlike the standard log, the logt function is bounded from below -1/(1 - t) for 0 <= t < 1. +// This property will be used to define bounded loss functions that are more robust to outliers. template Scalar logt(const Scalar& temp, const Scalar& x) { - assert(x < 0); + assert(x >= 0); Scalar one_minus_temp = Scalar(1) - temp; return (pow(x, one_minus_temp) - Scalar(1))/one_minus_temp; } -// tempered exponent +// tempered exponent expt(x) : = [1 + (1 – t) x]^(1 / (1–t)) template Scalar expt(const Scalar& temp, const Scalar& x) { Scalar one_minus_temp = Scalar(1) - temp; - return (pow(Scalar(1) + one_minus_temp, (Scalar(1) / one_minus_temp))); + Scalar base = max(Scalar(1) + one_minus_temp * x, Scalar(0)); + return (pow(base, (Scalar(1) / one_minus_temp))); } }} // namespace sw::universal diff --git a/include/universal/internal/blockbinary/blockbinary.hpp b/include/universal/internal/blockbinary/blockbinary.hpp index 8aff63556..009121e82 100644 --- a/include/universal/internal/blockbinary/blockbinary.hpp +++ b/include/universal/internal/blockbinary/blockbinary.hpp @@ -13,12 +13,13 @@ #pragma message("LONG_DOUBLE_SUPPORT is not defined") #define LONG_DOUBLE_SUPPORT 0 #endif +#include namespace sw { namespace universal { enum class BinaryNumberType { - Signed = 0, // { ...,-3,-2,-1,0,1,2,3,... } - Unsigned = 1 // { 0,1,2,3,... } + Signed = 0, // { ...,-3,-2,-1,0,1,2,3,... } // 2's complement encoding + Unsigned = 1 // { 0,1,2,3,... } // binary encoding }; // forward references @@ -106,6 +107,33 @@ class blockbinary { template blockbinary(const blockbinary& rhs) { this->assign(rhs); } + // specific value constructor + constexpr blockbinary(const SpecificValue code) : _block{ 0 } { + switch (code) { + case SpecificValue::infpos: + case SpecificValue::maxpos: + maxpos(); + break; + case SpecificValue::minpos: + minpos(); + break; + case SpecificValue::qnan: + case SpecificValue::snan: + case SpecificValue::nar: + case SpecificValue::zero: + default: + zero(); + break; + case SpecificValue::minneg: + minneg(); + break; + case SpecificValue::infneg: + case SpecificValue::maxneg: + maxneg(); + break; + } + } + // initializer for long long constexpr blockbinary(long long initial_value) noexcept : _block{ 0 } { *this = initial_value; } @@ -496,6 +524,61 @@ class blockbinary { return *this += plusOne; } + // minimum positive value of the blockbinary configuration + constexpr blockbinary& minpos() noexcept { + // minpos = 0000....00001 + clear(); + setbit(0, true); + return *this; + } + // maximum positive value of the blockbinary configuration + constexpr blockbinary& maxpos() noexcept { + if constexpr (NumberType == BinaryNumberType::Signed) { + // maxpos = 01111....1111 + clear(); + flip(); + setbit(nbits - 1, false); + } + else { + // maxpos = 11111....1111 + clear(); + flip(); + } + return *this; + } + // zero + constexpr blockbinary& zero() noexcept { + clear(); + return *this; + } + // minimum negative value of the blockbinary configuration + constexpr blockbinary& minneg() noexcept { + if constexpr (NumberType == BinaryNumberType::Signed) { + // minneg = 11111....11111 + clear(); + flip(); + } + else { + // minneg = 00000....00000 + clear(); + } + return *this; + } + // maximum negative value of the blockbinary configuration + constexpr blockbinary& maxneg() noexcept { + if constexpr (NumberType == BinaryNumberType::Signed) { + // maxneg = 10000....0000 + clear(); + setbit(nbits - 1); + } + else { + // maxneg = 00000....00000 + clear(); + } + + return *this; + } + // selectors constexpr bool sign() const noexcept { return _block[MSU] & SIGN_BIT_MASK; } constexpr bool ispos() const noexcept { return !sign(); } diff --git a/include/universal/internal/blocktriple/blocktriple.hpp b/include/universal/internal/blocktriple/blocktriple.hpp index 37a904bb3..86368c789 100644 --- a/include/universal/internal/blocktriple/blocktriple.hpp +++ b/include/universal/internal/blocktriple/blocktriple.hpp @@ -745,6 +745,7 @@ class blocktriple { template constexpr inline blocktriple& convert_unsigned_integer(const Ty& rhs) noexcept { + clear(); _nan = false; _inf = false; _zero = true; @@ -779,6 +780,7 @@ class blocktriple { } template constexpr inline blocktriple& convert_signed_integer(const Ty& rhs) noexcept { + clear(); _nan = false; _inf = false; _zero = true; @@ -814,6 +816,7 @@ class blocktriple { template inline CONSTEXPRESSION blocktriple& convert_ieee754(Real rhs) noexcept { // TODO: deal with subnormals and inf + clear(); // extract raw IEEE-754 bits bool s{ false }; @@ -834,6 +837,7 @@ class blocktriple { _nan = true; _inf = false; _sign = true; // this is the encoding of a signalling NaN + _scale = 0; return *this; } if (rawFraction == (ieee754_parameter::fmask & ieee754_parameter::qnanmask)) { @@ -843,6 +847,7 @@ class blocktriple { _nan = true; _inf = false; _sign = false; // this is the encoding of a quiet NaN + _scale = 0; return *this; } if (rawFraction == 0ull) { @@ -851,6 +856,7 @@ class blocktriple { _nan = false; _inf = true; _sign = s; // + or - infinity + _scale = 10000; return *this; } } @@ -859,6 +865,7 @@ class blocktriple { _inf = false; _zero = true; _sign = s; + _scale = 0; return *this; } if (rawExponent == 0ull) { diff --git a/include/universal/internal/value/value.hpp b/include/universal/internal/value/value.hpp index 6d345f538..37b19ad3d 100644 --- a/include/universal/internal/value/value.hpp +++ b/include/universal/internal/value/value.hpp @@ -477,7 +477,7 @@ class value { bitblock src_fraction = src.fraction(); if (!_inf && !_zero && !_nan) { for (int s = srcbits - 1, t = tgtbits - 1; s >= 0 && t >= 0; --s, --t) - _fraction[t] = src_fraction[s]; + _fraction[static_cast(t)] = src_fraction[static_cast(s)]; } } // round to a target size number of bits using round-to-nearest round-to-even-on-tie @@ -551,13 +551,23 @@ class value { ////////////////////// VALUE operators +// ETLO 7/19/2022 +// OLD compiler guard +// we are trying to get value<> to use a native string conversion so that we can support arbitrary large values +// but this is turning out to be a complicated implementation with deep history and named algorithms, such as Dragon4, etc. +// For the moment, we still take the easy way out. #define OLD #ifdef OLD template -inline std::string convert_to_string(std::ios_base::fmtflags flags, const value& v, size_t precision = 0) { +inline std::string convert_to_string(std::ios_base::fmtflags flags, const value& v, std::streamsize precision = 0) { std::stringstream s; if (v.isinf()) { - s << FP_INFINITE; + if (v.sign()) { + s << "-inf"; + } + else { + s << ((flags & std::ios_base::showpos) ? "+inf" : "inf"); + } } else { if (precision) { @@ -581,7 +591,7 @@ inline std::string convert_to_string(std::ios_base::fmtflags flags, const value< result = "-inf"; } else { - result = (flags & std::ios_base::showpos) ? "+inf" : "inf"; + result = ((flags & std::ios_base::showpos) ? "+inf" : "inf"); } return result; } @@ -625,9 +635,9 @@ inline std::string convert_to_string(std::ios_base::fmtflags flags, const value< template inline std::ostream& operator<<(std::ostream& ostr, const value& v) { std::streamsize nrDigits = ostr.precision(); - std::string s = convert_to_string(ostr.flags(), v, static_cast(nrDigits)); + std::string s = convert_to_string(ostr.flags(), v, nrDigits); std::streamsize width = ostr.width(); - if (width > static_cast(s.size())) { + if (static_cast(width) > s.size()) { char fill = ostr.fill(); if ((ostr.flags() & std::ios_base::left) == std::ios_base::left) s.append(static_cast(width - s.size()), fill); diff --git a/include/universal/math/stub/next.hpp b/include/universal/math/stub/next.hpp index b7dd5c8ba..be30a36e8 100644 --- a/include/universal/math/stub/next.hpp +++ b/include/universal/math/stub/next.hpp @@ -1,7 +1,7 @@ #pragma once // next.hpp: templated nextafter/nexttoward function stubs for native floating-point // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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. diff --git a/include/universal/math/stub/truncate.hpp b/include/universal/math/stub/truncate.hpp index 0839160e2..74ab4d546 100644 --- a/include/universal/math/stub/truncate.hpp +++ b/include/universal/math/stub/truncate.hpp @@ -1,7 +1,7 @@ #pragma once // truncate.hpp: templated truncation function stubs for native floating-point (trunc, round, floor, and ceil) for posits // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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. @@ -18,6 +18,7 @@ namespace sw { namespace universal { Scalar round(Scalar x) { return std::round(x); } + template::value>::type> Scalar floor(Scalar x) { diff --git a/include/universal/native/ieee754_gcc.hpp b/include/universal/native/ieee754_gcc.hpp index ddb00ccde..a19cf3189 100644 --- a/include/universal/native/ieee754_gcc.hpp +++ b/include/universal/native/ieee754_gcc.hpp @@ -5,8 +5,8 @@ // // This file is part of the universal numbers project, which is released under an MIT Open Source license. -#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__) -/* GNU GCC/G++. --------------------------------------------- */ +#if (defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__) && !defined(__riscv) +/* GNU x86 GCC/G++. --------------------------------------------- */ namespace sw { namespace universal { diff --git a/include/universal/native/ieee754_riscv.hpp b/include/universal/native/ieee754_riscv.hpp index 1891c83e3..dcbe4db9f 100644 --- a/include/universal/native/ieee754_riscv.hpp +++ b/include/universal/native/ieee754_riscv.hpp @@ -68,5 +68,30 @@ class ieee754_parameter { }} // namespace sw::universal +// RISC-V has a greatly reduced so we are going to stub +// the missing functions out so software compiles, but will +// provide user feedback of the missing implementation +namespace std { + + template::value>::type> + Scalar nextafter(Scalar x, Scalar target) { + return nextafter(double(x), double(target)); + } + + template::value>::type> + Scalar trunc(Scalar x) { + return trunc(double(x)); // call the math.h function + } + + template::value>::type> + Scalar round(Scalar x) { + return round(double(x)); // call the math.h function + } + +} + #endif // RISC-V G++ tool chain diff --git a/include/universal/number/fixpnt/fixpnt_impl.hpp b/include/universal/number/fixpnt/fixpnt_impl.hpp index 9354b37ff..007b28169 100644 --- a/include/universal/number/fixpnt/fixpnt_impl.hpp +++ b/include/universal/number/fixpnt/fixpnt_impl.hpp @@ -46,7 +46,7 @@ You need the exception types defined, but you have the option to throw them namespace sw { namespace universal { constexpr bool Modulo = true; -constexpr bool Saturating = !Modulo; +constexpr bool Saturate = !Modulo; // forward references template class fixpnt; @@ -542,7 +542,7 @@ class fixpnt { _block = (positive ? quotient : quotient.twosComplement()); } else { - std::cerr << "TBD: saturating divide not implemented yet\n"; + std::cerr << "TBD: Saturate divide not implemented yet\n"; } return *this; } @@ -649,7 +649,7 @@ class fixpnt { f.clear(); if constexpr (std::is_integral_v && std::is_signed_v) { if (0 == v) return f; - if constexpr (arithmetic == Saturating) { + if constexpr (arithmetic == Saturate) { constexpr fixpnt maxpos(SpecificValue::maxpos), maxneg(SpecificValue::maxneg); // check if we are in the representable range if (v >= static_cast(maxpos)) { return maxpos; } @@ -675,7 +675,7 @@ class fixpnt { } else if constexpr (std::is_unsigned_v) { if (0 == v) return f; - if constexpr (arithmetic == Saturating) { + if constexpr (arithmetic == Saturate) { constexpr fixpnt maxpos(SpecificValue::maxpos), maxneg(SpecificValue::maxneg); // check if we are in the representable range if (v >= static_cast(maxpos)) { return maxpos; } @@ -690,7 +690,7 @@ class fixpnt { } else if constexpr (std::is_floating_point_v) { if (v == 0.0) return f; - if constexpr (arithmetic == Saturating) { // check if the value is in the representable range + if constexpr (arithmetic == Saturate) { // check if the value is in the representable range fixpnt a; a.maxpos(); if (v >= float(a)) { return a; } // set to max pos value diff --git a/include/universal/number/lns/lns.hpp b/include/universal/number/lns/lns.hpp index dc343f968..778c2377f 100644 --- a/include/universal/number/lns/lns.hpp +++ b/include/universal/number/lns/lns.hpp @@ -45,6 +45,6 @@ /////////////////////////////////////////////////////////////////////////////////////// /// math functions -#include +#include #endif diff --git a/include/universal/number/lns/lns_fwd.hpp b/include/universal/number/lns/lns_fwd.hpp index 9a3be3231..be891f7eb 100644 --- a/include/universal/number/lns/lns_fwd.hpp +++ b/include/universal/number/lns/lns_fwd.hpp @@ -5,13 +5,15 @@ // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include // for size_t +#include // for ArithmeticBehavior namespace sw { namespace universal { // core lns types -template class lns; -template lns abs(const lns&); -template lns sqrt(const lns&); +template class lns; +template lns abs(const lns&); +template lns sqrt(const lns&); + }} // namespace sw::universal diff --git a/include/universal/number/lns/lns_impl.hpp b/include/universal/number/lns/lns_impl.hpp index 25b4f0360..dd4389c36 100644 --- a/include/universal/number/lns/lns_impl.hpp +++ b/include/universal/number/lns/lns_impl.hpp @@ -11,16 +11,14 @@ #include #include #include +#include +#include namespace sw { namespace universal { -// Forward definitions -template class lns; -template lns abs(const lns& v); - // convert a floating-point value to a specific lns configuration. Semantically, p = v, return reference to p -template -inline lns& convert(const triple& v, lns& p) { +template +inline lns& convert(const triple& v, lns& p) { if (v.iszero()) { return p.setnan(); } @@ -30,30 +28,32 @@ inline lns& convert(const triple& v, lns -inline lns& minpos(lns& lminpos) { +template +inline lns& minpos(lns& lminpos) { return lminpos; } -template -lns& maxpos(lns& lmaxpos) { +template +lns& maxpos(lns& lmaxpos) { return lmaxpos; } -template -lns& minneg(lns& lminneg) { +template +lns& minneg(lns& lminneg) { return lminneg; } -template -lns& maxneg(lns& lmaxneg) { +template +lns& maxneg(lns& lmaxneg) { return lmaxneg; } // template class representing a value in scientific notation, using a template size for the number of fraction bits -template +template class lns { public: - static constexpr size_t nbits = _nbits; - static constexpr size_t rbits = _rbits; + static constexpr size_t nbits = _nbits; + static constexpr size_t rbits = _rbits; + static constexpr ArithmeticBehavior behavior = _behavior; typedef bt BlockType; + static_assert(nbits > rbits, "rbits parameter is larger than available fraction bits"); static constexpr double scaling = double(1ull << rbits); static constexpr size_t bitsInByte = 8ull; static constexpr size_t bitsInBlock = sizeof(bt) * bitsInByte; @@ -117,6 +117,7 @@ class lns { constexpr lns(signed char initial_value) noexcept { *this = initial_value; } constexpr lns(short initial_value) noexcept { *this = initial_value; } constexpr lns(int initial_value) noexcept { *this = initial_value; } + constexpr lns(long initial_value) noexcept { *this = initial_value; } constexpr lns(long long initial_value) noexcept { *this = initial_value; } constexpr lns(unsigned long long initial_value) noexcept { *this = initial_value; } constexpr lns(float initial_value) noexcept { *this = initial_value; } @@ -126,6 +127,7 @@ class lns { constexpr lns& operator=(signed char rhs) noexcept { return convert_signed(rhs); } constexpr lns& operator=(short rhs) noexcept { return convert_signed(rhs); } constexpr lns& operator=(int rhs) noexcept { return convert_signed(rhs); } + constexpr lns& operator=(long rhs) noexcept { return convert_signed(rhs); } constexpr lns& operator=(long long rhs) noexcept { return convert_signed(rhs); } constexpr lns& operator=(unsigned long long rhs) noexcept { return convert_unsigned(rhs); } CONSTEXPRESSION lns& operator=(float rhs) noexcept { return convert_ieee754(rhs); } @@ -141,22 +143,30 @@ class lns { // in-place arithmetic assignment operators lns& operator+=(const lns& rhs) { - float sum = float(*this) + float(rhs); // TODO: why floats? because this is a shortcut and we focus on small values - return *this = sum; + double sum{ 0.0 }; + if constexpr (behavior.arith == Arithmetic::Saturating && behavior.limit == InfiniteLimit::Finite) { + sum = double(*this) + double(rhs); // TODO: native implementation + } + else { + sum = double(*this) + double(rhs); // TODO: native implementation + } + return *this = sum; // <-- saturation happens in the assignment } lns& operator+=(double rhs) { - float sum = float(*this) + float(rhs); // TODO: why floats? because this is a shortcut and we focus on small values - return *this = sum; -// return *this += lns(rhs); + return operator+=(lns(rhs)); } lns& operator-=(const lns& rhs) { - float diff = float(*this) - float(rhs); // TODO: why floats? because this is a shortcut and we focus on small values - return *this = diff; + double diff{ 0.0 }; + if constexpr (behavior.arith == Arithmetic::Saturating && behavior.limit == InfiniteLimit::Finite) { + diff = double(*this) - double(rhs); // TODO: native implementation + } + else { + diff = double(*this) - double(rhs); // TODO: native implementation + } + return *this = diff; // <-- saturation happens in the assignment } lns& operator-=(double rhs) { - float diff = float(*this) - float(rhs); // TODO: why floats? because this is a shortcut and we focus on small values - return *this = diff; - // return *this -= lns(rhs); + return operator-=(lns(rhs)); } lns& operator*=(const lns& rhs) { if (isnan()) return *this; @@ -169,14 +179,35 @@ class lns { setzero(); return *this; } - ExponentBlockBinary exp(_block), rhsExp(rhs._block); - exp += rhsExp; - bool negative = sign() ^ rhs.sign(); - _block.assign(exp); + ExponentBlockBinary lexp(_block), rexp(rhs._block); // strip the lns sign bit to yield the exponents + bool negative = sign() ^ rhs.sign(); // determine sign of result + if constexpr (behavior.arith == Arithmetic::Saturating && behavior.limit == InfiniteLimit::Finite) { // saturating, no infinite + static constexpr ExponentBlockBinary maxexp(SpecificValue::maxpos), minexp(SpecificValue::maxneg); + blockbinary maxpos(maxexp), maxneg(minexp); // expand into type of sum + blockbinary expandedLexp(lexp), expandedRexp(rexp); // expand and sign extend if necessary + blockbinary sum; + + sum = uradd(expandedLexp, expandedRexp); + // check if sum is in range + if (sum >= maxpos) { + _block = maxpos; + } + else if (sum <= maxneg) { + _block = maxneg; // == zero encoding + negative = false; // ignore lns sign, otherwise this becomes NaN + } + else { + _block.assign(sum); // this might set the lns sign, but we are going to explicitly set it before returning + } + } + else { + lexp += rexp; + _block.assign(lexp); + } setsign(negative); return *this; } - lns& operator*=(double rhs) { return *this *= lns(rhs); } + lns& operator*=(double rhs) { return operator*=(lns(rhs)); } lns& operator/=(const lns& rhs) { if (isnan()) return *this; if (rhs.isnan()) { @@ -193,14 +224,35 @@ class lns { } if (iszero()) return *this; - ExponentBlockBinary exp(_block), rhsExp(rhs._block); - exp -= rhsExp; - bool negative = sign() ^ rhs.sign(); - _block.assign(exp); + ExponentBlockBinary lexp(_block), rexp(rhs._block); // strip the lns sign bit to yield the exponents + bool negative = sign() ^ rhs.sign(); // determine sign of result + if constexpr (behavior.arith == Arithmetic::Saturating && behavior.limit == InfiniteLimit::Finite) { // saturating, no infinite + static constexpr ExponentBlockBinary maxexp(SpecificValue::maxpos), minexp(SpecificValue::maxneg); + blockbinary maxpos(maxexp), maxneg(minexp); // expand into type of sum + blockbinary expandedLexp(lexp), expandedRexp(rexp); // expand and sign extend if necessary + blockbinary sum; + + sum = ursub(expandedLexp, expandedRexp); + // check if sum is in range + if (sum >= maxpos) { + _block = maxpos; + } + else if (sum <= maxneg) { + _block = maxneg; // == zero encoding + negative = false; // ignore lns sign, otherwise this becomes NaN + } + else { + _block.assign(sum); // this might set the lns sign, but we are going to explicitly set it before returning + } + } + else { + lexp += rexp; + _block.assign(lexp); + } setsign(negative); return *this; } - lns& operator/=(double rhs) { return *this /= lns(rhs); } + lns& operator/=(double rhs) { return operator/=(lns(rhs)); } // prefix/postfix operators lns& operator++() { @@ -471,6 +523,33 @@ class lns { return *this; } + // check if the value is in the representable range + // NOTE: this is required to protect the rounding code below, which only works for values between [minpos, maxpos] + // TODO: this is all incredibly slow as we are creating special values and converting them to Real to compare + if constexpr (behavior.arith == Arithmetic::Saturating && behavior.limit == InfiniteLimit::Finite) { + lns maxpos(SpecificValue::maxpos); + lns maxneg(SpecificValue::maxneg); + Real absoluteValue = std::abs(v); + //std::cout << "maxpos : " << to_binary(maxpos) << " : " << maxpos << '\n'; + if (v > 0 && v >= Real(maxpos)) { + return *this = maxpos; + } + if (v < 0 && v <= Real(maxneg)) { + return *this = maxneg; + } + lns minpos(SpecificValue::minpos); + lns halfMinpos(SpecificValue::minpos); // in log space + //std::cout << "minpos : " << minpos << '\n'; + //std::cout << "halfMinpos : " << halfMinpos << '\n'; + if (absoluteValue <= Real(halfMinpos)) { + setzero(); + return *this; + } + else if (absoluteValue <= Real(minpos)) { + return *this = (v > 0 ? minpos : -minpos); + } + } + bool negative = (v < Real(0.0f)); v = (negative ? -v : v); Real logv = std::log2(v); @@ -479,7 +558,7 @@ class lns { _block.setbit(nbits - 1, negative); return *this; } - // check if the value is in the representable range + ExponentBlockBinary lnsExponent{ 0 }; @@ -553,6 +632,7 @@ class lns { // std::cout << "lns exponent : " << to_binary(lnsExponent) << " : " << lnsExponent << '\n'; _block = lnsExponent; setsign(negative); + return *this; } @@ -620,42 +700,34 @@ class lns { BlockBinary _block; // template parameters need names different from class template parameters (for gcc and clang) - template - friend std::ostream& operator<< (std::ostream& ostr, const lns& r); - template - friend std::istream& operator>> (std::istream& istr, lns& r); - - template - friend bool operator==(const lns& lhs, const lns& rhs); - template - friend bool operator!=(const lns& lhs, const lns& rhs); - template - friend bool operator< (const lns& lhs, const lns& rhs); - template - friend bool operator> (const lns& lhs, const lns& rhs); - template - friend bool operator<=(const lns& lhs, const lns& rhs); - template - friend bool operator>=(const lns& lhs, const lns& rhs); + template + friend std::ostream& operator<< (std::ostream& ostr, const lns& r); + template + friend std::istream& operator>> (std::istream& istr, lns& r); + + template + friend bool operator==(const lns& lhs, const lns& rhs); + template + friend bool operator< (const lns& lhs, const lns& rhs); }; ////////////////////// operators -template -inline std::ostream& operator<<(std::ostream& ostr, const lns& v) { +template +inline std::ostream& operator<<(std::ostream& ostr, const lns& v) { ostr << double(v); return ostr; } -template -inline std::istream& operator>>(std::istream& istr, const lns& v) { +template +inline std::istream& operator>>(std::istream& istr, const lns& v) { istr >> v._fraction; return istr; } // lns - logic operators -template -inline bool operator==(const lns& lhs, const lns& rhs) { - using LNS = lns; +template +inline bool operator==(const lns& lhs, const lns& rhs) { + using LNS = lns; if constexpr (LNS::nrBlocks == 1) { return lhs._block[0] == rhs._block[0]; } @@ -681,11 +753,11 @@ inline bool operator==(const lns& lhs, const lns -inline bool operator!=(const lns& lhs, const lns& rhs) { return !operator==(lhs, rhs); } -template -inline bool operator< (const lns& lhs, const lns& rhs) { - using LNS = lns; +template +inline bool operator!=(const lns& lhs, const lns& rhs) { return !operator==(lhs, rhs); } +template +inline bool operator< (const lns& lhs, const lns& rhs) { + using LNS = lns; bool lhsSign = lhs.at(nnbits - 1); bool rhsSign = rhs.at(nnbits - 1); if (lhsSign) { @@ -709,119 +781,118 @@ inline bool operator< (const lns& lhs, const lns -inline bool operator> (const lns& lhs, const lns& rhs) { return operator< (rhs, lhs); } -template -inline bool operator<=(const lns& lhs, const lns& rhs) { return !operator> (lhs, rhs); } -template -inline bool operator>=(const lns& lhs, const lns& rhs) { return !operator< (lhs, rhs); } +template +inline bool operator> (const lns& lhs, const lns& rhs) { return operator< (rhs, lhs); } +template +inline bool operator<=(const lns& lhs, const lns& rhs) { return !operator> (lhs, rhs); } +template +inline bool operator>=(const lns& lhs, const lns& rhs) { return !operator< (lhs, rhs); } // lns - literal logic operators -template -inline bool operator==(const lns& lhs, double rhs) { return lhs == lns(rhs); } -template -inline bool operator!=(const lns& lhs, double rhs) { return !operator==(lhs, rhs); } -template -inline bool operator< (const lns& lhs, double rhs) { return lhs < lns(rhs); } -template -inline bool operator> (const lns& lhs, double rhs) { return operator< (rhs, lhs); } -template -inline bool operator<=(const lns& lhs, double rhs) { return !operator> (lhs, rhs); } -template -inline bool operator>=(const lns& lhs, double rhs) { return !operator< (lhs, rhs); } +template +inline bool operator==(const lns& lhs, double rhs) { return lhs == lns(rhs); } +template +inline bool operator!=(const lns& lhs, double rhs) { return !operator==(lhs, rhs); } +template +inline bool operator< (const lns& lhs, double rhs) { return lhs < lns(rhs); } +template +inline bool operator> (const lns& lhs, double rhs) { return operator< (rhs, lhs); } +template +inline bool operator<=(const lns& lhs, double rhs) { return !operator> (lhs, rhs); } +template +inline bool operator>=(const lns& lhs, double rhs) { return !operator< (lhs, rhs); } // lns - lns binary arithmetic operators -template -inline lns operator+(const lns& lhs, const lns& rhs) { - lns sum(lhs); +template +inline lns operator+(const lns& lhs, const lns& rhs) { + lns sum(lhs); sum += rhs; return sum; } -template -inline lns operator-(const lns& lhs, const lns& rhs) { - lns diff(lhs); +template +inline lns operator-(const lns& lhs, const lns& rhs) { + lns diff(lhs); diff -= rhs; return diff; } -template -inline lns operator*(const lns& lhs, const lns& rhs) { - lns mul(lhs); +template +inline lns operator*(const lns& lhs, const lns& rhs) { + lns mul(lhs); mul *= rhs; return mul; } -template -inline lns operator/(const lns& lhs, const lns& rhs) { - lns ratio(lhs); +template +inline lns operator/(const lns& lhs, const lns& rhs) { + lns ratio(lhs); ratio /= rhs; return ratio; } // lns - literal binary arithmetic operators -template -inline lns operator+(const lns& lhs, double rhs) { - lns sum(lhs); +template +inline lns operator+(const lns& lhs, double rhs) { + lns sum(lhs); sum += rhs; - return sum; } -template -inline lns operator-(const lns& lhs, double rhs) { - lns diff(lhs); +template +inline lns operator-(const lns& lhs, double rhs) { + lns diff(lhs); diff -= rhs; return diff; } -template -inline lns operator*(const lns& lhs, double rhs) { - lns mul(lhs); +template +inline lns operator*(const lns& lhs, double rhs) { + lns mul(lhs); mul *= rhs; return mul; } -template -inline lns operator/(const lns& lhs, double rhs) { - lns ratio(lhs); +template +inline lns operator/(const lns& lhs, double rhs) { + lns ratio(lhs); ratio /= rhs; return ratio; } // literal - lns binary arithmetic operators -template -inline lns operator+(double lhs, const lns& rhs) { - lns sum(lhs); +template +inline lns operator+(double lhs, const lns& rhs) { + lns sum(lhs); sum += rhs; return sum; } -template -inline lns operator-(double lhs, const lns& rhs) { - lns diff(lhs); +template +inline lns operator-(double lhs, const lns& rhs) { + lns diff(lhs); diff -= rhs; return diff; } -template -inline lns operator*(double lhs, const lns& rhs) { - lns mul(lhs); +template +inline lns operator*(double lhs, const lns& rhs) { + lns mul(lhs); mul *= rhs; return mul; } -template -inline lns operator/(double lhs, const lns& rhs) { - lns ratio(lhs); +template +inline lns operator/(double lhs, const lns& rhs) { + lns ratio(lhs); ratio /= rhs; return ratio; } -template -inline std::string to_binary(const lns& number, bool nibbleMarker = false) { +template +inline std::string to_binary(const lns& number, bool nibbleMarker = false) { std::stringstream s; s << "0b"; s << (number.sign() ? "1." : "0."); @@ -841,8 +912,8 @@ inline std::string to_binary(const lns& number, bool nibbleMar return s.str(); } -template -inline std::string components(const lns& v) { +template +inline std::string components(const lns& v) { std::stringstream s; if (v.iszero()) { s << " zero b" << std::setw(nbits) << v.fraction(); @@ -856,11 +927,24 @@ inline std::string components(const lns& v) { return s.str(); } +// standard library functions for floating point + /// Magnitude of a scientific notation value (equivalent to turning the sign bit off). -template -lns abs(const lns& v) { - return lns(); +template +inline lns abs(const lns& v) { + lns magnitude(v); + magnitude.setsign(false); + return magnitude; +} + +template +inline lns frexp(const lns& x, int* exp) { + return lns(std::frexp(double(x), exp)); } +template +inline lns ldexp(const lns& x, int exp) { + return lns(std::ldexp(double(x), exp)); +} }} // namespace sw::universal diff --git a/include/universal/number/lns/lns_traits.hpp b/include/universal/number/lns/lns_traits.hpp index c44858317..29e17960d 100644 --- a/include/universal/number/lns/lns_traits.hpp +++ b/include/universal/number/lns/lns_traits.hpp @@ -15,8 +15,8 @@ struct is_lns_trait { }; -template -struct is_lns_trait< sw::universal::lns > +template +struct is_lns_trait< lns > : true_type { }; diff --git a/include/universal/number/lns/manipulators.hpp b/include/universal/number/lns/manipulators.hpp index 584b9ea13..fb57e3f80 100644 --- a/include/universal/number/lns/manipulators.hpp +++ b/include/universal/number/lns/manipulators.hpp @@ -14,8 +14,8 @@ namespace sw { namespace universal { // Generate a type tag for this lns - template - std::string type_tag(const lns& = {}) { + template + inline std::string type_tag(const lns& = {}) { std::stringstream s; s << "lns<" << std::setw(3) << nbits << ", " @@ -25,10 +25,10 @@ namespace sw { namespace universal { } // report dynamic range of a type, specialized for lns - template - std::string dynamic_range(const lns& a) { + template + inline std::string dynamic_range(const lns& a) { std::stringstream s; - lns b(SpecificValue::maxneg), c(SpecificValue::minneg), d(SpecificValue::minpos), e(SpecificValue::maxpos); + lns b(SpecificValue::maxneg), c(SpecificValue::minneg), d(SpecificValue::minpos), e(SpecificValue::maxpos); s << type_tag(a) << ": "; s << "minpos scale " << std::setw(10) << d.scale() << " "; s << "maxpos scale " << std::setw(10) << e.scale() << '\n'; @@ -37,8 +37,27 @@ namespace sw { namespace universal { return s.str(); } - template - std::string color_print(const lns& l, bool nibbleMarker = false) { + template + inline std::string range() { + std::stringstream s; + lns b(SpecificValue::maxneg), c(SpecificValue::minneg), d(SpecificValue::minpos), e(SpecificValue::maxpos); + s << "[" << b << " ... " << c << ", 0, " << d << " ... " << e << "]\n"; + return s.str(); + } + + // report if a native floating-point value is within the dynamic range of the lns configuration + template + inline bool isInRange(double v) { + using LNS = lns; + LNS a; + + bool inRange = true; + if (v > double(a.maxpos()) || v < double(a.maxneg())) inRange = false; + return inRange; + } + + template + inline std::string color_print(const lns& l, bool nibbleMarker = false) { std::stringstream s; diff --git a/include/universal/number/lns/math/classify.hpp b/include/universal/number/lns/math/classify.hpp new file mode 100644 index 000000000..bc5f79561 --- /dev/null +++ b/include/universal/number/lns/math/classify.hpp @@ -0,0 +1,65 @@ +#pragma once +// classify.hpp: classification functions for logarithmic floating point +// +// 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. + +namespace sw { namespace universal { + +// STD LIB function for IEEE floats: Categorizes floating point value arg into the following categories: zero, subnormal, normal, infinite, NAN, or implementation-defined category. +template +int fpclassify(const lns& a) { + if constexpr (nbits < 33) { + return std::fpclassify(float(a)); + } + else if constexpr (nbits < 65) { + return std::fpclassify(double(a)); + } + else { +#if LONG_DOUBLE_SUPPORT + return std::fpclassify((long double)(a)); +#else + return std::fpclassify(double(a)); +#endif + } +} + +// STD LIB function for IEEE floats: Determines if the given floating point number arg has finite value i.e. it is normal, subnormal or zero, but not infinite or NaN. +// specialized for lns +template +inline bool isfinite(const lns& a) { + return !a.isinf() && !a.isnan(); +} + +// STD LIB function for IEEE floats: Determines if the given floating point number arg is a posative or negative infinity. +// specialized for lns +template +inline bool isinf(const lns& a) { + return a.isinf(); +} + +// STD LIB function for IEEE floats: Determines if the given floating point number arg is a not-a-number (NaN) value. +// specialized for lns +template +inline bool isnan(const lns& a) { + return a.isnan(); +} + +// STD LIB function for IEEE floats: Determines if the given floating point number arg is normal, i.e. is neither zero, subnormal, infinite, nor NaN. +// specialized for lns +template +inline bool isnormal(const lns& a) { + return std::isnormal(double(a)); +} + +#ifdef NOW +// STD LIB function for IEEE floats: Determines if the given floating point number arg is denormal, i.e. is neither zero, normal, infinite, nor NaN. +// specialized for lns +template +inline bool isdenorm(const lns& a) { + return std::isdenormal(double(a)); +} +#endif // NOW + +}} // namespace sw::universal diff --git a/include/universal/number/lns/math/complex.hpp b/include/universal/number/lns/math/complex.hpp new file mode 100644 index 000000000..0ad932fc8 --- /dev/null +++ b/include/universal/number/lns/math/complex.hpp @@ -0,0 +1,32 @@ +#pragma once +// complex.hpp: functions for complex lns +// +// 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 + +namespace sw { namespace universal { + +// Real component of a complex lns +template +lns +real(std::complex< lns > x) { + return lns(std::real(x)); +} + +// Imaginary component of a complex lns +template +lns +imag(std::complex< lns > x) { + return lns(std::imag(x)); +} + +// Conjucate of a complex lns +template +std::complex< lns > +conj(std::complex< lns > x) { + return lns(std::conj(x)); +} + +}} // namespace sw::universal diff --git a/include/universal/number/lns/math/error_and_gamma.hpp b/include/universal/number/lns/math/error_and_gamma.hpp new file mode 100644 index 000000000..4432fb0be --- /dev/null +++ b/include/universal/number/lns/math/error_and_gamma.hpp @@ -0,0 +1,22 @@ +#pragma once +// error_gamma.hpp: error and gamma functions for lns +// +// 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. + +namespace sw { namespace universal { + +// Compute the error function erf(x) = 2 over sqrt(PI) times Integral from 0 to x of e ^ (-t)^2 dt +template +lns erf(lns x) { + return lns(std::erf(double(x))); +} + +// Compute the complementary error function: 1 - erf(x) +template +lns erfc(lns x) { + return lns(std::erfc(double(x))); +} + +}} // namespace sw::universal diff --git a/include/universal/number/lns/math/exponent.hpp b/include/universal/number/lns/math/exponent.hpp new file mode 100644 index 000000000..a0bfccea9 --- /dev/null +++ b/include/universal/number/lns/math/exponent.hpp @@ -0,0 +1,56 @@ +#pragma once +// exponent.hpp: exponent functions for lns +// +// 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. + +namespace sw { namespace universal { + +// the current shims are NON-COMPLIANT with the Universal standard, which says that every function must be +// correctly rounded for every input value. Anything less sacrifices bitwise reproducibility of results. + +// Base-e exponential function +template +lns exp(lns x) { + if (isnan(x)) return x; + lns p; + double d = std::exp(double(x)); + if (d == 0.0) { + p.minpos(); + } + else { + p = d; + } + return p; +} + +// Base-2 exponential function +template +lns exp2(lns x) { + if (isnan(x)) return x; + lns p; + double d = std::exp2(double(x)); + if (d == 0.0) { + p.minpos(); + } + else { + p = d; + } + return p; +} + +// Base-10 exponential function +template +lns exp10(lns x) { + return lns(std::pow(10.0, double(x))); +} + +// Base-e exponential function exp(x)-1 +template +lns expm1(lns x) { + return lns(std::expm1(double(x))); +} + + +}} // namespace sw::universal diff --git a/include/universal/number/lns/math/fractional.hpp b/include/universal/number/lns/math/fractional.hpp new file mode 100644 index 000000000..1b3053c32 --- /dev/null +++ b/include/universal/number/lns/math/fractional.hpp @@ -0,0 +1,59 @@ +#pragma once +// fractional.hpp: fractional functions for logarithmic floating-point +// +// 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. + +namespace sw { namespace universal { + +template +lns lnsmod(lns x, lns y) { + using Real = lns; + if (y.iszero() || x.isinf() || x.isnan() || y.isnan()) { + Real nan; + nan.setnan(); // quiet NaN + return nan; + } + if (y.isinf() || x.iszero()) { + return x; + } + + y.setsign(false); // equivalent but faster than y = abs(y); + int yexp; + frexp(y, &yexp); // ignore the fraction that comes back + Real r = x; + if (x < 0) r = -x; + Real d = r / y; + if (d.isinf()) return x; + Real n = trunc(d); + r = r - n * y; + if (x < 0) r = -r; + + return r; +} + +// fmod retuns x - n*y where n = x/y with the fractional part truncated +template +lns fmod(lns x, lns y) { + return lnsmod(x, y); +} + +// shim to stdlib +template +lns remainder(lns x, lns y) { + return lns(std::remainder(double(x), double(y))); +} + +// TODO: validate the rounding of these conversion, versus a method that manipulates the fraction bits directly + +// frac returns the fraction of a lns value that is > 1 +template +lns frac(lns x) { + using Real = lns; + long long intValue = (long long)(x); + return abs(x-Real(intValue)); // with the logic that fractions are unsigned quantities +} + + +}} // namespace sw::universal diff --git a/include/universal/number/lns/math/hyperbolic.hpp b/include/universal/number/lns/math/hyperbolic.hpp new file mode 100644 index 000000000..5a74149d2 --- /dev/null +++ b/include/universal/number/lns/math/hyperbolic.hpp @@ -0,0 +1,50 @@ +#pragma once +// hyperbolic.hpp: hyperbolic functions for logarithmic floating-point +// +// 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. + +namespace sw { namespace universal { + +// value representing an angle expressed in radians +// One radian is equivalent to 180/PI degrees + +// hyperbolic sine of an angle of x radians +template +lns sinh(lns x) { + return lns(std::sinh(double(x))); +} + +// hyperbolic cosine of an angle of x radians +template +lns cosh(lns x) { + return lns(std::cosh(double(x))); +} + +// hyperbolic tangent of an angle of x radians +template +lns tanh(lns x) { + return lns(std::tanh(double(x))); +} + +// hyperbolic cotangent of an angle of x radians +template +lns atanh(lns x) { + return lns(std::atanh(double(x))); +} + +// hyperbolic cosecant of an angle of x radians +template +lns acosh(lns x) { + return lns(std::acosh(double(x))); +} + +// hyperbolic secant of an angle of x radians +template +lns asinh(lns x) { + return lns(std::asinh(double(x))); +} + + +}} // namespace sw::universal diff --git a/include/universal/number/lns/math/hypot.hpp b/include/universal/number/lns/math/hypot.hpp new file mode 100644 index 000000000..f8e479488 --- /dev/null +++ b/include/universal/number/lns/math/hypot.hpp @@ -0,0 +1,60 @@ +#pragma once +// hypot.hpp: hypotenuse functions for logarithmic floating-point +// +// 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. + +/* +Computes the square root of the sum of the squares of x and y, without undue overflow or underflow at intermediate stages of the computation. + +Parameters +x - floating point value +y - floating point value +Return value +If no errors occur, the hypotenuse of a right-angled triangle, sqrt(x^2 + y^2), is returned. + +If a range error due to overflow occurs, +HUGE_VAL, +HUGE_VALF, or +HUGE_VALL is returned. + +If a range error due to underflow occurs, the correct result (after rounding) is returned. + +Error handling +Errors are reported as specified in math_errhandling. + +If the implementation supports IEEE floating-point arithmetic (IEC 60559), + +hypot(x, y), hypot(y, x), and hypot(x, -y) are equivalent +if one of the arguments is ±0, hypot is equivalent to fabs called with the non-zero argument +if one of the arguments is ±8, hypot returns +8 even if the other argument is NaN +otherwise, if any of the arguments is NaN, NaN is returned + +Notes +Implementations usually guarantee precision of less than 1 ulp (units in the last place): GNU, BSD, Open64. + +hypot(x, y) is equivalent to cabs(x + I*y). + +POSIX specifies that underflow may only occur when both arguments are subnormal and the correct result is also subnormal (this forbids naive implementations). + +hypot(INFINITY, NAN) returns +8, but sqrt(INFINITY*INFINITY+NAN*NAN) returns NaN. +*/ + +namespace sw { namespace universal { + +template +lns hypot(lns x, lns y) { + return lns(std::hypot(double(x),double(y))); +} + +template +lns hypotf(lns x, lns y) { + return lns(std::hypotf(float(x),float(y))); +} + +#if LONG_DOUBLE_SUPPORT +template +lns hypotl(lns x, lns y) { + return lns(std::hypotl((long double)(x),(long double)(y))); +} +#endif + +}} // namespace sw::universal diff --git a/include/universal/number/lns/math/logarithm.hpp b/include/universal/number/lns/math/logarithm.hpp new file mode 100644 index 000000000..5bfe23031 --- /dev/null +++ b/include/universal/number/lns/math/logarithm.hpp @@ -0,0 +1,34 @@ +#pragma once +// logarithm.hpp: logarithm functions for logarithmic floating-point +// +// 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. + +namespace sw { namespace universal { + +// Natural logarithm of x +template +lns log(lns x) { + return lns(std::log(double(x))); +} + +// Binary logarithm of x +template +lns log2(lns x) { + return lns(std::log2(double(x))); +} + +// Decimal logarithm of x +template +lns log10(lns x) { + return lns(std::log10(double(x))); +} + +// Natural logarithm of 1+x +template +lns log1p(lns x) { + return lns(std::log1p(double(x))); +} + +}} // namespace sw::universal diff --git a/include/universal/number/lns/math/minmax.hpp b/include/universal/number/lns/math/minmax.hpp new file mode 100644 index 000000000..a7db4b017 --- /dev/null +++ b/include/universal/number/lns/math/minmax.hpp @@ -0,0 +1,22 @@ +#pragma once +// minmax.hpp: min/max functions for logarithmic floating-point +// +// 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. + +namespace sw { namespace universal { + +template +lns +min(lns x, lns y) { + return lns(std::min(double(x), double(y))); +} + +template +lns +max(lns x, lns y) { + return lns(std::max(double(x), double(y))); +} + +}} // namespace sw::universal diff --git a/include/universal/number/lns/math/next.hpp b/include/universal/number/lns/math/next.hpp new file mode 100644 index 000000000..3fdcdfdd8 --- /dev/null +++ b/include/universal/number/lns/math/next.hpp @@ -0,0 +1,72 @@ +#pragma once +// next.hpp: nextafter/nexttoward functions for logarithmic floating-point +// +// 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. + +namespace sw { namespace universal { + +/* +Parameters + x Base value. + t Value toward which the return value is approximated. +If both parameters compare equal, the function returns t. + +Return Value + The next representable value after x in the direction of t. + + If x is the largest finite value representable in the type, + and the result is infinite or not representable, an overflow range error occurs. + + If an overflow range error occurs: + - And math_errhandling has MATH_ERRNO set: the global variable errno is set to ERANGE. + - And math_errhandling has MATH_ERREXCEPT set: FE_OVERFLOW is raised. + */ +template +lns nextafter(lns x, lns target) { + if (x == target) return target; + if (target.isnan()) { + if (x.isneg()) { + --x; + } + else { + ++x; + } + } + else { + if (x > target) { + --x; + } + else { + ++x; + } + } + return x; +} + +template +lns nexttoward(lns x, lns<128, 15, behavior, bt> target) { + lns<128, 15, behavior, bt> _x(x); + if (_x == target) return x; + if (target.isnan()) { + if (_x.isneg()) { + --_x; + } + else { + ++_x; + } + } + else { + if (_x > target) { + --_x; + } + else { + ++_x; + } + } + x = _x; + return x; +} + +}} // namespace sw::universal diff --git a/include/universal/number/lns/math/pow.hpp b/include/universal/number/lns/math/pow.hpp new file mode 100644 index 000000000..04cbe88de --- /dev/null +++ b/include/universal/number/lns/math/pow.hpp @@ -0,0 +1,25 @@ +#pragma once +// pow.hpp: pow functions for logarithmic floating-point +// +// 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. + +namespace sw { namespace universal { + +template +lns pow(lns x, lns y) { + return lns(std::pow(double(x), double(y))); +} + +template +lns pow(lns x, int y) { + return lns(std::pow(double(x), double(y))); +} + +template +lns pow(lns x, double y) { + return lns(std::pow(double(x), y)); +} + +}} // namespace sw::universal diff --git a/include/universal/number/lns/math/sqrt.hpp b/include/universal/number/lns/math/sqrt.hpp new file mode 100644 index 000000000..1764f9b74 --- /dev/null +++ b/include/universal/number/lns/math/sqrt.hpp @@ -0,0 +1,113 @@ +#pragma once +// sqrt.hpp: sqrt functions for logarithmic floating-point +// +// 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 + +#ifndef LNS_NATIVE_SQRT +#define LNS_NATIVE_SQRT 0 +#endif + +namespace sw { namespace universal { + +/* + // straight Babylonian + inline double babylonian(double v) { + double x_n = 0.5 * v; // initial guess + const double eps = 1.0e-7; // + do { + x_n = (x_n + v / x_n) / 2.0; + } while (std::abs(x_n * x_n - v) > eps); + + return x_n; + } +*/ + + template + inline lns BabylonianMethod(const lns& v) { + using LnsType = lns; + constexpr double eps = 1.0e-5; + LnsType half(0.5); + LnsType x_next; + LnsType x_n = half * v; + LnsType diff; + do { + x_next = (x_n + v / x_n) * half; + diff = x_next - x_n; + std::cout << " x_n+1: " << x_next << " x_n: " << x_n << " diff " << diff << std::endl; + x_n = x_next; + } while (double(sw::universal::abs(diff)) > eps); + return x_n; + } + + /* + - Consider the function argument, x, in floating-point form, with a base + (or radix) B, exponent e, and a fraction, f , such that 1/B <= f < 1. + Then we have x = f Be. The number of bits in the exponent and + fraction, and the value of the base, depends on the particular floating + point arithmetic system chosen. + + - Use properties of the elementary function to range reduce the argument + x to a small fixed interval. + + - Use a small polynomial approximation to produce an initial estimate, + y0, of the function on the small interval. Such an estimate may + be good to perhaps 5 to 10 bits. + + - Apply Newton iteration to refine the result. This takes the form yk = + yk?1/2 + (f /2)/yk?1. In base 2, the divisions by two can be done by + exponent adjustments in floating-point computation, or by bit shifting + in fixed-point computation. + + Convergence of the Newton method is quadratic, so the number of + correct bits doubles with each iteration. Thus, a starting point correct + to 7 bits will produce iterates accurate to 14, 28, 56, ... bits. Since the + number of iterations is very small, and known in advance, the loop is + written as straight-line code. + + - Having computed the function value for the range-reduced argument, + make whatever adjustments are necessary to produce the function value + for the original argument; this step may involve a sign adjustment, + and possibly a single multiplication and/or addition. + */ + + +#if LNS_NATIVE_SQRT + // sqrt for arbitrary lns + template + inline lns sqrt(const lns& a) { +#if LNS_THROW_ARITHMETIC_EXCEPTION + if (a.isneg()) throw lns_negative_sqrt_arg(); +#else + if (a.isneg()) std::cerr << "lns argument to sqrt is negative: " << a << std::endl; +#endif + if (a.iszero()) return a; + return lns(std::sqrt((double)a)); // TBD + } +#else + template + inline lns sqrt(const lns& a) { +#if LNS_THROW_ARITHMETIC_EXCEPTION + if (a.isneg()) throw lns_negative_sqrt_arg(); +#else + if (a.isneg()) std::cerr << "lns argument to sqrt is negative: " << a << std::endl; +#endif + if (a.iszero()) return a; + return lns(std::sqrt((double)a)); + } +#endif + + // reciprocal sqrt + template + inline lns rsqrt(const lns& a) { + lns v = sqrt(a); + return v.reciprocate(); + } + + /////////////////////////////////////////////////////////////////// + // specialized sqrt configurations + +}} // namespace sw::universal diff --git a/include/universal/number/lns/math/sqrt_tables.hpp b/include/universal/number/lns/math/sqrt_tables.hpp new file mode 100644 index 000000000..b8795962a --- /dev/null +++ b/include/universal/number/lns/math/sqrt_tables.hpp @@ -0,0 +1,38 @@ +#pragma once +// sqrt_tables.hpp: specialized logarithmic floating-point +// to support efficient sqrt for small lns configurations +// +// 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. + +namespace sw { namespace universal { + +// need a better code generator for the small lns up to nbits = 8 +// TODO: find if there is any structure in these tables across nbits and es + +template +void GenerateSqrtTable() { + constexpr unsigned int NR_VALUES = (unsigned(1) << (nbits - 1)); // no need for negative posits + + std::cout << std::setprecision(20); + lns a; + for (unsigned int i = 0; i < NR_VALUES; ++i) { + a.setbits(i); + double ref = std::sqrt(double(a)); + lns csqrt(ref); + std::cout << to_binary(a) << " " << to_binary(csqrt) << " " << a << " " << csqrt << " ref: " << ref << std::endl; + } + std::cout << std::setprecision(5); +} + +// roots for lns<8,2> +// v r v r high precision root +// 000 000 0 0 ref : 0 +// 001 001 0.5 0.5 ref : 0.70710678118654757274 +// 010 010 1 1 ref : 1 +// 011 010 2 1 ref : 1.4142135623730951455 +constexpr unsigned lns_8_2_roots[4] = { 0, 1, 2, 2 }; + + +}} // namespace sw::universal diff --git a/include/universal/number/lns/math/trigonometry.hpp b/include/universal/number/lns/math/trigonometry.hpp new file mode 100644 index 000000000..69ea05541 --- /dev/null +++ b/include/universal/number/lns/math/trigonometry.hpp @@ -0,0 +1,74 @@ +#pragma once +// trigonometric.hpp: trigonometric functions for logarithmic floating-point +// +// 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 + +namespace sw { namespace universal { + +// value representing an angle expressed in radians +// One radian is equivalent to 180/PI degrees + +// sine of an angle of x radians +template +lns sin(lns x) { + return lns(std::sin(double(x))); +} + +// cosine of an angle of x radians +template +lns cos(lns x) { + return lns(std::cos(double(x))); +} + +// tangent of an angle of x radians +template +lns tan(lns x) { + return lns(std::tan(double(x))); +} + +// cotangent of an angle of x radians +template +lns atan(lns x) { + return lns(std::atan(double(x))); +} + +// Arc tangent with two parameters +template +lns atan2(lns y, lns x) { + return lns(std::atan2(double(y),double(x))); +} + +// cosecant of an angle of x radians +template +lns acos(lns x) { + return lns(std::acos(double(x))); +} + +// secant of an angle of x radians +template +lns asin(lns x) { + return lns(std::asin(double(x))); +} + +// cotangent an angle of x radians +template +lns cot(lns x) { + return lns(std::tan(sw::universal::m_pi_2-double(x))); +} + +// secant of an angle of x radians +template +lns sec(lns x) { + return lns(1.0/std::cos(double(x))); +} + +// cosecant of an angle of x radians +template +lns csc(lns x) { + return lns(1.0/std::sin(double(x))); +} + +}} // namespace sw::universal diff --git a/include/universal/number/lns/math/truncate.hpp b/include/universal/number/lns/math/truncate.hpp new file mode 100644 index 000000000..2c039afdd --- /dev/null +++ b/include/universal/number/lns/math/truncate.hpp @@ -0,0 +1,34 @@ +#pragma once +// truncate.hpp: truncation functions (trunc, round, floor, and ceil) for logarithmic floating-point +// +// 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. + +namespace sw { namespace universal { + +// Truncate value by rounding toward zero, returning the nearest integral value that is not larger in magnitude than x +template +lns trunc(lns x) { + return lns(std::trunc(double(x))); +} + +// Round to nearest: returns the integral value that is nearest to x, with halfway cases rounded away from zero +template +lns round(lns x) { + return lns(std::round(double(x))); +} + +// Round x downward, returning the largest integral value that is not greater than x +template +lns floor(lns x) { + return lns(std::floor(double(x))); +} + +// Round x upward, returning the smallest integral value that is greater than x +template +lns ceil(lns x) { + return lns(std::ceil(double(x))); +} + +}} // namespace sw::universal diff --git a/include/universal/number/lns/math_functions.hpp b/include/universal/number/lns/math_functions.hpp index 5852d56c3..7f04a872c 100644 --- a/include/universal/number/lns/math_functions.hpp +++ b/include/universal/number/lns/math_functions.hpp @@ -1,7 +1,7 @@ #pragma once // math_functions.hpp: definition of logarithmic number system mathematical functions // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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. diff --git a/include/universal/number/lns/mathlib.hpp b/include/universal/number/lns/mathlib.hpp new file mode 100644 index 000000000..b74b282b8 --- /dev/null +++ b/include/universal/number/lns/mathlib.hpp @@ -0,0 +1,22 @@ +#pragma once +// mathlib.hpp: definition of mathematical functions for the logarithmic lnss +// +// 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 +#include +#include +#include +#include +#include +#include +#include + diff --git a/include/universal/number/lns/numeric_limits.hpp b/include/universal/number/lns/numeric_limits.hpp index d1d38c0d3..157dda804 100644 --- a/include/universal/number/lns/numeric_limits.hpp +++ b/include/universal/number/lns/numeric_limits.hpp @@ -7,22 +7,22 @@ namespace std { -template -class numeric_limits< sw::universal::lns > { +template +class numeric_limits< sw::universal::lns > { public: - using LNS = sw::universal::lns; + using LNS = sw::universal::lns; static constexpr bool is_specialized = true; static constexpr LNS min() { // return minimum value LNS lminpos(0); - return sw::universal::minpos(lminpos); + return lminpos; } static constexpr LNS max() { // return maximum value LNS lmaxpos(0); - return sw::universal::maxpos(lmaxpos); + return lmaxpos; } static constexpr LNS lowest() { // return most negative value LNS lmaxneg(0); - return sw::universal::maxneg(lmaxneg); + return lmaxneg; } static constexpr LNS epsilon() { // return smallest effective increment from 1.0 LNS one{ 1.0f }, incr{ 1.0f }; diff --git a/include/universal/number/lns/table.hpp b/include/universal/number/lns/table.hpp index 70245ca5f..52486c45e 100644 --- a/include/universal/number/lns/table.hpp +++ b/include/universal/number/lns/table.hpp @@ -8,10 +8,10 @@ namespace sw { namespace universal { // generate a full binary representation table for a given posit configuration -template +template void GenerateLnsTable(std::ostream& ostr, bool csvFormat = false) { const size_t size = (1 << nbits); - sw::universal::lns v; + sw::universal::lns v; if (csvFormat) { ostr << "\"Generate Value table for an LNS<" << nbits << "," << rbits << "> in CSV format\"" << std::endl; ostr << "#, Binary, sign, scale, value\n"; diff --git a/include/universal/number/posit/math/hypot.hpp b/include/universal/number/posit/math/hypot.hpp index 2ac2612e7..fce294b22 100644 --- a/include/universal/number/posit/math/hypot.hpp +++ b/include/universal/number/posit/math/hypot.hpp @@ -1,7 +1,7 @@ #pragma once // hypot.hpp: hypotenuse functions for posits // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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. @@ -58,4 +58,29 @@ posit hypotl(posit x, posit y) { return posit(std::hypotl((long double)(x),(long double)(y))); } +// _MSVC_LANG Defined as an integer literal that specifies the C++ language standard targeted by the compiler. +// It's set only in code compiled as C++. +// The macro is the integer literal value 201402L by default, or when the /std:c++14 compiler option is specified. +// The macro is set to 201703L if the /std:c++17 compiler option is specified. +// The macro is set to 202002L if the /std:c++20 compiler option is specified. +// It's set to a higher, unspecified value when the / std:c++latest option is specified.Otherwise, the macro is undefined. + +#ifdef LATER +// since C++17 +template +posit hypot(posit x, posit y, posit z) { + return posit(std::hypot(double(x),double(y),double(z))); +} + +template +posit hypotf(posit x, posit y, posit z) { + return posit(std::hypotf(float(x),float(y),float(z))); +} + +template +posit hypotl(posit x, posit y, posit z) { + return posit(std::hypotl((long double)(x),(long double)(y),(long double)(z))); +} +#endif + }} // namespace sw::universal diff --git a/include/universal/number/posit/posit_impl.hpp b/include/universal/number/posit/posit_impl.hpp index b90e8a5fc..314564787 100644 --- a/include/universal/number/posit/posit_impl.hpp +++ b/include/universal/number/posit/posit_impl.hpp @@ -1067,7 +1067,7 @@ class posit { return *this; } // Set the raw bits of the posit given an unsigned value starting from the lsb. Handy for enumerating a posit state space - constexpr posit& setbits(uint64_t value) { + constexpr posit& setbits(uint64_t value) { clear(); bitblock raw_bits; uint64_t mask = 1; diff --git a/include/universal/number/posit/regime.hpp b/include/universal/number/posit/regime.hpp index dcacba8cb..ffc5b70c5 100644 --- a/include/universal/number/posit/regime.hpp +++ b/include/universal/number/posit/regime.hpp @@ -82,7 +82,7 @@ class regime { size_t assign(int scale) { bool r = scale > 0; _k = calculate_k(scale); - _run = (r ? 1 + (scale >> es) : -scale >> es); + _run = static_cast(r ? 1 + (scale >> es) : -scale >> es); r ? _Bits.set() : _Bits.reset(); _Bits.set(nbits - 1 - _run - 1, 1 ^ r); // termination bit _RegimeBits = _run + 1; diff --git a/include/universal/utility/bit_cast.hpp b/include/universal/utility/bit_cast.hpp index fad69a716..7924dd662 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-2021 Stillwater Supercomputing, Inc. +// 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. @@ -47,12 +47,12 @@ static_assert(false, "BIT_CAST_SUPPORT is deprecated; bit_cast.hpp now defines " # define BIT_CAST_CONSTEXPR constexpr # define BIT_CAST_IS_CONSTEXPR true # else -# define BIT_CAST using non_builtin::bit_cast; +# define BIT_CAST using non_builtin::bit_cast # define BIT_CAST_CONSTEXPR # define BIT_CAST_IS_CONSTEXPR false # endif #else -# define BIT_CAST using non_builtin::bit_cast; +# define BIT_CAST using non_builtin::bit_cast # define BIT_CAST_CONSTEXPR # define BIT_CAST_IS_CONSTEXPR false #endif diff --git a/include/universal/verification/cfloat_math_test_suite.hpp b/include/universal/verification/cfloat_math_test_suite.hpp index 8e4339b1b..2894436d3 100644 --- a/include/universal/verification/cfloat_math_test_suite.hpp +++ b/include/universal/verification/cfloat_math_test_suite.hpp @@ -23,7 +23,7 @@ namespace sw { namespace universal { // enumerate all NATURAL LOGARITHM cases for a cfloat configuration template -int VerifyLog(bool bReportIndividualTestCases) { +int VerifyLog(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; @@ -37,10 +37,10 @@ int VerifyLog(bool bReportIndividualTestCases) { aref = std::log(da); if (alog != aref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "log", a, aref, alog); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "log", a, alog, aref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "log", a, aref, alog); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "log", a, alog, aref); } } return nrOfFailedTests; @@ -48,24 +48,24 @@ int VerifyLog(bool bReportIndividualTestCases) { // enumerate all BINARY LOGARITHM cases for a cfloat configuration template -int VerifyLog2(bool bReportIndividualTestCases) { +int VerifyLog2(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - TestType a, plog2, aref; + TestType a, alog2, aref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { a.setbits(i); - plog2 = sw::universal::log2(a); + alog2 = sw::universal::log2(a); // generate reference double da = double(a); aref = std::log2(da); - if (plog2 != aref) { + if (alog2 != aref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "log2", a, aref, plog2); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "log2", a, alog2, aref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "log2", a, aref, plog2); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "log2", a, alog2, aref); } } return nrOfFailedTests; @@ -74,24 +74,24 @@ int VerifyLog2(bool bReportIndividualTestCases) { // enumerate all DECIMAL LOGARITHM cases for a cfloat configuration template -int VerifyLog10(bool bReportIndividualTestCases) { +int VerifyLog10(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - TestType a, plog10, aref; + TestType a, alog10, aref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { a.setbits(i); - plog10 = sw::universal::log10(a); + alog10 = sw::universal::log10(a); // generate reference double da = double(a); aref = std::log10(da); - if (plog10 != aref) { + if (alog10 != aref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "log10", a, aref, plog10); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "log10", a, alog10, aref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "log10", a, aref, plog10); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "log10", a, alog10, aref); } } return nrOfFailedTests; @@ -100,7 +100,7 @@ int VerifyLog10(bool bReportIndividualTestCases) { // enumerate all base-e exponent cases for a cfloat configuration template -int VerifyExp(bool bReportIndividualTestCases) { +int VerifyExp(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; @@ -117,25 +117,25 @@ int VerifyExp(bool bReportIndividualTestCases) { // filter out inconsistencies among different math library implementations if (dref == 0.0) { static bool firstRoundingFilterEvent = true; - if (firstRoundingFilterEvent && bReportIndividualTestCases) { + if (firstRoundingFilterEvent && reportTestCases) { std::cerr << "filtering cfloat rounding to minpos\n"; firstRoundingFilterEvent = false; } } else if (cexp.isnan() && cref.isnan()) { static bool firstSofteningNanEvent = true; - if (firstSofteningNanEvent && bReportIndividualTestCases) { + if (firstSofteningNanEvent && reportTestCases) { std::cerr << "filtering snan to nan softening\n"; firstSofteningNanEvent = false; } } else { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "exp", a, cref, cexp); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "exp", a, cexp, cref); } } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "exp", a, cref, cexp); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "exp", a, cexp, cref); } } return nrOfFailedTests; @@ -143,7 +143,7 @@ int VerifyExp(bool bReportIndividualTestCases) { // enumerate all base-2 exponent cases for a cfloat configuration template -int VerifyExp2(bool bReportIndividualTestCases) { +int VerifyExp2(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; @@ -160,25 +160,25 @@ int VerifyExp2(bool bReportIndividualTestCases) { // filter out inconsistencies among different math library implementations if (dref == 0.0) { static bool firstRoundingFilterEvent = true; - if (firstRoundingFilterEvent && bReportIndividualTestCases) { + if (firstRoundingFilterEvent && reportTestCases) { std::cerr << "filtering cfloat rounding to minpos\n"; firstRoundingFilterEvent = false; } } else if (cexp2.isnan() && cref.isnan()) { static bool firstSofteningNanEvent = true; - if (firstSofteningNanEvent && bReportIndividualTestCases) { + if (firstSofteningNanEvent && reportTestCases) { std::cerr << "filtering snan to nan softening\n"; firstSofteningNanEvent = false; } } else { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "exp2", a, cref, cexp2); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "exp2", a, cexp2, cref); } } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "exp2", a, cref, cexp2); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "exp2", a, cexp2, cref); } } return nrOfFailedTests; @@ -186,7 +186,7 @@ int VerifyExp2(bool bReportIndividualTestCases) { // enumerate all power method cases for a cfloat configuration template -int VerifyPowerFunction(bool bReportIndividualTestCases, unsigned int maxSamples = 10000) { +int VerifyPowerFunction(bool reportTestCases, unsigned int maxSamples = 10000) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (unsigned(1) << nbits); int nrOfFailedTests = 0; @@ -205,7 +205,7 @@ int VerifyPowerFunction(bool bReportIndividualTestCases, unsigned int maxSamples } catch (const cfloat_arithmetic_exception& err) { if (a.isnan()) { - if (bReportIndividualTestCases) std::cerr << "Correctly caught arithmetic exception: " << err.what() << std::endl; + if (reportTestCases) std::cerr << "Correctly caught arithmetic exception: " << err.what() << std::endl; } else { throw err; @@ -218,10 +218,10 @@ int VerifyPowerFunction(bool bReportIndividualTestCases, unsigned int maxSamples if (cpow != cref) { if (cpow.isnan() && cref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails nrOfFailedTests++; - if (bReportIndividualTestCases) ReportTwoInputFunctionError("FAIL", "pow", a, b, cref, cpow); + if (reportTestCases) ReportTwoInputFunctionError("FAIL", "pow", a, b, cpow, cref); } else { - //if (bReportIndividualTestCases) ReportTwoInputFunctionSuccess("aSS", "pow", a, b, cref, cpow); + //if (reportTestCases) ReportTwoInputFunctionSuccess("aSS", "pow", a, b, cpow, cref); } ++testNr; if (testNr > maxSamples) { @@ -236,25 +236,25 @@ int VerifyPowerFunction(bool bReportIndividualTestCases, unsigned int maxSamples // enumerate all trigonometric sine cases for a cfloat configuration template -int VerifySine(bool bReportIndividualTestCases) { +int VerifySine(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - TestType a, psin, aref; + TestType a, asin, aref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { a.setbits(i); - psin = sw::universal::sin(a); + asin = sw::universal::sin(a); // generate reference double da = double(a); aref = std::sin(da); - if (psin != aref) { - if (psin.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + if (asin != aref) { + if (asin.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "sin", a, aref, psin); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "sin", a, asin, aref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "sin", a, aref, psin); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "sin", a, asin, aref); } } return nrOfFailedTests; @@ -262,25 +262,25 @@ int VerifySine(bool bReportIndividualTestCases) { // enumerate all trigonometric cosine cases for a cfloat configuration template -int VerifyCosine(bool bReportIndividualTestCases) { +int VerifyCosine(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - TestType a, pcos, aref; + TestType a, acos, aref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { a.setbits(i); - pcos = sw::universal::cos(a); + acos = sw::universal::cos(a); // generate reference double da = double(a); aref = std::cos(da); - if (pcos != aref) { - if (pcos.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + if (acos != aref) { + if (acos.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "cos", a, aref, pcos); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "cos", a, acos, aref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "cos", a, aref, pcos); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "cos", a, acos, aref); } } return nrOfFailedTests; @@ -288,25 +288,25 @@ int VerifyCosine(bool bReportIndividualTestCases) { // enumerate all trigonometric tangent cases for a cfloat configuration template -int VerifyTangent(bool bReportIndividualTestCases) { +int VerifyTangent(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - TestType a, ptan, aref; + TestType a, atan, aref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { a.setbits(i); - ptan = sw::universal::tan(a); + atan = sw::universal::tan(a); // generate reference double da = double(a); aref = std::tan(da); - if (ptan != aref) { - if (ptan.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + if (atan != aref) { + if (atan.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "tan", a, aref, ptan); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "tan", a, atan, aref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "tan", a, aref, ptan); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "tan", a, atan, aref); } } return nrOfFailedTests; @@ -314,25 +314,25 @@ int VerifyTangent(bool bReportIndividualTestCases) { // enumerate all trigonometric cotangent cases for a cfloat configuration template -int VerifyAtan(bool bReportIndividualTestCases) { +int VerifyAtan(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - TestType a, atan, aref; + TestType a, aatan, aref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { a.setbits(i); - atan = sw::universal::atan(a); + aatan = sw::universal::atan(a); // generate reference double da = double(a); aref = std::atan(da); - if (atan != aref) { - if (atan.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + if (aatan != aref) { + if (aatan.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "atan", a, aref, atan); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "atan", a, aatan, aref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "atan", a, aref, atan); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "atan", a, aatan, aref); } } return nrOfFailedTests; @@ -340,25 +340,25 @@ int VerifyAtan(bool bReportIndividualTestCases) { // enumerate all trigonometric sec cases for a cfloat configuration template -int VerifyAsin(bool bReportIndividualTestCases) { +int VerifyAsin(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - TestType a, asin, aref; + TestType a, aasin, aref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { a.setbits(i); - asin = sw::universal::asin(a); + aasin = sw::universal::asin(a); // generate reference double da = double(a); aref = std::asin(da); - if (asin != aref) { - if (asin.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + if (aasin != aref) { + if (aasin.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "asin", a, aref, asin); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "asin", a, aasin, aref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "asin", a, aref, asin); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "asin", a, aasin, aref); } } return nrOfFailedTests; @@ -366,25 +366,25 @@ int VerifyAsin(bool bReportIndividualTestCases) { // enumerate all trigonometric cosec cases for a cfloat configuration template -int VerifyAcos(bool bReportIndividualTestCases) { +int VerifyAcos(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - TestType a, acos, aref; + TestType a, aacos, aref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { a.setbits(i); - acos = sw::universal::acos(a); + aacos = sw::universal::acos(a); // generate reference double da = double(a); aref = std::acos(da); - if (acos != aref) { - if (acos.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + if (aacos != aref) { + if (aacos.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "acos", a, aref, acos); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "acos", a, aacos, aref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "acos", a, aref, acos); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "acos", a, aacos, aref); } } return nrOfFailedTests; @@ -392,25 +392,25 @@ int VerifyAcos(bool bReportIndividualTestCases) { // enumerate all hyperbolic sine cases for a cfloat configuration template -int VerifySinh(bool bReportIndividualTestCases) { +int VerifySinh(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - TestType a, psinh, aref; + TestType a, asinh, aref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { a.setbits(i); - psinh = sw::universal::sinh(a); + asinh = sw::universal::sinh(a); // generate reference double da = double(a); aref = std::sinh(da); - if (psinh != aref) { - if (psinh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + if (asinh != aref) { + if (asinh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "sinh", a, aref, psinh); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "sinh", a, asinh, aref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "sinh", a, aref, psinh); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "sinh", a, asinh, aref); } } return nrOfFailedTests; @@ -418,25 +418,25 @@ int VerifySinh(bool bReportIndividualTestCases) { // enumerate all hyperbolic cosine cases for a cfloat configuration template -int VerifyCosh(bool bReportIndividualTestCases) { +int VerifyCosh(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - TestType a, pcosh, aref; + TestType a, acosh, aref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { a.setbits(i); - pcosh = sw::universal::cosh(a); + acosh = sw::universal::cosh(a); // generate reference double da = double(a); aref = std::cosh(da); - if (pcosh != aref) { - if (pcosh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + if (acosh != aref) { + if (acosh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "cosh", a, aref, pcosh); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "cosh", a, acosh, aref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "cosh", a, aref, pcosh); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "cosh", a, acosh, aref); } } return nrOfFailedTests; @@ -444,25 +444,25 @@ int VerifyCosh(bool bReportIndividualTestCases) { // enumerate all hyperbolic tangent cases for a cfloat configuration template -int VerifyTanh(bool bReportIndividualTestCases) { +int VerifyTanh(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - TestType a, ptanh, aref; + TestType a, atanh, aref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { a.setbits(i); - ptanh = sw::universal::tanh(a); + atanh = sw::universal::tanh(a); // generate reference double da = double(a); aref = std::tanh(da); - if (ptanh != aref) { - if (ptanh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + if (atanh != aref) { + if (atanh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "tanh", a, aref, ptanh); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "tanh", a, atanh, aref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "tanh", a, aref, ptanh); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "tanh", a, atanh, aref); } } return nrOfFailedTests; @@ -470,25 +470,25 @@ int VerifyTanh(bool bReportIndividualTestCases) { // enumerate all hyperbolic cotangent cases for a cfloat configuration template -int VerifyAtanh(bool bReportIndividualTestCases) { +int VerifyAtanh(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; - TestType a, atanh, aref; + TestType a, aatanh, aref; for (size_t i = 1; i < NR_TEST_CASES; ++i) { a.setbits(i); - atanh = sw::universal::atanh(a); + aatanh = sw::universal::atanh(a); // generate reference double da = double(a); aref = std::atanh(da); - if (atanh != aref) { - if (atanh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + if (aatanh != aref) { + if (aatanh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "atanh", a, aref, atanh); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "atanh", a, aatanh, aref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "atanh", a, aref, atanh); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "atanh", a, aatanh, aref); } } return nrOfFailedTests; @@ -496,7 +496,7 @@ int VerifyAtanh(bool bReportIndividualTestCases) { // enumerate all hyperbolic sec cases for a cfloat configuration template -int VerifyAsinh(bool bReportIndividualTestCases) { +int VerifyAsinh(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; @@ -511,10 +511,10 @@ int VerifyAsinh(bool bReportIndividualTestCases) { if (aasinh != aref) { if (aasinh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "asinh", a, aref, aasinh); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "asinh", a, aasinh, aref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "asinh", a, aref, aasinh); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "asinh", a, aasinh, aref); } } return nrOfFailedTests; @@ -522,7 +522,7 @@ int VerifyAsinh(bool bReportIndividualTestCases) { // enumerate all hyperbolic cosec cases for a cfloat configuration template -int VerifyAcosh(bool bReportIndividualTestCases) { +int VerifyAcosh(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; @@ -537,10 +537,40 @@ int VerifyAcosh(bool bReportIndividualTestCases) { if (aacosh != aref) { if (aacosh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "acosh", a, aref, aacosh); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "acosh", a, aref, aacosh); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("aSS", "acosh", a, aref, aacosh); + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "acosh", a, aref, aacosh); + } + } + return nrOfFailedTests; +} + +// enumerate all hypotenuse cases for a cfloat configuration +template +int VerifyHypot(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, b, hypot, ref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + double da = double(a); + for (size_t j = 1; j < NR_TEST_CASES; ++j) { + b.setbits(j); + hypot = sw::universal::hypot(a, b); + // generate reference + double db = double(b); + ref = std::hypot(da, db); + if (hypot != ref) { + if (hypot.isnan() && ref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportTwoInputFunctionError("FAIL", "hypot", a, b, hypot, ref); + } + else { + //if (reportTestCases) ReportTwoInputFunctionSuccess("PASS", "hypot", a, b, hypot, ref); + } } } return nrOfFailedTests; diff --git a/include/universal/verification/lns_math_test_suite.hpp b/include/universal/verification/lns_math_test_suite.hpp new file mode 100644 index 000000000..e1528671e --- /dev/null +++ b/include/universal/verification/lns_math_test_suite.hpp @@ -0,0 +1,580 @@ +#pragma once +// lns_math_test_suite.hpp : test suite runners for math library functions +// +// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. +// +// This file is art of the universal numbers project, which is released under an MIT Open Source license. +#include +#include +#include +#include +#include + +// mathematical function definitions and implementations +#include +#include +#include + +namespace sw { namespace universal { + +/////////////////////////////// VALIDATION TEST SUITES //////////////////////////////// + +//////////////////////////////////// MATHEMATICAL FUNCTIONS ////////////////////////////////////////// + +// enumerate all NATURAL LOGARITHM cases for an lns configuration +template +int VerifyLog(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, alog, aref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + alog = sw::universal::log(a); + // generate reference + double da = double(a); + aref = std::log(da); + if (alog != aref) { + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "log", a, alog, aref); + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "log", a, alog, aref); + } + } + return nrOfFailedTests; +} + +// enumerate all BINARY LOGARITHM cases for an lns configuration +template +int VerifyLog2(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, alog2, aref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + alog2 = sw::universal::log2(a); + // generate reference + double da = double(a); + aref = std::log2(da); + if (alog2 != aref) { + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "log2", a, alog2, aref); + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "log2", a, alog2, aref); + } + } + return nrOfFailedTests; +} + + +// enumerate all DECIMAL LOGARITHM cases for an lns configuration +template +int VerifyLog10(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, alog10, aref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + alog10 = sw::universal::log10(a); + // generate reference + double da = double(a); + aref = std::log10(da); + if (alog10 != aref) { + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "log10", a, alog10, aref); + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "log10", a, alog10, aref); + } + } + return nrOfFailedTests; +} + + +// enumerate all base-e exponent cases for an lns configuration +template +int VerifyExp(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, cexp, cref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + cexp = sw::universal::exp(a); + // generate reference + double da = double(a); + double dref = std::exp(da); + cref = dref; + if (cexp != cref) { + // filter out inconsistencies among different math library implementations + if (dref == 0.0) { + static bool firstRoundingFilterEvent = true; + if (firstRoundingFilterEvent && reportTestCases) { + std::cerr << "filtering lns rounding to minpos\n"; + firstRoundingFilterEvent = false; + } + } + else if (cexp.isnan() && cref.isnan()) { + static bool firstSofteningNanEvent = true; + if (firstSofteningNanEvent && reportTestCases) { + std::cerr << "filtering snan to nan softening\n"; + firstSofteningNanEvent = false; + } + } + else { + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "exp", a, cexp, cref); + } + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "exp", a, cexp, cref); + } + } + return nrOfFailedTests; +} + +// enumerate all base-2 exponent cases for an lns configuration +template +int VerifyExp2(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, cexp2, cref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + cexp2 = sw::universal::exp2(a); + // generate reference + double da = double(a); + double dref = std::exp2(da); + cref = dref; + if (cexp2 != cref) { + // filter out inconsistencies among different math library implementations + if (dref == 0.0) { + static bool firstRoundingFilterEvent = true; + if (firstRoundingFilterEvent && reportTestCases) { + std::cerr << "filtering lns rounding to minpos\n"; + firstRoundingFilterEvent = false; + } + } + else if (cexp2.isnan() && cref.isnan()) { + static bool firstSofteningNanEvent = true; + if (firstSofteningNanEvent && reportTestCases) { + std::cerr << "filtering snan to nan softening\n"; + firstSofteningNanEvent = false; + } + } + else { + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "exp2", a, cexp2, cref); + } + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "exp2", a, cexp2, cref); + } + } + return nrOfFailedTests; +} + +// enumerate all power method cases for an lns configuration +template +int VerifyPowerFunction(bool reportTestCases, unsigned int maxSamples = 10000) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (unsigned(1) << nbits); + int nrOfFailedTests = 0; + TestType a, b, cpow, cref; + + uint32_t testNr = 0; + for (size_t i = 0; i < NR_TEST_CASES; ++i) { + a.setbits(i); + double da = double(a); + for (size_t j = 0; j < NR_TEST_CASES; ++j) { + b.setbits(j); + double db = double(b); +#if LNS_THROW_ARITHMETIC_EXCEPTION + try { + cpow = pow(a, b); + } + catch (const lns_arithmetic_exception& err) { + if (a.isnan()) { + if (reportTestCases) std::cerr << "Correctly caught arithmetic exception: " << err.what() << std::endl; + } + else { + throw err; + } + } +#else + cpow = pow(a, b); +#endif + cref = std::pow(da, db); + if (cpow != cref) { + if (cpow.isnan() && cref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportTwoInputFunctionError("FAIL", "pow", a, b, cpow, cref); + } + else { + //if (reportTestCases) ReportTwoInputFunctionSuccess("aSS", "pow", a, b, cpow, cref); + } + ++testNr; + if (testNr > maxSamples) { + std::cerr << "VerifyPower has been truncated\n"; + i = j = NR_TEST_CASES; + } + } + } + + return nrOfFailedTests; +} + +// enumerate all trigonometric sine cases for an lns configuration +template +int VerifySine(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, asin, aref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + asin = sw::universal::sin(a); + // generate reference + double da = double(a); + aref = std::sin(da); + if (asin != aref) { + if (asin.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "sin", a, asin, aref); + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "sin", a, asin, aref); + } + } + return nrOfFailedTests; +} + +// enumerate all trigonometric cosine cases for an lns configuration +template +int VerifyCosine(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, acos, aref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + acos = sw::universal::cos(a); + // generate reference + double da = double(a); + aref = std::cos(da); + if (acos != aref) { + if (acos.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "cos", a, acos, aref); + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "cos", a, acos, aref); + } + } + return nrOfFailedTests; +} + +// enumerate all trigonometric tangent cases for an lns configuration +template +int VerifyTangent(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, atan, aref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + atan = sw::universal::tan(a); + // generate reference + double da = double(a); + aref = std::tan(da); + if (atan != aref) { + if (atan.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "tan", a, atan, aref); + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "tan", a, atan, aref); + } + } + return nrOfFailedTests; +} + +// enumerate all trigonometric cotangent cases for an lns configuration +template +int VerifyAtan(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, aatan, aref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + aatan = sw::universal::atan(a); + // generate reference + double da = double(a); + aref = std::atan(da); + if (aatan != aref) { + if (aatan.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "atan", a, aatan, aref); + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "atan", a, aatan, aref); + } + } + return nrOfFailedTests; +} + +// enumerate all trigonometric sec cases for an lns configuration +template +int VerifyAsin(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, aasin, aref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + aasin = sw::universal::asin(a); + // generate reference + double da = double(a); + aref = std::asin(da); + if (aasin != aref) { + if (aasin.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "asin", a, aasin, aref); + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "asin", a, aasin, aref); + } + } + return nrOfFailedTests; +} + +// enumerate all trigonometric cosec cases for an lns configuration +template +int VerifyAcos(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, aacos, aref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + aacos = sw::universal::acos(a); + // generate reference + double da = double(a); + aref = std::acos(da); + if (aacos != aref) { + if (aacos.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "acos", a, aacos, aref); + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "acos", a, aacos, aref); + } + } + return nrOfFailedTests; +} + +// enumerate all hyperbolic sine cases for an lns configuration +template +int VerifySinh(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, asinh, aref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + asinh = sw::universal::sinh(a); + // generate reference + double da = double(a); + aref = std::sinh(da); + if (asinh != aref) { + if (asinh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "sinh", a, asinh, aref); + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "sinh", a, asinh, aref); + } + } + return nrOfFailedTests; +} + +// enumerate all hyperbolic cosine cases for an lns configuration +template +int VerifyCosh(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, acosh, aref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + acosh = sw::universal::cosh(a); + // generate reference + double da = double(a); + aref = std::cosh(da); + if (acosh != aref) { + if (acosh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "cosh", a, acosh, aref); + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "cosh", a, acosh, aref); + } + } + return nrOfFailedTests; +} + +// enumerate all hyperbolic tangent cases for an lns configuration +template +int VerifyTanh(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, atanh, aref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + atanh = sw::universal::tanh(a); + // generate reference + double da = double(a); + aref = std::tanh(da); + if (atanh != aref) { + if (atanh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "tanh", a, atanh, aref); + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "tanh", a, atanh, aref); + } + } + return nrOfFailedTests; +} + +// enumerate all hyperbolic cotangent cases for an lns configuration +template +int VerifyAtanh(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, aatanh, aref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + aatanh = sw::universal::atanh(a); + // generate reference + double da = double(a); + aref = std::atanh(da); + if (aatanh != aref) { + if (aatanh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "atanh", a, aatanh, aref); + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "atanh", a, aatanh, aref); + } + } + return nrOfFailedTests; +} + +// enumerate all hyperbolic sec cases for an lns configuration +template +int VerifyAsinh(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, aasinh, aref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + aasinh = sw::universal::asinh(a); + // generate reference + double da = double(a); + aref = std::asinh(da); + if (aasinh != aref) { + if (aasinh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "asinh", a, aasinh, aref); + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "asinh", a, aasinh, aref); + } + } + return nrOfFailedTests; +} + +// enumerate all hyperbolic cosec cases for an lns configuration +template +int VerifyAcosh(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, aacosh, aref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + aacosh = sw::universal::acosh(a); + // generate reference + double da = double(a); + aref = std::acosh(da); + if (aacosh != aref) { + if (aacosh.isnan() && aref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "acosh", a, aref, aacosh); + } + else { + //if (reportTestCases) ReportOneInputFunctionSuccess("aSS", "acosh", a, aref, aacosh); + } + } + return nrOfFailedTests; +} + +// enumerate all hypotenuse cases for an lns configuration +template +int VerifyHypot(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, b, hypot, ref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + double da = double(a); + for (size_t j = 1; j < NR_TEST_CASES; ++j) { + b.setbits(j); + hypot = sw::universal::hypot(a, b); + // generate reference + double db = double(b); + ref = std::hypot(da, db); + if (hypot != ref) { + if (hypot.isnan() && ref.isnan()) return 0; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportTwoInputFunctionError("FAIL", "hypot", a, b, hypot, ref); + } + else { + //if (reportTestCases) ReportTwoInputFunctionSuccess("PASS", "hypot", a, b, hypot, ref); + } + } + } + return nrOfFailedTests; +} + +}} // namespace sw::universal + diff --git a/include/universal/verification/posit_math_test_suite.hpp b/include/universal/verification/posit_math_test_suite.hpp index ce4d5a06a..411920739 100644 --- a/include/universal/verification/posit_math_test_suite.hpp +++ b/include/universal/verification/posit_math_test_suite.hpp @@ -24,7 +24,7 @@ namespace sw { namespace universal { // enumerate all NATURAL LOGARITHM cases for a posit configuration template -int VerifyLog(bool bReportIndividualTestCases) { +int VerifyLog(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, plog, pref; @@ -37,18 +37,19 @@ int VerifyLog(bool bReportIndividualTestCases) { pref = std::log(da); if (plog != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "log", pa, pref, plog); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "log", pa, plog, pref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "log", pa, pref, plog); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "log", pa, plog, pref); } } return nrOfFailedTests; } + // enumerate all BINARY LOGARITHM cases for a posit configuration template -int VerifyLog2(bool bReportIndividualTestCases) { +int VerifyLog2(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, plog2, pref; @@ -61,10 +62,10 @@ int VerifyLog2(bool bReportIndividualTestCases) { pref = std::log2(da); if (plog2 != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "log2", pa, pref, plog2); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "log2", pa, plog2, pref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "log2", pa, pref, plog2); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "log2", pa, plog2, pref); } } return nrOfFailedTests; @@ -73,7 +74,7 @@ int VerifyLog2(bool bReportIndividualTestCases) { // enumerate all DECIMAL LOGARITHM cases for a posit configuration template -int VerifyLog10(bool bReportIndividualTestCases) { +int VerifyLog10(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, plog10, pref; @@ -86,10 +87,10 @@ int VerifyLog10(bool bReportIndividualTestCases) { pref = std::log10(da); if (plog10 != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "log10", pa, pref, plog10); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "log10", pa, plog10, pref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "log10", pa, pref, plog10); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "log10", pa, plog10, pref); } } return nrOfFailedTests; @@ -98,7 +99,7 @@ int VerifyLog10(bool bReportIndividualTestCases) { // enumerate all base-e exponent cases for a posit configuration template -int VerifyExp(bool bReportIndividualTestCases) { +int VerifyExp(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, pexp, pref; @@ -112,19 +113,20 @@ int VerifyExp(bool bReportIndividualTestCases) { if (pexp != pref) { if (std::exp(da) != 0.0) { // exclude special posit rounding rule that projects to minpos nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "exp", pa, pref, pexp); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "exp", pa, pexp, pref); } } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "exp", pa, pref, pexp); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "exp", pa, pexp, pref); } } return nrOfFailedTests; } + // enumerate all base-2 exponent cases for a posit configuration template -int VerifyExp2(bool bReportIndividualTestCases) { +int VerifyExp2(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, pexp2, pref; @@ -138,19 +140,20 @@ int VerifyExp2(bool bReportIndividualTestCases) { if (pexp2 != pref) { if (std::exp2(da) != 0.0) { // exclude special posit rounding rule that projects to minpos nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "exp2", pa, pref, pexp2); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "exp2", pa, pexp2, pref); } } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "exp2", pa, pref, pexp2); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "exp2", pa, pexp2, pref); } } return nrOfFailedTests; } + // enumerate all power method cases for a posit configuration template -int VerifyPowerFunction(bool bReportIndividualTestCases, unsigned int maxSamples = 10000) { +int VerifyPowerFunction(bool reportTestCases, unsigned int maxSamples = 10000) { constexpr size_t NR_TEST_CASES = (unsigned(1) << nbits); int nrOfFailedTests = 0; posit pa, pb, ppow, pref; @@ -168,7 +171,7 @@ int VerifyPowerFunction(bool bReportIndividualTestCases, unsigned int maxSamples } catch (const posit_arithmetic_exception& err) { if (pa.isnar()) { - if (bReportIndividualTestCases) std::cerr << "Correctly caught arithmetic exception: " << err.what() << std::endl; + if (reportTestCases) std::cerr << "Correctly caught arithmetic exception: " << err.what() << std::endl; } else { throw err; @@ -180,10 +183,10 @@ int VerifyPowerFunction(bool bReportIndividualTestCases, unsigned int maxSamples pref = std::pow(da, db); if (ppow != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportTwoInputFunctionError("FAIL", "pow", pa, pb, pref, ppow); + if (reportTestCases) ReportTwoInputFunctionError("FAIL", "pow", pa, pb, ppow, pref); } else { - //if (bReportIndividualTestCases) ReportTwoInputFunctionSuccess("PASS", "pow", pa, pb, pref, ppow); + //if (reportTestCases) ReportTwoInputFunctionSuccess("PASS", "pow", pa, pb, ppow, pref); } ++testNr; if (testNr > maxSamples) { @@ -196,9 +199,10 @@ int VerifyPowerFunction(bool bReportIndividualTestCases, unsigned int maxSamples return nrOfFailedTests; } + // enumerate all trigonometric sine cases for a posit configuration template -int VerifySine(bool bReportIndividualTestCases) { +int VerifySine(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, psin, pref; @@ -211,18 +215,19 @@ int VerifySine(bool bReportIndividualTestCases) { pref = std::sin(da); if (psin != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "sin", pa, pref, psin); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "sin", pa, psin, pref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "sin", pa, pref, psin); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "sin", pa, psin, pref); } } return nrOfFailedTests; } + // enumerate all trigonometric cosine cases for a posit configuration template -int VerifyCosine(bool bReportIndividualTestCases) { +int VerifyCosine(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, pcos, pref; @@ -235,18 +240,19 @@ int VerifyCosine(bool bReportIndividualTestCases) { pref = std::cos(da); if (pcos != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "cos", pa, pref, pcos); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "cos", pa, pcos, pref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "cos", pa, pref, pcos); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "cos", pa, pcos, pref); } } return nrOfFailedTests; } + // enumerate all trigonometric tangent cases for a posit configuration template -int VerifyTangent(bool bReportIndividualTestCases) { +int VerifyTangent(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, ptan, pref; @@ -259,18 +265,19 @@ int VerifyTangent(bool bReportIndividualTestCases) { pref = std::tan(da); if (ptan != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "tan", pa, pref, ptan); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "tan", pa, ptan, pref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "tan", pa, pref, ptan); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "tan", pa, ptan, pref); } } return nrOfFailedTests; } + // enumerate all trigonometric cotangent cases for a posit configuration template -int VerifyAtan(bool bReportIndividualTestCases) { +int VerifyAtan(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, patan, pref; @@ -283,18 +290,19 @@ int VerifyAtan(bool bReportIndividualTestCases) { pref = std::atan(da); if (patan != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "atan", pa, pref, patan); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "atan", pa, patan, pref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "atan", pa, pref, patan); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "atan", pa, patan, pref); } } return nrOfFailedTests; } + // enumerate all trigonometric sec cases for a posit configuration template -int VerifyAsin(bool bReportIndividualTestCases) { +int VerifyAsin(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, pasin, pref; @@ -307,18 +315,19 @@ int VerifyAsin(bool bReportIndividualTestCases) { pref = std::asin(da); if (pasin != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "asin", pa, pref, pasin); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "asin", pa, pasin, pref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "asin", pa, pref, pasin); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "asin", pa, pasin, pref); } } return nrOfFailedTests; } + // enumerate all trigonometric cosec cases for a posit configuration template -int VerifyAcos(bool bReportIndividualTestCases) { +int VerifyAcos(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, pacos, pref; @@ -331,18 +340,19 @@ int VerifyAcos(bool bReportIndividualTestCases) { pref = std::acos(da); if (pacos != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "acos", pa, pref, pacos); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "acos", pa, pacos, pref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "acos", pa, pref, pacos); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "acos", pa, pacos, pref); } } return nrOfFailedTests; } + // enumerate all hyperbolic sine cases for a posit configuration template -int VerifySinh(bool bReportIndividualTestCases) { +int VerifySinh(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, psinh, pref; @@ -355,18 +365,19 @@ int VerifySinh(bool bReportIndividualTestCases) { pref = std::sinh(da); if (psinh != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "sinh", pa, pref, psinh); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "sinh", pa, psinh, pref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "sinh", pa, pref, psinh); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "sinh", pa, psinh, pref); } } return nrOfFailedTests; } + // enumerate all hyperbolic cosine cases for a posit configuration template -int VerifyCosh(bool bReportIndividualTestCases) { +int VerifyCosh(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, pcosh, pref; @@ -379,18 +390,19 @@ int VerifyCosh(bool bReportIndividualTestCases) { pref = std::cosh(da); if (pcosh != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "cosh", pa, pref, pcosh); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "cosh", pa, pcosh, pref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "cosh", pa, pref, pcosh); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "cosh", pa, pcosh, pref); } } return nrOfFailedTests; } + // enumerate all hyperbolic tangent cases for a posit configuration template -int VerifyTanh(bool bReportIndividualTestCases) { +int VerifyTanh(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, ptanh, pref; @@ -403,18 +415,19 @@ int VerifyTanh(bool bReportIndividualTestCases) { pref = std::tanh(da); if (ptanh != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "tanh", pa, pref, ptanh); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "tanh", pa, ptanh, pref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "tanh", pa, pref, ptanh); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "tanh", pa, ptanh, pref); } } return nrOfFailedTests; } + // enumerate all hyperbolic cotangent cases for a posit configuration template -int VerifyAtanh(bool bReportIndividualTestCases) { +int VerifyAtanh(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, patanh, pref; @@ -427,18 +440,19 @@ int VerifyAtanh(bool bReportIndividualTestCases) { pref = std::atanh(da); if (patanh != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "atanh", pa, pref, patanh); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "atanh", pa, patanh, pref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "atanh", pa, pref, patanh); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "atanh", pa, patanh, pref); } } return nrOfFailedTests; } + // enumerate all hyperbolic sec cases for a posit configuration template -int VerifyAsinh(bool bReportIndividualTestCases) { +int VerifyAsinh(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, pasinh, pref; @@ -451,18 +465,19 @@ int VerifyAsinh(bool bReportIndividualTestCases) { pref = std::asinh(da); if (pasinh != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "asinh", pa, pref, pasinh); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "asinh", pa, pasinh, pref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "asinh", pa, pref, pasinh); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "asinh", pa, pasinh, pref); } } return nrOfFailedTests; } + // enumerate all hyperbolic cosec cases for a posit configuration template -int VerifyAcosh(bool bReportIndividualTestCases) { +int VerifyAcosh(bool reportTestCases) { constexpr size_t NR_TEST_CASES = (1 << nbits); int nrOfFailedTests = 0; posit pa, pacosh, pref; @@ -475,15 +490,45 @@ int VerifyAcosh(bool bReportIndividualTestCases) { pref = std::acosh(da); if (pacosh != pref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportOneInputFunctionError("FAIL", "acosh", pa, pref, pacosh); + if (reportTestCases) ReportOneInputFunctionError("FAIL", "acosh", pa, pacosh, pref); } else { - //if (bReportIndividualTestCases) ReportOneInputFunctionSuccess("PASS", "acosh", pa, pref, pacosh); + //if (reportTestCases) ReportOneInputFunctionSuccess("PASS", "acosh", pa, pacosh, pref); } } return nrOfFailedTests; } + +// enumerate all hypotenuse cases for a posit configuration +template +int VerifyHypot(bool reportTestCases) { + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + posit pa, pb, phypot, pref; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + pa.setbits(i); + double da = double(pa); + for (size_t j = 1; j < NR_TEST_CASES; ++j) { + pb.setbits(j); + phypot = sw::universal::hypot(pa, pb); + // generate reference + double db = double(pb); + pref = std::hypot(da, db); + if (phypot != pref) { + nrOfFailedTests++; + if (reportTestCases) ReportTwoInputFunctionError("FAIL", "hypot", pa, pb, phypot, pref); + } + else { + //if (reportTestCases) ReportTwoInputFunctionSuccess("PASS", "hypot", pa, pb, phypot, pref); + } + } + } + return nrOfFailedTests; +} + + //////////////////////////////////// RANDOMIZED TEST SUITE FOR BINARY OPERATORS //////////////////////// diff --git a/include/universal/verification/posit_test_suite.hpp b/include/universal/verification/posit_test_suite.hpp index 5b7faa5aa..6da7f24b8 100644 --- a/include/universal/verification/posit_test_suite.hpp +++ b/include/universal/verification/posit_test_suite.hpp @@ -1,7 +1,7 @@ #pragma once // posit_test_suite.hpp : posit number system verification test suite // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 @@ -14,177 +14,6 @@ namespace sw { namespace universal { -#if 0 - static constexpr unsigned FLOAT_TABLE_WIDTH = 15; - - template - void ReportConversionError(const std::string& test_case, const std::string& op, double input, double reference, const posit& presult) { - constexpr size_t fbits = nbits - 3 - es; - - bool _sign; - regime _regime; - exponent _exponent; - fraction _fraction; - decode(presult.get(), _sign, _regime, _exponent, _fraction); - int _scale = _regime.scale() + _exponent.scale(); - - std::cerr << test_case - << " " << op << " " - << std::setw(FLOAT_TABLE_WIDTH) << input - << " did not convert to " - << std::setw(FLOAT_TABLE_WIDTH) << reference << " instead it yielded " - << std::setw(FLOAT_TABLE_WIDTH) << double(presult) - << " raw " << std::setw(nbits) << presult.get() - << " scale= " << std::setw(3) << _scale << " k= " << std::setw(3) << _regime.regime_k() << " exp= " << std::setw(3) << _exponent.scale() - << std::endl; - } - - template<> - void ReportConversionError<2,0>(const std::string& test_case, const std::string& op, double input, double reference, const posit<2, 0>& presult) { - constexpr size_t nbits = 2; - //constexpr size_t es = 0; - std::cerr << test_case - << " " << op << " " - << std::setw(FLOAT_TABLE_WIDTH) << input - << " did not convert to " - << std::setw(FLOAT_TABLE_WIDTH) << reference << " instead it yielded " - << std::setw(FLOAT_TABLE_WIDTH) << double(presult) - << " raw " << std::setw(nbits) << presult.get() -// << " scale= " << std::setw(3) << _scale << " k= " << std::setw(3) << _regime.regime_k() << " exp= " << std::setw(3) << _exponent.scale() - << std::endl; - - } - template<> - void ReportConversionError<3, 1>(const std::string& test_case, const std::string& op, double input, double reference, const posit<3, 1>& presult) { - constexpr size_t nbits = 3; - //constexpr size_t es = 1; - std::cerr << test_case - << " " << op << " " - << std::setw(FLOAT_TABLE_WIDTH) << input - << " did not convert to " - << std::setw(FLOAT_TABLE_WIDTH) << reference << " instead it yielded " - << std::setw(FLOAT_TABLE_WIDTH) << double(presult) - << " raw " << std::setw(nbits) << presult.get() - // << " scale= " << std::setw(3) << _scale << " k= " << std::setw(3) << _regime.regime_k() << " exp= " << std::setw(3) << _exponent.scale() - << std::endl; - - } - - template - void ReportConversionSuccess(const std::string& test_case, const std::string& op, double input, double reference, const posit& presult) { - static_assert(nbits > 1, "component_to_string requires nbits >= 2"); - if (nbits > 2) { - constexpr size_t fbits = nbits - 3 - es; - - bool _sign; - regime _regime; - exponent _exponent; - fraction _fraction; - decode(presult.get(), _sign, _regime, _exponent, _fraction); - int _scale = _regime.scale() + _exponent.scale(); - - std::cerr << test_case - << " " << op << " " - << std::setw(FLOAT_TABLE_WIDTH) << input - << " did convert to " - << std::setw(FLOAT_TABLE_WIDTH) << double(presult) << " reference value is " - << std::setw(FLOAT_TABLE_WIDTH) << reference - << " raw " << std::setw(nbits) << presult.get() - << " scale= " << std::setw(3) << _scale << " k= " << std::setw(3) << _regime.regime_k() << " exp= " << std::setw(3) << _exponent.scale() - << std::endl; - } - else { - if (nbits == 2) { - std::cerr << test_case - << " " << op << " " - << std::setw(FLOAT_TABLE_WIDTH) << input - << " did convert to " - << std::setw(FLOAT_TABLE_WIDTH) << double(presult) << " reference value is " - << std::setw(FLOAT_TABLE_WIDTH) << reference - << " raw " << std::setw(nbits) << presult.get() -// << " scale= " << std::setw(3) << _scale << " k= " << std::setw(3) << _regime.regime_k() << " exp= " << std::setw(3) << _exponent.scale() - << std::endl; - } - } - } - - template - void ReportUnaryArithmeticError(const std::string& test_case, const std::string& op, const posit& rhs, const posit& pref, const posit& presult) { - std::cerr << test_case - << " " << op << " " - << std::setw(FLOAT_TABLE_WIDTH) << rhs - << " != " - << std::setw(FLOAT_TABLE_WIDTH) << pref << " instead it yielded " - << std::setw(FLOAT_TABLE_WIDTH) << presult - << " " << pref.get() << " vs " << presult.get() << std::endl; - } - - template - void ReportUnaryArithmeticSuccess(const std::string& test_case, const std::string& op, const posit& rhs, const posit& pref, const posit& presult) { - std::cerr << test_case - << " " << op << " " - << std::setw(FLOAT_TABLE_WIDTH) << rhs - << " == " - << std::setw(FLOAT_TABLE_WIDTH) << presult << " reference value is " - << std::setw(FLOAT_TABLE_WIDTH) << pref - << " " << pretty_print(presult) << std::endl; - } - - template - void ReportBinaryArithmeticError(const std::string& test_case, const std::string& op, const posit& lhs, const posit& rhs, const posit& pref, const posit& presult) { - std::cerr << test_case << " " - << std::setprecision(20) - << std::setw(FLOAT_TABLE_WIDTH) << lhs - << " " << op << " " - << std::setw(FLOAT_TABLE_WIDTH) << rhs - << " != " - << std::setw(FLOAT_TABLE_WIDTH) << pref << " instead it yielded " - << std::setw(FLOAT_TABLE_WIDTH) << presult - << " " << pref.get() << " vs " << presult.get() - << std::setprecision(5) - << std::endl; - } - - template - void ReportBinaryArithmeticErrorInBinary(const std::string& test_case, const std::string& op, const posit& lhs, const posit& rhs, const posit& pref, const posit& presult) { - std::cerr << test_case << " " - << std::setw(nbits) << lhs.get() - << " " << op << " " - << std::setw(nbits) << rhs.get() - << " != " - << std::setw(nbits) << pref.get() << " instead it yielded " - << std::setw(nbits) << presult.get() - << " " << pretty_print(presult,20) << std::endl; - } - - template - void ReportBinaryArithmeticSuccess(const std::string& test_case, const std::string& op, const posit& lhs, const posit& rhs, const posit& pref, const posit& presult) { - std::cerr << test_case << " " - << std::setprecision(20) - << std::setw(FLOAT_TABLE_WIDTH) << lhs - << " " << op << " " - << std::setw(FLOAT_TABLE_WIDTH) << rhs - << " == " - << std::setw(FLOAT_TABLE_WIDTH) << presult << " reference value is " - << std::setw(FLOAT_TABLE_WIDTH) << pref - << " " << pref.get() << " vs " << presult.get() - << std::setprecision(5) - << std::endl; - } - - template - void ReportBinaryArithmeticSuccessInBinary(const std::string& test_case, const std::string& op, const posit& lhs, const posit& rhs, const posit& pref, const posit& presult) { - std::cerr << test_case << " " - << std::setw(nbits) << lhs.get() - << " " << op << " " - << std::setw(nbits) << rhs.get() - << " == " - << std::setw(nbits) << presult.get() << " reference value is " - << std::setw(nbits) << pref.get() - << " " << pretty_print(presult,20) << std::endl; - } -#endif - template void ReportDecodeError(const std::string& test_case, const posit& actual, double golden_value) { std::cerr << test_case << " actual " << actual << " required " << golden_value << std::endl; @@ -331,6 +160,7 @@ namespace sw { namespace universal { } return nrOfFailedTests; } + template<> int VerifyConversion(bool bReportIndividualTestCases) { int nrOfFailedTestCases = 0; diff --git a/include/universal/verification/quire_test_suite.hpp b/include/universal/verification/quire_test_suite.hpp index b659a0165..d9820dd13 100644 --- a/include/universal/verification/quire_test_suite.hpp +++ b/include/universal/verification/quire_test_suite.hpp @@ -169,7 +169,7 @@ int GenerateRegimePatternsForQuireAccumulation(bool bReportIndividualTestCases) } patterns[nrOfPatterns] = pattern & mask; // 1.0 -#if CONFIRM_PATTERNS +#ifdef CONFIRM_PATTERNS std::cout << hex; for (std::vector::const_iterator it = patterns.begin(); it != patterns.end(); it++) { std::cout << std::setw(3) << right << *it << std::endl; diff --git a/include/universal/verification/test_case.hpp b/include/universal/verification/test_case.hpp index c85c618cc..c4bc6d751 100644 --- a/include/universal/verification/test_case.hpp +++ b/include/universal/verification/test_case.hpp @@ -37,6 +37,8 @@ namespace sw { namespace universal { std::string op, opName; Number c; Real _c(0); + std::cerr << to_binary(a) << " : " << a << " vs " << _a << '\n'; + std::cerr << to_binary(b) << " : " << b << " vs " << _b << '\n'; switch (_operator) { case TestCaseOperator::ADD: c = a + b; @@ -71,13 +73,15 @@ namespace sw { namespace universal { auto oldprecision = std::cout.precision(); std::cout << std::setprecision(10); - std::cout << "+-------- Test Case: " << opName << " ---------------------------------------------------\ninput operands : " << typeid(Real).name() << '\n'; + std::cout << "+-------- Test Case: " << opName << " ---------------------------------------------------\n"; + std::cout << " input operands : " << type_tag(_a) << '\n'; std::cout << std::setw(nbits) << _a << op << std::setw(nbits) << _b << " = " << std::setw(nbits) << _c << std::endl; - std::cout << to_binary(_a) << " : " << _a << '\n'; - std::cout << to_binary(_b) << " : " << _b << '\n'; - std::cout << to_binary(_c) << " : " << _c << '\n'; - std::cout << "+--------\ntarget number : " << typeid(Number).name() << '\n'; - std::cout << a << op << b << " = " << c << " (reference: " << reference << ")\n"; + std::cout << "a " << to_binary(_a) << " : " << _a << '\n'; + std::cout << "b " << to_binary(_b) << " : " << _b << '\n'; + std::cout << "c " << to_binary(_c) << " : " << _c << '\n'; + std::cout << "+-------- Test Case:\n"; + std::cout << " target type : " << type_tag(a) << '\n'; + std::cout << std::setw(nbits) << a << op << std::setw(nbits) << b << " = " << std::setw(nbits) << c << " (reference: " << reference << ")\n"; std::cout << "a " << to_binary(a, true) << op << '\n'; std::cout << "b " << to_binary(b, true) << " =\n"; std::cout << "c " << to_binary(c, true) << '\n'; diff --git a/include/universal/verification/test_reporters.hpp b/include/universal/verification/test_reporters.hpp index b07310b00..92b9af25b 100644 --- a/include/universal/verification/test_reporters.hpp +++ b/include/universal/verification/test_reporters.hpp @@ -17,7 +17,7 @@ namespace sw { namespace universal { -#define NUMBER_COLUMN_WIDTH 20 +#define NUMBER_COLUMN_WIDTH 25 void ReportTestSuiteHeader(const std::string& test_suite, bool reportTestCases) { std::cerr << test_suite << (reportTestCases ? ": report test cases" : ": results only") << '\n'; diff --git a/include/universal/verification/test_suite.hpp b/include/universal/verification/test_suite.hpp index 58a1dc27a..2e4106460 100644 --- a/include/universal/verification/test_suite.hpp +++ b/include/universal/verification/test_suite.hpp @@ -1,3 +1,4 @@ +#pragma once // test_suite.hpp: reusable test suite for small number systems // // Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. diff --git a/include/universal/verification/test_suite_arithmetic.hpp b/include/universal/verification/test_suite_arithmetic.hpp index 11eeb13db..00e812b26 100644 --- a/include/universal/verification/test_suite_arithmetic.hpp +++ b/include/universal/verification/test_suite_arithmetic.hpp @@ -1,7 +1,7 @@ #pragma once -// test_suite_arithmetic.hpp : arithmetic test suite for arbitrary universal number systems +// test_suite_arithmetic.hpp : generic arithmetic test suite for arbitrary universal number systems // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 @@ -35,10 +35,10 @@ namespace sw { namespace universal { /// enumerate all negation cases for a TestType /// /// -/// +/// /// template -int VerifyNegation(const std::string& tag, bool bReportIndividualTestCases) { +int VerifyNegation(const std::string& tag, bool reportTestCases) { constexpr size_t nbits = TestType::nbits; constexpr size_t NR_TEST_CASES = (size_t(1) << nbits); int nrOfFailedTests = 0; @@ -52,10 +52,10 @@ int VerifyNegation(const std::string& tag, bool bReportIndividualTestCases) { ref = -da; if (neg != ref) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportUnaryArithmeticError("FAIL", "-", a, ref, neg); + if (reportTestCases) ReportUnaryArithmeticError("FAIL", "-", a, ref, neg); } else { - //if (bReportIndividualTestCases) ReportUnaryArithmeticSuccess("PASS", "-", a, ref, neg); + //if (reportTestCases) ReportUnaryArithmeticSuccess("PASS", "-", a, ref, neg); } } return nrOfFailedTests; @@ -67,10 +67,10 @@ int VerifyNegation(const std::string& tag, bool bReportIndividualTestCases) { /// /// the number system type to verify /// string representation of the type -/// if yes, report on individual test failures +/// if yes, report on individual test failures /// template -int VerifyAddition(bool bReportIndividualTestCases) { +int VerifyAddition(bool reportTestCases) { constexpr size_t nbits = TestType::nbits; // number system concept requires a static member indicating its size in bits constexpr size_t NR_VALUES = (size_t(1) << nbits); int nrOfFailedTests = 0; @@ -79,7 +79,7 @@ int VerifyAddition(bool bReportIndividualTestCases) { TestType maxpos(SpecificValue::maxpos), maxneg(SpecificValue::maxneg); double da, db, ref; // make certain that IEEE doubles are sufficient as reference - TestType a, b, result, cref; + TestType a, b, c, cref; for (size_t i = 0; i < NR_VALUES; i++) { a.setbits(i); // number system concept requires a member function setbits() da = double(a); @@ -90,7 +90,7 @@ int VerifyAddition(bool bReportIndividualTestCases) { #if THROW_ARITHMETIC_EXCEPTION // catching overflow try { - result = a + b; + c = a + b; } catch (...) { if (ref < double(maxneg) || ref > double(maxpos)) { @@ -101,18 +101,17 @@ int VerifyAddition(bool bReportIndividualTestCases) { nrOfFailedTests++; } } - #else - result = a + b; + c = a + b; #endif // THROW_ARITHMETIC_EXCEPTION cref = ref; - if (result != cref) { - if (ref == 0 and result.iszero()) continue; // mismatched is ignored as compiler optimizes away negative zero + if (c != cref) { + if (ref == 0 and c.iszero()) continue; // mismatched is ignored as compiler optimizes away negative zero nrOfFailedTests++; - if (bReportIndividualTestCases) ReportBinaryArithmeticError("FAIL", "+", a, b, cref, result); + if (reportTestCases) ReportBinaryArithmeticError("FAIL", "+", a, b, c, ref); } else { - //if (bReportIndividualTestCases) ReportBinaryArithmeticSuccess("PASS", "+", a, b, cref, result); + //if (reportTestCases) ReportBinaryArithmeticSuccess("PASS", "+", a, b, c, ref); } if (nrOfFailedTests > 9) return nrOfFailedTests; } @@ -124,6 +123,66 @@ int VerifyAddition(bool bReportIndividualTestCases) { return nrOfFailedTests; } +/// +/// Enumerate all subtraction cases for a number system configuration. +/// Uses doubles to create a reference to compare to. +/// +/// the number system type to verify +/// string representation of the type +/// if yes, report on individual test failures +/// +template +int VerifySubtraction(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; // number system concept requires a static member indicating its size in bits + constexpr size_t NR_VALUES = (size_t(1) << nbits); + int nrOfFailedTests = 0; + // set the saturation clamps + TestType maxpos(SpecificValue::maxpos), maxneg(SpecificValue::maxneg); + + double da, db, ref; // make certain that IEEE doubles are sufficient as reference + TestType a, b, c, cref; + for (size_t i = 0; i < NR_VALUES; i++) { + a.setbits(i); // number system concept requires a member function setbits() + da = double(a); + for (size_t j = 0; j < NR_VALUES; j++) { + b.setbits(j); + db = double(b); + ref = da - db; +#if THROW_ARITHMETIC_EXCEPTION + // catching overflow + try { + c = a - b; + } + catch (...) { + if (ref < double(maxneg) || ref > double(maxpos)) { + // correctly caught the overflow exception + continue; + } + else { + nrOfFailedTests++; + } + } +#else + c = a - b; +#endif // THROW_ARITHMETIC_EXCEPTION + cref = ref; + if (c != cref) { + if (ref == 0 and c.iszero()) continue; // mismatched is ignored as compiler optimizes away negative zero + nrOfFailedTests++; + if (reportTestCases) ReportBinaryArithmeticError("FAIL", "-", a, b, c, ref); + } + else { + //if (reportTestCases) ReportBinaryArithmeticSuccess("PASS", "-", a, b, c, ref); + } + if (nrOfFailedTests > 9) return nrOfFailedTests; + } + if constexpr (NR_VALUES > 256 * 256) { + if (i % (NR_VALUES / 25) == 0) std::cout << '.'; + } + } + std::cout << std::endl; + return nrOfFailedTests; +} }} // namespace sw::universal diff --git a/tests/appenv/multifile/fixpnts.cpp b/tests/appenv/multifile/fixpnts.cpp index 01415cbb1..8228d2040 100644 --- a/tests/appenv/multifile/fixpnts.cpp +++ b/tests/appenv/multifile/fixpnts.cpp @@ -7,7 +7,7 @@ #include #include -using fp8_4s = sw::universal::fixpnt<8, 4, sw::universal::Saturating, uint8_t>; +using fp8_4s = sw::universal::fixpnt<8, 4, sw::universal::Saturate, uint8_t>; fp8_4s fixpntPolynomial(const std::vector& coef, const fp8_4s& x) { using namespace sw::universal; diff --git a/tests/appenv/multifile/logs.cpp b/tests/appenv/multifile/logs.cpp index 9efb17ea9..7e2611e5b 100644 --- a/tests/appenv/multifile/logs.cpp +++ b/tests/appenv/multifile/logs.cpp @@ -7,7 +7,7 @@ #include #include -using LNS8 = sw::universal::lns<8, 2, std::uint8_t>; +using LNS8 = sw::universal::lns<8, 2, sw::universal::Saturating, std::uint8_t>; LNS8 lnsPolynomial(const std::vector& coef, const LNS8& x) { using namespace sw::universal; diff --git a/tests/appenv/multifile/main.cpp b/tests/appenv/multifile/main.cpp index 6a8a2196e..1d0cad1a0 100644 --- a/tests/appenv/multifile/main.cpp +++ b/tests/appenv/multifile/main.cpp @@ -37,7 +37,7 @@ // forward references using Integer = sw::universal::integer<8, uint8_t, sw::universal::IntegerNumberType::IntegerNumber>; -using Fixpnt = sw::universal::fixpnt<8, 4, sw::universal::Saturating, uint8_t>; +using Fixpnt = sw::universal::fixpnt<8, 4, sw::universal::Saturate, uint8_t>; using Cfloat = sw::universal::half; using Posit = sw::universal::posit<8,2>; diff --git a/tests/blocktriple/conversion/conversion.cpp b/tests/blocktriple/conversion/conversion.cpp index 184054c62..d13b106b7 100644 --- a/tests/blocktriple/conversion/conversion.cpp +++ b/tests/blocktriple/conversion/conversion.cpp @@ -186,7 +186,7 @@ try { int scaleTestFailures = 0; for (int i = 1; i < 1025; i *= 2) { float f = float(i); - blocktriple<9, BlockTripleOperator::ADD, uint8_t> nut = f; + blocktriple<9, BlockTripleOperator::ADD, uint8_t> nut(f); // std::cout << std::setw(4) << i << " : " << to_binary(nut) << '\n'; if (f != float(nut)) { ++scaleTestFailures; diff --git a/tests/cfloat/math/hypotenuse.cpp b/tests/cfloat/math/hypotenuse.cpp new file mode 100644 index 000000000..db7399085 --- /dev/null +++ b/tests/cfloat/math/hypotenuse.cpp @@ -0,0 +1,114 @@ +// hypotenuse.cpp: test suite runner for the hypotenuse functions (hypot, hypotf, hypotl) +// +// 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 + +// 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 +template +void GenerateTestCase(Ty _a, Ty _b) { + sw::universal::cfloat a, b, pref, result; + a = _a; + b = _b; + Ty ref = std::hypot(_a, _b); + pref = ref; + result = sw::universal::hypot(a, b); + std::cout << std::setprecision(nbits - 2); + std::cout << " hypot(" << _a << ", " << _b << ") = " << ref << '\n'; + std::cout << " hypot(" << a << ", " << b << ") = " << result << " : " << to_binary(result) << " (reference: " << to_binary(pref) << ") "; + std::cout << (pref == result ? "PASS" : "FAIL") << "\n\n"; + std::cout << std::setprecision(5); +} + + +// 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 0 +#define REGRESSION_LEVEL_4 0 +#endif + + +int main() +try { + using namespace sw::universal; + + std::string test_suite = "cfloat hypotenuse validation"; + std::string test_tag = "hypotenuse"; + bool reportTestCases = true; + int nrOfFailedTestCases = 0; + + ReportTestSuiteHeader(test_suite, reportTestCases); + +#if MANUAL_TESTING + // generate individual testcases to hand trace/debug + cfloat<8, 3, std::uint8_t, true, false, false> a(SpecificValue::maxpos); + std::cout << "maxpos " << type_tag(a) << " : " << a << '\n'; + GenerateTestCase< 8, 3, std::uint8_t, true, false, false, float>(3.0f, 4.0f); + GenerateTestCase<16, 5, std::uint8_t, true, false, false, float>(3.0f, 4.0f); + + nrOfFailedTestCases += ReportTestResult(VerifyHypot< cfloat<8, 2, std::uint8_t, true, true, false> >(reportTestCases), "cfloat<8,2,sub+normal+super>", "hypot"); + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; // ignore errors +#else + +#if REGRESSION_LEVEL_1 + nrOfFailedTestCases += ReportTestResult(VerifyHypot< cfloat<4, 1, std::uint8_t, true, true, false> >(reportTestCases), "cfloat<4, 1,sub+normal+super>", "hypot"); + nrOfFailedTestCases += ReportTestResult(VerifyHypot< cfloat<5, 1, std::uint8_t, true, true, false> >(reportTestCases), "cfloat<5, 1,sub+normal+super>", "hypot"); + nrOfFailedTestCases += ReportTestResult(VerifyHypot< cfloat<6, 2, std::uint8_t, true, true, false> >(reportTestCases), "cfloat<6, 2,sub+normal+super>", "hypot"); + nrOfFailedTestCases += ReportTestResult(VerifyHypot< cfloat<7, 2, std::uint8_t, true, true, false> >(reportTestCases), "cfloat<7, 2,sub+normal+super>", "hypot"); + nrOfFailedTestCases += ReportTestResult(VerifyHypot< cfloat<8, 3, std::uint8_t, true, true, false> >(reportTestCases), "cfloat<8, 3,sub+normal+super>", "hypot"); +#endif + +#if REGRESSION_LEVEL_2 + +#endif + +#if REGRESSION_LEVEL_3 + +#endif + +#if REGRESSION_LEVEL_4 + // nbits=64 requires long double compiler support + nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(reportTestCases, OPCODE_SQRT, 1000), "posit<64,2>", "hypot"); +#endif + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + +#endif // MANUAL_TESTING +} +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 (const std::runtime_error& err) { + std::cerr << "Caught runtime exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} diff --git a/tests/cfloat/math/logarithm.cpp b/tests/cfloat/math/logarithm.cpp index b8c7a01f0..e205df77f 100644 --- a/tests/cfloat/math/logarithm.cpp +++ b/tests/cfloat/math/logarithm.cpp @@ -1,6 +1,6 @@ // logarithm.cpp: test suite runner for the logarithm functions (log2, log10, ln) // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 @@ -8,7 +8,7 @@ #include #include -// generate specific test case that you can trace with the trace conditions in cfloat.h +// 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 template void GenerateTestCase(Ty a) { diff --git a/tests/cfloat/math/next.cpp b/tests/cfloat/math/next.cpp index f3cfb346d..7dc111a1b 100644 --- a/tests/cfloat/math/next.cpp +++ b/tests/cfloat/math/next.cpp @@ -1,6 +1,6 @@ // next.cpp: test suite runner for ULP functions nextafter, nextforward // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 diff --git a/tests/fixpnt/api/api.cpp b/tests/fixpnt/api/api.cpp index 65fd205ec..2d1920249 100644 --- a/tests/fixpnt/api/api.cpp +++ b/tests/fixpnt/api/api.cpp @@ -1,4 +1,4 @@ -// api.cpp: test suite runner for class interface tests of the fixpnt type +// api.cpp: test suite runner for class interface tests of the fixpnt type // // Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. // @@ -98,18 +98,18 @@ try { } ///////////////////////////////////////////////////////////////////////////////////// - //// SATURATING fixed-point + //// Saturate fixed-point { int start = nrOfFailedTestCases; // construction with explicit arithmetic type and default BlockType (uint8_t) - fixpnt<8, 4, Saturating> a(-8.0), b(-8.125), c(7.875), d(-7.875); - // b initialized to -8.125 in saturating arithmetic becomes -8 + fixpnt<8, 4, Saturate> a(-8.0), b(-8.125), c(7.875), d(-7.875); + // b initialized to -8.125 in Saturate arithmetic becomes -8 // if (0 != (c + d)) ++nrOfFailedTestCases; //cout << to_binary(c + d) << endl; if (a != b) ++nrOfFailedTestCases; - if (a != (d - 1)) ++nrOfFailedTestCases; // saturating to maxneg - if (a != (d - 0.5)) ++nrOfFailedTestCases; // saturating to maxneg + if (a != (d - 1)) ++nrOfFailedTestCases; // Saturate to maxneg + if (a != (d - 0.5)) ++nrOfFailedTestCases; // Saturate to maxneg if (nrOfFailedTestCases - start > 0) { std::cout << to_binary(a) << ' ' << to_binary(b) << ' ' << to_binary(c) << ' ' << to_binary(d) << '\n'; std::cout << to_binary(d - 1) << ' ' << to_binary(d - 0.5) << '\n'; @@ -141,7 +141,7 @@ try { Fixed a{ 0 }; std::cout << "type identifier : " << type_tag(a) << '\n'; std::cout << "type identifier : " << type_tag(fixpnt<8, 4>()) << '\n'; - std::cout << "type identifier : " << type_tag(fixpnt<8, 4, Saturating, uint16_t>()) << '\n'; + std::cout << "type identifier : " << type_tag(fixpnt<8, 4, Saturate, uint16_t>()) << '\n'; } { diff --git a/tests/fixpnt/api/complex_api.cpp b/tests/fixpnt/api/complex_api.cpp index e041be605..80f82032b 100644 --- a/tests/fixpnt/api/complex_api.cpp +++ b/tests/fixpnt/api/complex_api.cpp @@ -164,7 +164,7 @@ try { #endif { - using FixedPoint = sw::universal::fixpnt<4, 3, sw::universal::Saturating, uint8_t>; + using FixedPoint = sw::universal::fixpnt<4, 3, sw::universal::Saturate, uint8_t>; FixedPoint one = 1; FixedPoint minus_one = -1; FixedPoint fp = 1.0f; diff --git a/tests/fixpnt/arithmetic/sat_addition.cpp b/tests/fixpnt/arithmetic/sat_addition.cpp index 2823cb422..06205416e 100644 --- a/tests/fixpnt/arithmetic/sat_addition.cpp +++ b/tests/fixpnt/arithmetic/sat_addition.cpp @@ -1,4 +1,4 @@ -// sat_addition.cpp: test suite runner for arbitrary configuration fixed-point saturating addition +// sat_addition.cpp: test suite runner for arbitrary configuration fixed-point Saturate addition // // Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. // @@ -20,7 +20,7 @@ template void GenerateTestCase(Ty _a, Ty _b) { Ty ref; - sw::universal::fixpnt a, b, cref, result; + sw::universal::fixpnt a, b, cref, result; a = _a; b = _b; result = a + b; @@ -73,15 +73,15 @@ try { GenerateTestCase<8, 4>(0.5f, 1.0f); reportTestCases = true; - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 1, Saturating, uint8_t>(reportTestCases), "fixpnt<4,1,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 1, Saturate, uint8_t>(reportTestCases), "fixpnt<4,1,Saturate,uint8_t>", test_tag); #ifdef REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 0, Saturating, uint8_t>(reportTestCases), "fixpnt<4,0,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 1, Saturating, uint8_t>(reportTestCases), "fixpnt<4,1,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 2, Saturating, uint8_t>(reportTestCases), "fixpnt<4,2,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 3, Saturating, uint8_t>(reportTestCases), "fixpnt<4,3,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 4, Saturating, uint8_t>(reportTestCases), "fixpnt<4,4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 0, Saturate, uint8_t>(reportTestCases), "fixpnt<4,0,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 1, Saturate, uint8_t>(reportTestCases), "fixpnt<4,1,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 2, Saturate, uint8_t>(reportTestCases), "fixpnt<4,2,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 3, Saturate, uint8_t>(reportTestCases), "fixpnt<4,3,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 4, Saturate, uint8_t>(reportTestCases), "fixpnt<4,4,Saturate,uint8_t>", test_tag); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); @@ -89,40 +89,40 @@ try { #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyAddition< 4, 0, Saturating, uint8_t>(reportTestCases), "fixpnt< 4, 0,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition< 4, 1, Saturating, uint8_t>(reportTestCases), "fixpnt< 4, 1,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition< 4, 2, Saturating, uint8_t>(reportTestCases), "fixpnt< 4, 2,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition< 4, 3, Saturating, uint8_t>(reportTestCases), "fixpnt< 4, 3,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition< 4, 4, Saturating, uint8_t>(reportTestCases), "fixpnt< 4, 4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition< 4, 0, Saturate, uint8_t>(reportTestCases), "fixpnt< 4, 0,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition< 4, 1, Saturate, uint8_t>(reportTestCases), "fixpnt< 4, 1,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition< 4, 2, Saturate, uint8_t>(reportTestCases), "fixpnt< 4, 2,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition< 4, 3, Saturate, uint8_t>(reportTestCases), "fixpnt< 4, 3,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition< 4, 4, Saturate, uint8_t>(reportTestCases), "fixpnt< 4, 4,Saturate,uint8_t>", test_tag); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 0, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 0,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 1, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 1,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 2, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 2,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 3, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 3,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 4, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 4,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 5, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 5,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 6, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 6,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 7, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 7,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 8, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 8,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 0, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 0,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 1, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 1,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 2, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 2,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 3, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 3,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 4, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 4,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 5, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 5,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 6, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 6,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 7, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 7,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition< 8, 8, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 8,Saturate,uint8_t>", test_tag); #endif #if REGRESSION_LEVEL_3 - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 3, Saturating, uint8_t>(reportTestCases), "fixpnt<10, 3,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 5, Saturating, uint8_t>(reportTestCases), "fixpnt<10, 5,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 7, Saturating, uint8_t>(reportTestCases), "fixpnt<10, 7,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 3, Saturate, uint8_t>(reportTestCases), "fixpnt<10, 3,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 5, Saturate, uint8_t>(reportTestCases), "fixpnt<10, 5,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 7, Saturate, uint8_t>(reportTestCases), "fixpnt<10, 7,Saturate,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<11, 3, Saturating, uint8_t>(reportTestCases), "fixpnt<11, 3,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<11, 5, Saturating, uint8_t>(reportTestCases), "fixpnt<11, 5,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<11, 7, Saturating, uint8_t>(reportTestCases), "fixpnt<11, 7,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<11, 3, Saturate, uint8_t>(reportTestCases), "fixpnt<11, 3,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<11, 5, Saturate, uint8_t>(reportTestCases), "fixpnt<11, 5,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<11, 7, Saturate, uint8_t>(reportTestCases), "fixpnt<11, 7,Saturate,uint8_t>", test_tag); #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyAddition<12, 0, Saturating, uint8_t>(reportTestCases), "fixpnt<12, 0,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<12, 4, Saturating, uint8_t>(reportTestCases), "fixpnt<12, 4,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<12, 8, Saturating, uint8_t>(reportTestCases), "fixpnt<12, 8,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<12,12, Saturating, uint8_t>(reportTestCases), "fixpnt<12,12,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<12, 0, Saturate, uint8_t>(reportTestCases), "fixpnt<12, 0,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<12, 4, Saturate, uint8_t>(reportTestCases), "fixpnt<12, 4,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<12, 8, Saturate, uint8_t>(reportTestCases), "fixpnt<12, 8,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition<12,12, Saturate, uint8_t>(reportTestCases), "fixpnt<12,12,Saturate,uint8_t>", test_tag); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/tests/fixpnt/arithmetic/sat_division.cpp b/tests/fixpnt/arithmetic/sat_division.cpp index 78ed2a99c..4ee46b40f 100644 --- a/tests/fixpnt/arithmetic/sat_division.cpp +++ b/tests/fixpnt/arithmetic/sat_division.cpp @@ -118,7 +118,7 @@ inline sw::universal::blockbinary<2 * nbits + roundingBits, BlockType> unrounded template void GenerateTestCase(Ty _a, Ty _b) { Ty ref; - sw::universal::fixpnt a, b, cref, result; + sw::universal::fixpnt a, b, cref, result; a = _a; b = _b; result = a / b; @@ -251,7 +251,6 @@ try { GenerateComparison(0x3, 0x4); // 0110 and 0100 in 4bit formats GenerateComparison(0x4, 0x1); // 010.0 / 000.1 = 2 / 0.5 = 4 = 100.0 = -4 - // generate individual testcases to hand trace/debug GenerateTestCase<4, 1>(3.0f, 1.5f); diff --git a/tests/fixpnt/arithmetic/sat_multiplication.cpp b/tests/fixpnt/arithmetic/sat_multiplication.cpp index a5e24dd6a..585c4223b 100644 --- a/tests/fixpnt/arithmetic/sat_multiplication.cpp +++ b/tests/fixpnt/arithmetic/sat_multiplication.cpp @@ -1,4 +1,4 @@ -// sat_multiplication.cpp: test suite runner for arbitrary configuration fixed-point saturating multiplication +// sat_multiplication.cpp: test suite runner for arbitrary configuration fixed-point Saturate multiplication // // Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. // @@ -12,7 +12,6 @@ #define FIXPNT_FAST_SPECIALIZATION // second: enable/disable fixpnt arithmetic exceptions #define FIXPNT_THROW_ARITHMETIC_EXCEPTION 1 - #include #include @@ -20,7 +19,7 @@ // for most bugs they are traceable with _trace_conversion and _trace_add template void GenerateTestCase(Ty _a, Ty _b) { - sw::universal::fixpnt a, b, cref, result; + sw::universal::fixpnt a, b, cref, result; sw::universal::blockbinary<2 * nbits> full; a = _a; b = _b; @@ -90,40 +89,40 @@ try { GenerateTestCase<4, 1>(-0.5f, -3.5f); GenerateTestCase<4, 1>(-3.5f, -0.5f); GenerateTestCase<4, 1>( 1.5f, 2.5f); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 1, Saturating, uint8_t>(reportTestCases), "fixpnt<4,1,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 1, Saturate, uint8_t>(reportTestCases), "fixpnt<4,1,Saturate,uint8_t>", test_tag); cout << endl; // fixpnt<6,2> GenerateTestCase<6, 2>(0.25f, -8.0f); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<6, 2, Saturating, uint8_t>(reportTestCases), "fixpnt<6,2,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<6, 2, Saturate, uint8_t>(reportTestCases), "fixpnt<6,2,Saturate,uint8_t>", test_tag); cout << endl; // fixpnt<6,5> GenerateTestCase<6, 5>(0.03125f, -1.0f); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<6, 5, Saturating, uint8_t>(reportTestCases), "fixpnt<6,5,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<6, 5, Saturate, uint8_t>(reportTestCases), "fixpnt<6,5,Saturate,uint8_t>", test_tag); cout << endl; // fixpnt<8,4> GenerateTestCase<8, 4>(1.125f, -7.0625f); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 4, Saturating, uint8_t>(reportTestCases), "fixpnt<8,4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 4, Saturate, uint8_t>(reportTestCases), "fixpnt<8,4,Saturate,uint8_t>", test_tag); // fixpnt<8,8> GenerateTestCase<8, 8>(0.01171875f, 0.3359375f); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 8, Saturating, uint8_t>(reportTestCases), "fixpnt<8,8,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 8, Saturate, uint8_t>(reportTestCases), "fixpnt<8,8,Saturate,uint8_t>", test_tag); // fixpnt<10,9> GenerateTestCase<10,9>(0.251953125f, 0.994140625f); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10,9, Saturating, uint8_t>(reportTestCases), "fixpnt<10,9,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10,9, Saturate, uint8_t>(reportTestCases), "fixpnt<10,9,Saturate,uint8_t>", test_tag); #ifdef REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 0, Saturating, uint8_t>(reportTestCases), "fixpnt<4,0,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 1, Saturating, uint8_t>(reportTestCases), "fixpnt<4,1,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 2, Saturating, uint8_t>(reportTestCases), "fixpnt<4,2,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 3, Saturating, uint8_t>(reportTestCases), "fixpnt<4,3,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 4, Saturating, uint8_t>(reportTestCases), "fixpnt<4,4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 0, Saturate, uint8_t>(reportTestCases), "fixpnt<4,0,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 1, Saturate, uint8_t>(reportTestCases), "fixpnt<4,1,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 2, Saturate, uint8_t>(reportTestCases), "fixpnt<4,2,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 3, Saturate, uint8_t>(reportTestCases), "fixpnt<4,3,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 4, Saturate, uint8_t>(reportTestCases), "fixpnt<4,4,Saturate,uint8_t>", test_tag); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); @@ -131,51 +130,51 @@ try { #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 4, 0, Saturating, uint8_t >(reportTestCases), "fixpnt< 4, 0,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 4, 1, Saturating, uint8_t >(reportTestCases), "fixpnt< 4, 1,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 4, 2, Saturating, uint8_t >(reportTestCases), "fixpnt< 4, 2,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 4, 3, Saturating, uint8_t >(reportTestCases), "fixpnt< 4, 3,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 4, 4, Saturating, uint8_t >(reportTestCases), "fixpnt< 4, 4,Saturating,uint8_t >", test_tag); - - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 6, 0, Saturating, uint8_t >(reportTestCases), "fixpnt< 6, 0,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 6, 1, Saturating, uint8_t >(reportTestCases), "fixpnt< 6, 1,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 6, 2, Saturating, uint8_t >(reportTestCases), "fixpnt< 6, 2,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 6, 3, Saturating, uint8_t >(reportTestCases), "fixpnt< 6, 3,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 6, 4, Saturating, uint8_t >(reportTestCases), "fixpnt< 6, 4,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 6, 5, Saturating, uint8_t >(reportTestCases), "fixpnt< 6, 5,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 6, 6, Saturating, uint8_t >(reportTestCases), "fixpnt< 6, 6,Saturating,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 4, 0, Saturate, uint8_t >(reportTestCases), "fixpnt< 4, 0,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 4, 1, Saturate, uint8_t >(reportTestCases), "fixpnt< 4, 1,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 4, 2, Saturate, uint8_t >(reportTestCases), "fixpnt< 4, 2,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 4, 3, Saturate, uint8_t >(reportTestCases), "fixpnt< 4, 3,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 4, 4, Saturate, uint8_t >(reportTestCases), "fixpnt< 4, 4,Saturate,uint8_t >", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 6, 0, Saturate, uint8_t >(reportTestCases), "fixpnt< 6, 0,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 6, 1, Saturate, uint8_t >(reportTestCases), "fixpnt< 6, 1,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 6, 2, Saturate, uint8_t >(reportTestCases), "fixpnt< 6, 2,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 6, 3, Saturate, uint8_t >(reportTestCases), "fixpnt< 6, 3,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 6, 4, Saturate, uint8_t >(reportTestCases), "fixpnt< 6, 4,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 6, 5, Saturate, uint8_t >(reportTestCases), "fixpnt< 6, 5,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 6, 6, Saturate, uint8_t >(reportTestCases), "fixpnt< 6, 6,Saturate,uint8_t >", test_tag); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 0, Saturating, uint8_t >(reportTestCases), "fixpnt< 8, 0,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 1, Saturating, uint8_t >(reportTestCases), "fixpnt< 8, 1,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 2, Saturating, uint8_t >(reportTestCases), "fixpnt< 8, 2,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 3, Saturating, uint8_t >(reportTestCases), "fixpnt< 8, 3,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 4, Saturating, uint8_t >(reportTestCases), "fixpnt< 8, 4,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 5, Saturating, uint8_t >(reportTestCases), "fixpnt< 8, 5,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 6, Saturating, uint8_t >(reportTestCases), "fixpnt< 8, 6,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 7, Saturating, uint8_t >(reportTestCases), "fixpnt< 8, 7,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 8, Saturating, uint8_t >(reportTestCases), "fixpnt< 8, 8,Saturating,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 0, Saturate, uint8_t >(reportTestCases), "fixpnt< 8, 0,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 1, Saturate, uint8_t >(reportTestCases), "fixpnt< 8, 1,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 2, Saturate, uint8_t >(reportTestCases), "fixpnt< 8, 2,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 3, Saturate, uint8_t >(reportTestCases), "fixpnt< 8, 3,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 4, Saturate, uint8_t >(reportTestCases), "fixpnt< 8, 4,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 5, Saturate, uint8_t >(reportTestCases), "fixpnt< 8, 5,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 6, Saturate, uint8_t >(reportTestCases), "fixpnt< 8, 6,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 7, Saturate, uint8_t >(reportTestCases), "fixpnt< 8, 7,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication< 8, 8, Saturate, uint8_t >(reportTestCases), "fixpnt< 8, 8,Saturate,uint8_t >", test_tag); #endif #if REGRESSION_LEVEL_3 - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 0, Saturating, uint8_t >(reportTestCases), "fixpnt<10, 0,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 3, Saturating, uint8_t >(reportTestCases), "fixpnt<10, 3,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 4, Saturating, uint8_t >(reportTestCases), "fixpnt<10, 4,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 7, Saturating, uint8_t >(reportTestCases), "fixpnt<10, 7,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 8, Saturating, uint8_t >(reportTestCases), "fixpnt<10, 8,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 9, Saturating, uint8_t >(reportTestCases), "fixpnt<10, 9,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10,10, Saturating, uint8_t >(reportTestCases), "fixpnt<10,10,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10,10, Saturating, uint16_t>(reportTestCases), "fixpnt<10,10,Saturating,uint16_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 0, Saturate, uint8_t >(reportTestCases), "fixpnt<10, 0,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 3, Saturate, uint8_t >(reportTestCases), "fixpnt<10, 3,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 4, Saturate, uint8_t >(reportTestCases), "fixpnt<10, 4,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 7, Saturate, uint8_t >(reportTestCases), "fixpnt<10, 7,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 8, Saturate, uint8_t >(reportTestCases), "fixpnt<10, 8,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 9, Saturate, uint8_t >(reportTestCases), "fixpnt<10, 9,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10,10, Saturate, uint8_t >(reportTestCases), "fixpnt<10,10,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10,10, Saturate, uint16_t>(reportTestCases), "fixpnt<10,10,Saturate,uint16_t>", test_tag); #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<12, 0, Saturating, uint8_t >(reportTestCases), "fixpnt<12,0,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<12, 4, Saturating, uint8_t >(reportTestCases), "fixpnt<12,4,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<12, 7, Saturating, uint8_t >(reportTestCases), "fixpnt<12,7,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<12, 8, Saturating, uint8_t >(reportTestCases), "fixpnt<12,8,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<12, 9, Saturating, uint8_t >(reportTestCases), "fixpnt<12,9,Saturating,uint8_t >", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<12,12, Saturating, uint8_t >(reportTestCases), "fixpnt<12,12,Saturating,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<12, 0, Saturate, uint8_t >(reportTestCases), "fixpnt<12,0,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<12, 4, Saturate, uint8_t >(reportTestCases), "fixpnt<12,4,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<12, 7, Saturate, uint8_t >(reportTestCases), "fixpnt<12,7,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<12, 8, Saturate, uint8_t >(reportTestCases), "fixpnt<12,8,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<12, 9, Saturate, uint8_t >(reportTestCases), "fixpnt<12,9,Saturate,uint8_t >", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<12,12, Saturate, uint8_t >(reportTestCases), "fixpnt<12,12,Saturate,uint8_t >", test_tag); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/tests/fixpnt/arithmetic/sat_subtraction.cpp b/tests/fixpnt/arithmetic/sat_subtraction.cpp index 0e2945f9a..e936369e7 100644 --- a/tests/fixpnt/arithmetic/sat_subtraction.cpp +++ b/tests/fixpnt/arithmetic/sat_subtraction.cpp @@ -1,4 +1,4 @@ -// sat_subtraction.cpp: test suite runner for arbitrary configuration fixed-point saturating subtraction +// sat_subtraction.cpp: test suite runner for arbitrary configuration fixed-point Saturate subtraction // // Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. // @@ -20,7 +20,7 @@ template void GenerateTestCase(Ty _a, Ty _b) { Ty ref; - sw::universal::fixpnt a, b, cref, result; + sw::universal::fixpnt a, b, cref, result; a = _a; b = _b; result = a - b; @@ -71,14 +71,14 @@ try { GenerateTestCase<4, 1>(-4.0f, -4.0f); reportTestCases = true; - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 1, Saturating, uint8_t>(reportTestCases), "fixpnt<4,1,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 1, Saturate, uint8_t>(reportTestCases), "fixpnt<4,1,Saturate,uint8_t>", test_tag); #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 0, Saturating, uint8_t>(reportTestCases), "fixpnt<4,0,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 1, Saturating, uint8_t>(reportTestCases), "fixpnt<4,1,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 2, Saturating, uint8_t>(reportTestCases), "fixpnt<4,2,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 3, Saturating, uint8_t>(reportTestCases), "fixpnt<4,3,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 4, Saturating, uint8_t>(reportTestCases), "fixpnt<4,4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 0, Saturate, uint8_t>(reportTestCases), "fixpnt<4,0,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 1, Saturate, uint8_t>(reportTestCases), "fixpnt<4,1,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 2, Saturate, uint8_t>(reportTestCases), "fixpnt<4,2,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 3, Saturate, uint8_t>(reportTestCases), "fixpnt<4,3,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 4, Saturate, uint8_t>(reportTestCases), "fixpnt<4,4,Saturate,uint8_t>", test_tag); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); @@ -86,51 +86,51 @@ try { #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 5, 0, Saturating, uint8_t>(reportTestCases), "fixpnt< 5, 0,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 5, 1, Saturating, uint8_t>(reportTestCases), "fixpnt< 5, 1,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 5, 2, Saturating, uint8_t>(reportTestCases), "fixpnt< 5, 2,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 5, 3, Saturating, uint8_t>(reportTestCases), "fixpnt< 5, 3,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 5, 4, Saturating, uint8_t>(reportTestCases), "fixpnt< 5, 4,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 5, 5, Saturating, uint8_t>(reportTestCases), "fixpnt< 5, 5,Saturating,uint8_t>", test_tag); - - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 0, Saturating, uint8_t>(reportTestCases), "fixpnt< 7, 0,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 1, Saturating, uint8_t>(reportTestCases), "fixpnt< 7, 1,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 2, Saturating, uint8_t>(reportTestCases), "fixpnt< 7, 2,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 3, Saturating, uint8_t>(reportTestCases), "fixpnt< 7, 3,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 4, Saturating, uint8_t>(reportTestCases), "fixpnt< 7, 4,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 5, Saturating, uint8_t>(reportTestCases), "fixpnt< 7, 5,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 6, Saturating, uint8_t>(reportTestCases), "fixpnt< 7, 6,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 7, Saturating, uint8_t>(reportTestCases), "fixpnt< 7, 7,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 5, 0, Saturate, uint8_t>(reportTestCases), "fixpnt< 5, 0,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 5, 1, Saturate, uint8_t>(reportTestCases), "fixpnt< 5, 1,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 5, 2, Saturate, uint8_t>(reportTestCases), "fixpnt< 5, 2,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 5, 3, Saturate, uint8_t>(reportTestCases), "fixpnt< 5, 3,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 5, 4, Saturate, uint8_t>(reportTestCases), "fixpnt< 5, 4,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 5, 5, Saturate, uint8_t>(reportTestCases), "fixpnt< 5, 5,Saturate,uint8_t>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 0, Saturate, uint8_t>(reportTestCases), "fixpnt< 7, 0,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 1, Saturate, uint8_t>(reportTestCases), "fixpnt< 7, 1,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 2, Saturate, uint8_t>(reportTestCases), "fixpnt< 7, 2,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 3, Saturate, uint8_t>(reportTestCases), "fixpnt< 7, 3,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 4, Saturate, uint8_t>(reportTestCases), "fixpnt< 7, 4,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 5, Saturate, uint8_t>(reportTestCases), "fixpnt< 7, 5,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 6, Saturate, uint8_t>(reportTestCases), "fixpnt< 7, 6,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 7, 7, Saturate, uint8_t>(reportTestCases), "fixpnt< 7, 7,Saturate,uint8_t>", test_tag); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 0, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 0,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 1, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 1,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 2, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 2,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 3, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 3,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 4, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 4,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 5, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 5,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 6, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 6,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 7, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 7,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 8, Saturating, uint8_t>(reportTestCases), "fixpnt< 8, 8,Saturating,uint8_t>", test_tag); - - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 9, 3, Saturating, uint8_t>(reportTestCases), "fixpnt<9,3,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 9, 5, Saturating, uint8_t>(reportTestCases), "fixpnt<9,5,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 9, 7, Saturating, uint8_t>(reportTestCases), "fixpnt<9,7,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 0, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 0,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 1, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 1,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 2, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 2,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 3, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 3,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 4, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 4,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 5, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 5,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 6, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 6,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 7, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 7,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 8, 8, Saturate, uint8_t>(reportTestCases), "fixpnt< 8, 8,Saturate,uint8_t>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 9, 3, Saturate, uint8_t>(reportTestCases), "fixpnt<9,3,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 9, 5, Saturate, uint8_t>(reportTestCases), "fixpnt<9,5,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction< 9, 7, Saturate, uint8_t>(reportTestCases), "fixpnt<9,7,Saturate,uint8_t>", test_tag); #endif #if REGRESSION_LEVEL_3 - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<13, 0, Saturating, uint8_t>(reportTestCases), "fixpnt<13, 0,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<13, 5, Saturating, uint8_t>(reportTestCases), "fixpnt<13, 5,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<13, 9, Saturating, uint8_t>(reportTestCases), "fixpnt<13, 9,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<13,12, Saturating, uint8_t>(reportTestCases), "fixpnt<13,12,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction<13, 0, Saturate, uint8_t>(reportTestCases), "fixpnt<13, 0,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction<13, 5, Saturate, uint8_t>(reportTestCases), "fixpnt<13, 5,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction<13, 9, Saturate, uint8_t>(reportTestCases), "fixpnt<13, 9,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction<13,12, Saturate, uint8_t>(reportTestCases), "fixpnt<13,12,Saturate,uint8_t>", test_tag); #endif #if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<15, 3, Saturating, uint8_t>(reportTestCases), "fixpnt<15, 3,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<15, 6, Saturating, uint8_t>(reportTestCases), "fixpnt<15, 6,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<15, 9, Saturating, uint8_t>(reportTestCases), "fixpnt<15, 9,Saturating,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<15,12, Saturating, uint8_t>(reportTestCases), "fixpnt<15,12,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction<15, 3, Saturate, uint8_t>(reportTestCases), "fixpnt<15, 3,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction<15, 6, Saturate, uint8_t>(reportTestCases), "fixpnt<15, 6,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction<15, 9, Saturate, uint8_t>(reportTestCases), "fixpnt<15, 9,Saturate,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction<15,12, Saturate, uint8_t>(reportTestCases), "fixpnt<15,12,Saturate,uint8_t>", test_tag); #endif ReportTestSuiteResults(test_suite, nrOfFailedTestCases); diff --git a/tests/fixpnt/conversion/sat_conversion.cpp b/tests/fixpnt/conversion/sat_conversion.cpp index 38c0685d7..acf21afad 100644 --- a/tests/fixpnt/conversion/sat_conversion.cpp +++ b/tests/fixpnt/conversion/sat_conversion.cpp @@ -1,4 +1,4 @@ -// sat_conversion.cpp: test suite runner for fixed-point saturating conversions +// sat_conversion.cpp: test suite runner for fixed-point Saturate conversions // // Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. // @@ -71,7 +71,7 @@ int main() try { using namespace sw::universal; - std::string test_suite = "fixed-point saturating conversion "; + std::string test_suite = "fixed-point Saturate conversion "; std::string test_tag = "conversion IEEE-754 normals"; bool reportTestCases = true; int nrOfFailedTestCases = 0; @@ -88,55 +88,55 @@ try { //cout << "quire<512,240>\n"; //ReportFixedPointRanges<512, 240>(cout); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<4, 4, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<4,4,Saturating,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<4, 4, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<4,4,Saturate,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 8, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<8,8,Saturating,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 8, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<8,8,Saturate,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 1, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<12,1,Saturating,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 1, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<12,1,Saturate,uint8_t>"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; // ignore failures #else // !MANUAL_TESTING #if REGRESSION_LEVEL_1 - nrOfFailedTestCases = ReportTestResult(VerifyConversion<4, 0, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt< 4, 0,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<4, 1, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt< 4, 1,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<4, 2, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt< 4, 2,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<4, 3, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt< 4, 3,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<4, 4, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt< 4, 4,Saturating,uint8_t>"); - - nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 0, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 0,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 1, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 1,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 2, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 2,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 3, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 3,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 4, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 4,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 5, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 5,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 6, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 6,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 7, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 7,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 8, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 8,Saturating,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<4, 0, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt< 4, 0,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<4, 1, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt< 4, 1,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<4, 2, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt< 4, 2,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<4, 3, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt< 4, 3,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<4, 4, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt< 4, 4,Saturate,uint8_t>"); + + nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 0, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 0,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 1, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 1,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 2, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 2,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 3, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 3,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 4, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 4,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 5, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 5,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 6, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 6,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 7, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 7,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<8, 8, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt< 8, 8,Saturate,uint8_t>"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 0, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<12, 0,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 1, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<12, 1,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 2, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<12, 2,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 3, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<12, 3,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 4, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<12, 4,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 6, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<12, 6,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 8, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<12, 8,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<12,10, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<12,10,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<12,12, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<12,12,Saturating,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 0, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<12, 0,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 1, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<12, 1,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 2, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<12, 2,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 3, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<12, 3,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 4, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<12, 4,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 6, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<12, 6,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<12, 8, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<12, 8,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<12,10, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<12,10,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<12,12, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<12,12,Saturate,uint8_t>"); #endif #if REGRESSION_LEVEL_3 - nrOfFailedTestCases = ReportTestResult(VerifyConversion<16, 0, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<16, 0,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<16, 1, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<16, 1,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<16, 2, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<16, 2,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<16, 3, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<16, 3,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<16, 4, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<16, 4,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<16, 8, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<16, 8,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<16,12, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<16,12,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyConversion<16,16, Saturating, uint8_t>(reportTestCases), test_tag, "fixpnt<16,16,Saturating,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<16, 0, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<16, 0,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<16, 1, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<16, 1,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<16, 2, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<16, 2,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<16, 3, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<16, 3,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<16, 4, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<16, 4,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<16, 8, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<16, 8,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<16,12, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<16,12,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyConversion<16,16, Saturate, uint8_t>(reportTestCases), test_tag, "fixpnt<16,16,Saturate,uint8_t>"); #endif #if REGRESSION_LEVEL_4 diff --git a/tests/fixpnt/math/complex.cpp b/tests/fixpnt/math/complex.cpp index 2b49ce43b..763399368 100644 --- a/tests/fixpnt/math/complex.cpp +++ b/tests/fixpnt/math/complex.cpp @@ -57,7 +57,7 @@ try { constexpr size_t nbits = 4; constexpr size_t rbits = 3; - constexpr bool arithmetic = Saturating; + constexpr bool arithmetic = Saturate; using bt = uint8_t; using Real = fixpnt; std::complex x, y; diff --git a/tests/fixpnt/math/exponent.cpp b/tests/fixpnt/math/exponent.cpp index 58dd3bae4..ead673b54 100644 --- a/tests/fixpnt/math/exponent.cpp +++ b/tests/fixpnt/math/exponent.cpp @@ -77,7 +77,7 @@ try { #if MANUAL_TESTING // generate individual testcases to hand trace/debug - GenerateTestCase<16, 1, Saturating, uint8_t, float>(4.0f); + GenerateTestCase<16, 1, Saturate, uint8_t, float>(4.0f); #if GENERATE_EXPONENT_TABLES @@ -89,7 +89,7 @@ try { #endif // manual exhaustive test - using FixedPoint = fixpnt<8, 2, Saturating, uint8_t>; + using FixedPoint = fixpnt<8, 2, Saturate, uint8_t>; nrOfFailedTestCases += ReportTestResult(VerifyExp(reportTestCases), type_tag(FixedPoint), "exp"); nrOfFailedTestCases += ReportTestResult(VerifyExp2(reportTestCases), type_tag(FixedPoint) "exp2"); @@ -98,22 +98,22 @@ try { #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyExp< fixpnt< 8, 2, Saturating, uint8_t> >(reportTestCases), "fixpnt<8,2>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp< fixpnt< 8, 3, Saturating, uint8_t> >(reportTestCases), "fixpnt<8,3>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp< fixpnt< 9, 2, Saturating, uint8_t> >(reportTestCases), "fixpnt<9,2>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp< fixpnt<10, 2, Saturating, uint8_t> >(reportTestCases), "fixpnt<10,2>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp< fixpnt<10, 3, Saturating, uint8_t> >(reportTestCases), "fixpnt<10,3>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp< fixpnt<12, 4, Saturating, uint8_t> >(reportTestCases), "fixpnt<12,4>", "exp"); - nrOfFailedTestCases += ReportTestResult(VerifyExp< fixpnt<16, 5, Saturating, uint8_t> >(reportTestCases), "fixpnt<16,5>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp< fixpnt< 8, 2, Saturate, uint8_t> >(reportTestCases), "fixpnt<8,2>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp< fixpnt< 8, 3, Saturate, uint8_t> >(reportTestCases), "fixpnt<8,3>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp< fixpnt< 9, 2, Saturate, uint8_t> >(reportTestCases), "fixpnt<9,2>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp< fixpnt<10, 2, Saturate, uint8_t> >(reportTestCases), "fixpnt<10,2>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp< fixpnt<10, 3, Saturate, uint8_t> >(reportTestCases), "fixpnt<10,3>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp< fixpnt<12, 4, Saturate, uint8_t> >(reportTestCases), "fixpnt<12,4>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp< fixpnt<16, 5, Saturate, uint8_t> >(reportTestCases), "fixpnt<16,5>", "exp"); // base-2 exponent testing - nrOfFailedTestCases += ReportTestResult(VerifyExp2< fixpnt<8, 2, Saturating, uint8_t> >(reportTestCases), "fixpnt<8,2>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2< fixpnt<8, 3, Saturating, uint8_t> >(reportTestCases), "fixpnt<8,3>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2< fixpnt<9, 2, Saturating, uint8_t> >(reportTestCases), "fixpnt<9,2>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2< fixpnt<10, 2, Saturating, uint8_t> >(reportTestCases), "fixpnt<10,2>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2< fixpnt<10, 3, Saturating, uint8_t> >(reportTestCases), "fixpnt<10,3>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2< fixpnt<12, 4, Saturating, uint8_t> >(reportTestCases), "fixpnt<12,4>", "exp2"); - nrOfFailedTestCases += ReportTestResult(VerifyExp2< fixpnt<16, 5, Saturating, uint8_t> >(reportTestCases), "fixpnt<16,5>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2< fixpnt<8, 2, Saturate, uint8_t> >(reportTestCases), "fixpnt<8,2>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2< fixpnt<8, 3, Saturate, uint8_t> >(reportTestCases), "fixpnt<8,3>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2< fixpnt<9, 2, Saturate, uint8_t> >(reportTestCases), "fixpnt<9,2>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2< fixpnt<10, 2, Saturate, uint8_t> >(reportTestCases), "fixpnt<10,2>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2< fixpnt<10, 3, Saturate, uint8_t> >(reportTestCases), "fixpnt<10,3>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2< fixpnt<12, 4, Saturate, uint8_t> >(reportTestCases), "fixpnt<12,4>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2< fixpnt<16, 5, Saturate, uint8_t> >(reportTestCases), "fixpnt<16,5>", "exp2"); #endif diff --git a/tests/fixpnt/math/hyperbolic.cpp b/tests/fixpnt/math/hyperbolic.cpp index a6bea3110..5c73d991b 100644 --- a/tests/fixpnt/math/hyperbolic.cpp +++ b/tests/fixpnt/math/hyperbolic.cpp @@ -128,17 +128,17 @@ try { #if MANUAL_TESTING // generate individual testcases to hand trace/debug - GenerateTestCaseSinh<16, 8, Saturating, uint8_t, double>(pi / 4.0); - GenerateTestCaseCosh<16, 8, Saturating, uint8_t, double>(pi / 4.0); - GenerateTestCaseTanh<16, 8, Saturating, uint8_t, double>(pi / 4.0); - GenerateTestCaseAsinh<16, 8, Saturating, uint8_t, double>(pi / 2.0); - GenerateTestCaseAcosh<16, 8, Saturating, uint8_t, double>(pi / 2.0); - GenerateTestCaseAtanh<16, 8, Saturating, uint8_t, double>(pi / 4.0); + GenerateTestCaseSinh<16, 8, Saturate, uint8_t, double>(pi / 4.0); + GenerateTestCaseCosh<16, 8, Saturate, uint8_t, double>(pi / 4.0); + GenerateTestCaseTanh<16, 8, Saturate, uint8_t, double>(pi / 4.0); + GenerateTestCaseAsinh<16, 8, Saturate, uint8_t, double>(pi / 2.0); + GenerateTestCaseAcosh<16, 8, Saturate, uint8_t, double>(pi / 2.0); + GenerateTestCaseAtanh<16, 8, Saturate, uint8_t, double>(pi / 4.0); std::cout << '\n'; // manual exhaustive test - using FixedPoint = fixpnt<8, 4, Saturating, uint8_t>; + using FixedPoint = fixpnt<8, 4, Saturate, uint8_t>; nrOfFailedTestCases += ReportTestResult(VerifySinh(true), type_tag(FixedPoint()), "sinh"); nrOfFailedTestCases += ReportTestResult(VerifyCosh(true), type_tag(FixedPoint()), "cosh"); nrOfFailedTestCases += ReportTestResult(VerifyTanh(true), type_tag(FixedPoint()), "tanh"); @@ -151,7 +151,7 @@ try { #else #if REGRESSION_LEVEL_1 - using FixedPoint = fixpnt<8, 4, Saturating, uint8_t>; + using FixedPoint = fixpnt<8, 4, Saturate, uint8_t>; nrOfFailedTestCases += ReportTestResult(VerifySinh(true), type_tag(FixedPoint()), "sinh"); nrOfFailedTestCases += ReportTestResult(VerifyCosh(true), type_tag(FixedPoint()), "cosh"); nrOfFailedTestCases += ReportTestResult(VerifyTanh(true), type_tag(FixedPoint()), "tanh"); diff --git a/tests/fixpnt/math/logarithm.cpp b/tests/fixpnt/math/logarithm.cpp index b53133f8e..04abf9cfd 100644 --- a/tests/fixpnt/math/logarithm.cpp +++ b/tests/fixpnt/math/logarithm.cpp @@ -54,7 +54,7 @@ try { #if MANUAL_TESTING // generate individual testcases to hand trace/debug - GenerateTestCase<16, 1, Saturating, uint8_t, float>(4.0f); + GenerateTestCase<16, 1, Saturate, uint8_t, float>(4.0f); #if GENERATE_LOG_TABLES GenerateLogarithmTable<3, 0>(); @@ -71,7 +71,7 @@ try { #endif // manual exhaustive test - using FixedPoint = fixpnt<10, 5, Saturating, uint8_t>; + using FixedPoint = fixpnt<10, 5, Saturate, uint8_t>; nrOfFailedTestCases += ReportTestResult(VerifyLog< FixedPoint >(reportTestCases), type_tag(FixedPoint()), "log"); nrOfFailedTestCases += ReportTestResult(VerifyLog2< FixedPoint >(reportTestCases), type_tag(FixedPoint()), "log2"); nrOfFailedTestCases += ReportTestResult(VerifyLog10< FixedPoint >(reportTestCases), type_tag(FixedPoint()), "log10"); @@ -81,7 +81,7 @@ try { #else #if REGRESSION_LEVEL_1 - using FixedPoint = fixpnt<10, 5, Saturating, uint8_t>; + using FixedPoint = fixpnt<10, 5, Saturate, uint8_t>; nrOfFailedTestCases += ReportTestResult(VerifyLog< FixedPoint >(reportTestCases), type_tag(FixedPoint()), "log"); nrOfFailedTestCases += ReportTestResult(VerifyLog2< FixedPoint >(reportTestCases), type_tag(FixedPoint()), "log2"); nrOfFailedTestCases += ReportTestResult(VerifyLog10< FixedPoint >(reportTestCases), type_tag(FixedPoint()), "log10"); @@ -97,21 +97,21 @@ try { // nbits=64 requires long double compiler support { - using FixedPoint = fixpnt<10, 5, Saturating, uint8_t>; + using FixedPoint = fixpnt<10, 5, Saturate, uint8_t>; nrOfFailedTestCases += ReportTestResult(VerifyLog< FixedPoint >(reportTestCases), type_tag(FixedPoint()), "log"); nrOfFailedTestCases += ReportTestResult(VerifyLog2< FixedPoint >(reportTestCases), type_tag(FixedPoint()), "log2"); nrOfFailedTestCases += ReportTestResult(VerifyLog10< FixedPoint >(reportTestCases), type_tag(FixedPoint()), "log10"); } { - using FixedPoint = fixpnt<12, 6, Saturating, uint8_t>; + using FixedPoint = fixpnt<12, 6, Saturate, uint8_t>; nrOfFailedTestCases += ReportTestResult(VerifyLog< FixedPoint >(reportTestCases), type_tag(FixedPoint), "log"); } { - using FixedPoint = fixpnt<14, 7, Saturating, uint8_t>; + using FixedPoint = fixpnt<14, 7, Saturate, uint8_t>; nrOfFailedTestCases += ReportTestResult(VerifyLog< FixedPoint >(reportTestCases), type_tag(FixedPoint), "log"); } { - using FixedPoint = fixpnt<16, 8, Saturating, uint8_t>; + using FixedPoint = fixpnt<16, 8, Saturate, uint8_t>; nrOfFailedTestCases += ReportTestResult(VerifyLog< FixedPoint >(reportTestCases), type_tag(FixedPoint), "log"); } #endif diff --git a/tests/fixpnt/math/pow.cpp b/tests/fixpnt/math/pow.cpp index 275df4b15..acf85d7b9 100644 --- a/tests/fixpnt/math/pow.cpp +++ b/tests/fixpnt/math/pow.cpp @@ -87,7 +87,7 @@ try { std::cout << "fixpnt pow() function validation\n"; - using FixedPoint = fixpnt<8, 2, Saturating, uint8_t>; + using FixedPoint = fixpnt<8, 2, Saturate, uint8_t>; nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction< FixedPoint >(reportTestCases), type_tag(FixedPoint()), "pow"); diff --git a/tests/fixpnt/math/trigonometry.cpp b/tests/fixpnt/math/trigonometry.cpp index d9665bed5..8c8348cd8 100644 --- a/tests/fixpnt/math/trigonometry.cpp +++ b/tests/fixpnt/math/trigonometry.cpp @@ -204,12 +204,12 @@ try { #if MANUAL_TESTING // generate individual testcases to hand trace/debug -// GenerateTestCase<8, 0, Saturating, uint8_t, double>(m_pi); -// GenerateTestCase<16, 1, Saturating, uint8_t, double>(m_pi); -// GenerateTestCase<32, 2, Saturating, uint8_t, double>(m_pi); -// GenerateTestCase<64, 3, Saturating, uint8_t, float>(m_pi); -// GenerateTestCase<128, 4, Saturating, uint8_t, float>(m_pi); -// GenerateTestCase<256, 5, Saturating, uint8_t, float>(m_pi); +// GenerateTestCase<8, 0, Saturate, uint8_t, double>(m_pi); +// GenerateTestCase<16, 1, Saturate, uint8_t, double>(m_pi); +// GenerateTestCase<32, 2, Saturate, uint8_t, double>(m_pi); +// GenerateTestCase<64, 3, Saturate, uint8_t, float>(m_pi); +// GenerateTestCase<128, 4, Saturate, uint8_t, float>(m_pi); +// GenerateTestCase<256, 5, Saturate, uint8_t, float>(m_pi); std::cout << "Standard sin(pi/2) : " << std::sin(m_pi*0.5) << " vs sinpi(0.5): " << sinpi(0.5) << '\n'; std::cout << "Standard sin(pi) : " << std::sin(m_pi) << " vs sinpi(1.0): " << sinpi(1.0) << '\n'; @@ -219,9 +219,9 @@ try { std::cout << "haversine(0.0, 0.0, 90.0, 0.0, 1.0) = " << haversine(0.0, 0.0, 90.0, 0.0, 1.0) << '\n'; std::cout << "haversine(0.0, 0.0, 180.0, 0.0, 1.0) = " << haversine(0.0, 0.0, 180, 0.0, 1.0) << '\n'; - GenerateTestCase<16, 1, Saturating, uint8_t, double>(m_pi_2); + GenerateTestCase<16, 1, Saturate, uint8_t, double>(m_pi_2); - using FixedPoint = fixpnt<8, 2, Saturating, uint8_t>; + using FixedPoint = fixpnt<8, 2, Saturate, uint8_t>; nrOfFailedTestCases += ReportTestResult(VerifySine< FixedPoint >(true), type_tag(FixedPoint()), "sin"); nrOfFailedTestCases += ReportTestResult(VerifyCosine< FixedPoint >(true), type_tag(FixedPoint()), "cos"); nrOfFailedTestCases += ReportTestResult(VerifyTangent(true), type_tag(FixedPoint()), "tan"); @@ -234,7 +234,7 @@ try { #else #if REGRESSION_LEVEL_1 - using FixedPoint = fixpnt<8, 2, Saturating, uint8_t>; + using FixedPoint = fixpnt<8, 2, Saturate, uint8_t>; nrOfFailedTestCases += ReportTestResult(VerifySine< FixedPoint >(true), type_tag(FixedPoint()), "sin"); nrOfFailedTestCases += ReportTestResult(VerifyCosine< FixedPoint >(true), type_tag(FixedPoint()), "cos"); nrOfFailedTestCases += ReportTestResult(VerifyTangent(true), type_tag(FixedPoint()), "tan"); diff --git a/tests/fixpnt/math/truncate.cpp b/tests/fixpnt/math/truncate.cpp index 389c8812f..5110bb53e 100644 --- a/tests/fixpnt/math/truncate.cpp +++ b/tests/fixpnt/math/truncate.cpp @@ -82,19 +82,19 @@ try { #if MANUAL_TESTING // generate individual testcases to hand trace/debug - nrOfFailedTestCases = ReportTestResult(VerifyFloor< fixpnt<8, 2, Saturating, uint8_t> >(reportTestCases), "floor", "fixpnt<8,2,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyCeil < fixpnt<8, 2, Saturating, uint8_t> >(reportTestCases), "ceil", "fixpnt<8,2,Saturating,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyFloor< fixpnt<8, 2, Saturate, uint8_t> >(reportTestCases), "floor", "fixpnt<8,2,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyCeil < fixpnt<8, 2, Saturate, uint8_t> >(reportTestCases), "ceil", "fixpnt<8,2,Saturate,uint8_t>"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; // ignore failures #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases = ReportTestResult(VerifyFloor< fixpnt<8, 2, Saturating, uint8_t> >(reportTestCases), "floor", "fixpnt<8,2,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyCeil < fixpnt<8, 2, Saturating, uint8_t> >(reportTestCases), "ceil", "fixpnt<8,2,Saturating,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyFloor< fixpnt<8, 2, Saturate, uint8_t> >(reportTestCases), "floor", "fixpnt<8,2,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyCeil < fixpnt<8, 2, Saturate, uint8_t> >(reportTestCases), "ceil", "fixpnt<8,2,Saturate,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyFloor< fixpnt<16, 8, Saturating, uint8_t> >(reportTestCases), "floor", "fixpnt<16,8,Saturating,uint8_t>"); - nrOfFailedTestCases = ReportTestResult(VerifyCeil < fixpnt<16, 8, Saturating, uint8_t> >(reportTestCases), "ceil", "fixpnt<16,8,Saturating,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyFloor< fixpnt<16, 8, Saturate, uint8_t> >(reportTestCases), "floor", "fixpnt<16,8,Saturate,uint8_t>"); + nrOfFailedTestCases = ReportTestResult(VerifyCeil < fixpnt<16, 8, Saturate, uint8_t> >(reportTestCases), "ceil", "fixpnt<16,8,Saturate,uint8_t>"); #endif diff --git a/tests/functions/logistic_loss.cpp b/tests/functions/logistic_loss.cpp index ed2703642..b0bffbe5c 100644 --- a/tests/functions/logistic_loss.cpp +++ b/tests/functions/logistic_loss.cpp @@ -1,8 +1,10 @@ -// logistic-loss.cpp: logictic loss function and its tempered and bi-tempered variants +// logistic_loss.cpp: logistic loss function and its tempered and bi-tempered variants // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. // // This file is part of the UNIVERSAL project, which is released under an MIT Open Source license. +#include + #define ALIASING_ALLOWED #include #include @@ -16,22 +18,56 @@ try { using Posit = posit; // print detailed bit-level computational intermediate results - //bool verbose = false; // preserve the existing ostream precision auto precision = std::cout.precision(); std::cout << std::setprecision(12); - Posit tmps[] = { Posit(0.0), Posit(0.2), Posit(0.4), Posit(0.6), Posit(0.8), --Posit(1.0) }; + Posit one_minus_1ulp(1.0f); + --one_minus_1ulp; + Posit one_plus_1ulp(1.0f); + ++one_plus_1ulp; + + { + + // has to be in double as floats do not have the precision to capture 1 - ULP of 32bit posit + double tmps[] = { 0.0, 0.2, 0.4, 0.6, 0.8, double(one_minus_1ulp) }; // temperature can't be 1 + + + // logt(x) := (1 / (1 – t)) * (x ^ (1–t) – 1) + // plot tempered logarithm + for (Posit t : tmps) { + Posit upperbound = Posit(4.0); + constexpr unsigned nrSamples = 16; + Posit step = upperbound / nrSamples; + Posit x = 0; + for (unsigned i = 0; i <= nrSamples; ++i) { + std::cout << "x = " << x << " logt(" << t << "," << x << ") = " << logt(t, x) << '\n'; + x += step; + } + } + } + + // expt(x) : = [1 + (1 – t) x]+ ^ (1 / (1–t)) + // plot tempered exponent + { + + // has to be in double as floats do not have the precision to capture 1 - ULP of 32bit posit + double tmps[] = { double(one_plus_1ulp), 1.5, 2.0, 2.5, 3.0, 3.5 }; // temperature can't be 1 + - for (Posit t : tmps) { - Posit ub = Posit(4.0); - constexpr unsigned nrSamples = 16; - Posit step = ub / nrSamples; - Posit x = Posit(0); // minpos(); - for (unsigned i = 0; i <= nrSamples; ++i) { - std::cout << "x = " << x << " logt(" << t << "," << x << ") = " << logt(t, x) << '\n'; - x += step; + // expt(x) : = [1 + (1 – t) x]+ ^ (1 / (1–t)) + // plot tempered exponent + for (Posit t : tmps) { + Posit lowerbound = Posit(-4.0); + Posit upperbound = Posit(0.5); + constexpr unsigned nrSamples = 16; + Posit step = (upperbound - lowerbound)/ nrSamples; + Posit x = lowerbound; + for (unsigned i = 0; i <= nrSamples; ++i) { + std::cout << "x = " << x << " expt(" << t << "," << x << ") = " << expt(t, x) << '\n'; + x += step; + } } } diff --git a/tests/lns/CMakeLists.txt b/tests/lns/CMakeLists.txt index 8a9a78530..ffc249f2a 100644 --- a/tests/lns/CMakeLists.txt +++ b/tests/lns/CMakeLists.txt @@ -2,10 +2,12 @@ file (GLOB API_SRCS "./api/*.cpp") file (GLOB CONVERSION_SRCS "./conversion/*.cpp") file (GLOB ARITHMETIC_SRCS "./arithmetic/*.cpp") file (GLOB LOGIC_SRCS "./logic/*.cpp") +file (GLOB MATHLIB_SRCS "./math/*.cpp") file (GLOB PERFORMANCE_SRCS "./performance/*.cpp") compile_all("true" "lns" "Number Systems/fixed size/logarithmic/lns/api" "${API_SRCS}") compile_all("true" "lns" "Number Systems/fixed size/logarithmic/lns/conversion" "${CONVERSION_SRCS}") compile_all("true" "lns" "Number Systems/fixed size/logarithmic/lns/arithmetic" "${ARITHMETIC_SRCS}") compile_all("true" "lns" "Number Systems/fixed size/logarithmic/lns/logic" "${LOGIC_SRCS}") +compile_all("true" "lns" "Number Systems/fixed size/logarithmic/lns/mathlib" "${MATHLIB_SRCS}") compile_all("true" "lns" "Number Systems/fixed size/logarithmic/lns/performance" "${PERFORMANCE_SRCS}") diff --git a/tests/lns/api/api.cpp b/tests/lns/api/api.cpp index 7c374c48e..039f3dec5 100644 --- a/tests/lns/api/api.cpp +++ b/tests/lns/api/api.cpp @@ -10,7 +10,7 @@ #include // Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override -#define MANUAL_TESTING 1 +#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 @@ -40,7 +40,7 @@ try { ReportTrivialityOfType>(); // default behavior - std::cout << "+--------- default lns bahavior\n"; + std::cout << "+--------- default lns bahavior --------+\n"; { using Real = lns<8, 3>; Real a(1.0f), b(1.0f), c; @@ -48,17 +48,17 @@ try { a = 1; // integer assignment b = 1; c = a + b; - ReportBinaryOperation(a, "*", b, c); + ReportBinaryOperation(a, "+", b, c); } // configuration - std::cout << "+--------- explicit alignment bahavior\n"; + std::cout << "+--------- arithmetic operators with explicit alignment bahavior --------+\n"; { - using Real = lns<16, 5, std::uint16_t>; + using Real = lns<16, 5, Saturating, std::uint16_t>; ArithmeticOperators(1.0f, 1.0f); } { - using Real = lns<24, 5, std::uint32_t>; + using Real = lns<24, 5, Saturating, std::uint32_t>; ArithmeticOperators(1.0f, 1.0f); } @@ -74,8 +74,8 @@ try { std::cout << "+--------- constexpr and specific values --------+\n"; { constexpr size_t nbits = 10; - constexpr size_t es = 3; - using Real = lns; // bt = uint8_t + constexpr size_t rbits = 3; + using Real = lns; // behavior = Saturating, BlockType = uint8_t CONSTEXPRESSION Real a{}; // zero constexpr std::cout << type_tag(a) << '\n'; @@ -94,8 +94,8 @@ try { std::cout << "+--------- extreme values --------+\n"; { constexpr size_t nbits = 10; - constexpr size_t es = 3; - using Real = lns; // bt = uint8_t + constexpr size_t rbits = 3; + using Real = lns; // behavior = Saturating, BlockType = uint8_t Real a, b, c; @@ -107,9 +107,21 @@ try { ReportBinaryOperation(a, "/", b, c); } - std::cout << "+--------- comparison to classic floats\n"; + std::cout << "+--------- Dynamic ranges of 8-bit lns<> configurations --------+\n"; { - using LNS = lns<16, 8, std::uint16_t>; + std::cout << dynamic_range(lns<8, 0>()) << '\n'; + std::cout << dynamic_range(lns<8, 1>()) << '\n'; + std::cout << dynamic_range(lns<8, 2>()) << '\n'; + std::cout << dynamic_range(lns<8, 3>()) << '\n'; + std::cout << dynamic_range(lns<8, 4>()) << '\n'; + std::cout << dynamic_range(lns<8, 5>()) << '\n'; + std::cout << dynamic_range(lns<8, 6>()) << '\n'; + std::cout << dynamic_range(lns<8, 7>()) << '\n'; + } + + std::cout << "+--------- comparison to classic floats --------+\n"; + { + using LNS = lns<16, 8, Saturating, std::uint16_t>; using Real = cfloat<16, 5, std::uint16_t>; LNS a; Real b; diff --git a/tests/lns/arithmetic/addition.cpp b/tests/lns/arithmetic/addition.cpp index b1d61155c..0c89db6ac 100644 --- a/tests/lns/arithmetic/addition.cpp +++ b/tests/lns/arithmetic/addition.cpp @@ -6,8 +6,11 @@ // minimum set of include files to reflect source code dependencies #include -#include - +//#include // there is a generic VerifyAddition there: we need a trait to break template match +// in the mean time: explicity bring in the dependencies to get the test running +#include +#include +#include namespace sw { namespace universal { @@ -15,8 +18,11 @@ namespace sw { namespace universal { // std::enable_if_t, LnsType> = 0 //> template - int ValidateAddition(bool reportTestCases) { + int VerifyAddition(bool reportTestCases) { constexpr size_t nbits = LnsType::nbits; + constexpr size_t rbits = LnsType::rbits; + constexpr ArithmeticBehavior behavior = LnsType::behavior; + using bt = typename LnsType::BlockType; constexpr size_t NR_ENCODINGS = (1ull << nbits); int nrOfFailedTestCases = 0; @@ -30,6 +36,9 @@ namespace sw { namespace universal { double db = double(b); double ref = da + db; + if (reportTestCases && !isInRange(ref)) { + std::cerr << da << " * " << db << " = " << ref << " which is not in range " << range() << '\n'; + } c = a + b; cref = ref; //std::cout << "ref : " << to_binary(ref) << " : " << ref << '\n'; @@ -43,7 +52,7 @@ namespace sw { namespace universal { else { if (reportTestCases) ReportBinaryArithmeticSuccess("PASS", "+", a, b, c, ref); } - if (nrOfFailedTestCases > 0) return 25; + if (nrOfFailedTestCases > 24) return nrOfFailedTestCases; } } return nrOfFailedTestCases; @@ -81,40 +90,43 @@ try { #if MANUAL_TESTING - using LNS4_1 = lns<4, 1, std::uint8_t>; - using LNS4_2 = lns<4, 2, std::uint8_t>; - using LNS5_2 = lns<5, 2, std::uint8_t>; - using LNS8_3 = lns<8, 3, std::uint8_t>; - using LNS9_4 = lns<9, 4, std::uint8_t>; - using LNS16_5 = lns<16, 5, std::uint16_t>; + using LNS4_1_sat = lns<4, 1, Saturating, std::uint8_t>; + using LNS4_2_sat = lns<4, 2, Saturating, std::uint8_t>; + using LNS5_2_sat = lns<5, 2, Saturating, std::uint8_t>; + using LNS8_3_sat = lns<8, 3, Saturating, std::uint8_t>; + using LNS9_4_sat = lns<9, 4, Saturating, std::uint8_t>; + using LNS16_5_sat = lns<16, 5, Saturating, std::uint16_t>; // generate individual testcases to hand trace/debug - TestCase< LNS16_5, double>(TestCaseOperator::ADD, INFINITY, INFINITY); - TestCase< LNS8_3, float>(TestCaseOperator::ADD, 0.5f, -0.5f); + TestCase< LNS16_5_sat, double>(TestCaseOperator::ADD, INFINITY, INFINITY); + TestCase< LNS8_3_sat, float>(TestCaseOperator::ADD, 0.5f, -0.5f); // manual exhaustive test - nrOfFailedTestCases += ReportTestResult(ValidateAddition(reportTestCases), "lns<4,2,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition(reportTestCases), "lns<4,2,Saturating,uint8_t>", test_tag); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else - using LNS4_1 = lns<4, 1, std::uint8_t>; - using LNS4_2 = lns<4, 2, std::uint8_t>; - using LNS5_2 = lns<5, 2, std::uint8_t>; - using LNS8_3 = lns<8, 3, std::uint8_t>; - using LNS9_4 = lns<9, 4, std::uint8_t>; - using LNS10_4 = lns<10, 4, std::uint8_t>; #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(ValidateAddition(reportTestCases), "lns<4,1,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(ValidateAddition(reportTestCases), "lns<4,2,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(ValidateAddition(reportTestCases), "lns<5,2,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(ValidateAddition(reportTestCases), "lns<8,3,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(ValidateAddition(reportTestCases), "lns<9,4,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(ValidateAddition(reportTestCases), "lns<10,4,uint8_t>", test_tag); + using LNS4_1_sat = lns<4, 1, Saturating, std::uint8_t>; + using LNS4_2_sat = lns<4, 2, Saturating, std::uint8_t>; + using LNS5_2_sat = lns<5, 2, Saturating, std::uint8_t>; + using LNS8_3_sat = lns<8, 3, Saturating, std::uint8_t>; + + nrOfFailedTestCases += ReportTestResult(VerifyAddition(reportTestCases), "lns<4,1,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition(reportTestCases), "lns<4,2,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition(reportTestCases), "lns<5,2,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition(reportTestCases), "lns<8,3,Saturating,uint8_t>", test_tag); + #endif #if REGRESSION_LEVEL_2 + using LNS9_4_sat = lns<9, 4, Saturating, std::uint8_t>; + using LNS10_4_sat = lns<10, 4, Saturating, std::uint8_t>; + + nrOfFailedTestCases += ReportTestResult(VerifyAddition(reportTestCases), "lns<9,4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyAddition(reportTestCases), "lns<10,4,Saturating,uint8_t>", test_tag); #endif #if REGRESSION_LEVEL_3 diff --git a/tests/lns/arithmetic/division.cpp b/tests/lns/arithmetic/division.cpp index d7ed5a5dd..37cad1b63 100644 --- a/tests/lns/arithmetic/division.cpp +++ b/tests/lns/arithmetic/division.cpp @@ -18,12 +18,16 @@ namespace sw { namespace universal { template int VerifyDivision(bool reportTestCases) { constexpr size_t nbits = LnsType::nbits; + constexpr size_t rbits = LnsType::rbits; + constexpr ArithmeticBehavior behavior = LnsType::behavior; + using bt = typename LnsType::BlockType; constexpr size_t NR_ENCODINGS = (1ull << nbits); int nrOfFailedTestCases = 0; bool firstTime = true; LnsType a, b, c, cref; - a.debugConstexprParameters(); + double ref; + if (reportTestCases) a.debugConstexprParameters(); for (size_t i = 0; i < NR_ENCODINGS; ++i) { a.setbits(i); double da = double(a); @@ -33,8 +37,7 @@ namespace sw { namespace universal { #if LNS_THROW_ARITHMETIC_EXCEPTION try { c = a / b; - double ref = da / db; - cref = ref; + ref = da / db; } catch (const lns_divide_by_zero& err) { if (b.iszero()) { @@ -52,9 +55,12 @@ namespace sw { namespace universal { } #else c = a / b; - double ref = da / db; - cref = ref; + ref = da / db; #endif + if (reportTestCases && !isInRange(ref)) { + std::cerr << da << " * " << db << " = " << ref << " which is not in range " << range() << '\n'; + } + cref = ref; // std::cout << "ref : " << to_binary(ref) << " : " << ref << '\n'; // std::cout << "cref : " << std::setw(68) << to_binary(cref) << " : " << cref << '\n'; if (c != cref) { @@ -150,20 +156,20 @@ try { std::string test_suite = "lns division validation"; std::string test_tag = "division"; - bool reportTestCases = true; + bool reportTestCases = false; int nrOfFailedTestCases = 0; ReportTestSuiteResults(test_suite, nrOfFailedTestCases); #if MANUAL_TESTING - using LNS4_1 = lns<4, 1, std::uint8_t>; - using LNS4_2 = lns<4, 2, std::uint8_t>; - using LNS5_2 = lns<5, 2, std::uint8_t>; - using LNS8_3 = lns<8, 3, std::uint8_t>; - using LNS8_4 = lns<8, 4, std::uint8_t>; - using LNS9_4 = lns<9, 4, std::uint8_t>; - using LNS16_5 = lns<16, 5, std::uint16_t>; + using LNS4_1_sat = lns<4, 1, Saturating, std::uint8_t>; + using LNS4_2_sat = lns<4, 2, Saturating, std::uint8_t>; + using LNS5_2_sat = lns<5, 2, Saturating, std::uint8_t>; + using LNS8_3_sat = lns<8, 3, Saturating, std::uint8_t>; + using LNS8_4_sat = lns<8, 4, Saturating, std::uint8_t>; + using LNS9_4_sat = lns<9, 4, Saturating, std::uint8_t>; + using LNS16_5_sat = lns<16, 5, Saturating, std::uint16_t>; // : FAIL 1 / 267.33408830141792123 != 0.0037406378152288035158 golden reference is 62757.488603861726006 // : result 0b0.1111.1111 @@ -171,60 +177,60 @@ try { // 0b0.0000.0000 / 0b0.0000.0001 // 0b0.0000.0000 / 0b1.1111.1111 { - LNS9_4 a, b, c; + LNS9_4_sat a, b, c; a.setbits(0); b.setbits(0x1); c = a / b; - std::cout << to_binary(a) << " / " << to_binary(b) << " = " << to_binary(c) << '\n'; - std::cout << (a) << " / " << (b) << " = " << (c) << '\n'; - c.setbits(0x010); - std::cout << to_binary(c) << " : " << c << '\n'; - c.setbits(0x0F0); - std::cout << to_binary(c) << " : " << c << '\n'; + ReportBinaryOperation(a, "/", b, c); } { - LNS8_4 a, b, c; + LNS8_4_sat a, b, c; a.setbits(0); b.setbits(0x1); c = a / b; - std::cout << to_binary(a) << " / " << to_binary(b) << " = " << to_binary(c) << '\n'; - std::cout << (a) << " / " << (b) << " = " << (c) << '\n'; + ReportBinaryOperation(a, "/", b, c); + a = b * c; + ReportBinaryOperation(b, "*", c, a); + b = a / c; + ReportBinaryOperation(a, "/", c, b); } - return 0; + // generate individual testcases to hand trace/debug - TestCase(TestCaseOperator::MUL, INFINITY, INFINITY); - TestCase(TestCaseOperator::MUL, 0.5f, -0.5f); + TestCase(TestCaseOperator::DIV, INFINITY, INFINITY); + TestCase(TestCaseOperator::DIV, 0.5f, -0.5f); // GenerateLnsTable<5, 2>(std::cout); - nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns<4,1,uint8_t>>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns<4,2,uint8_t>>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns<5,2,uint8_t>>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns<8,3,uint8_t>>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns<9,4,uint8_t>>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns<4,1,Saturating,uint8_t>>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns<4,2,Saturating,uint8_t>>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns<5,2,Saturating,uint8_t>>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns<8,3,Saturating,uint8_t>>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns<9,4,Saturating,uint8_t>>", test_tag); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else - using LNS4_1 = lns<4, 1, std::uint8_t>; - using LNS4_2 = lns<4, 2, std::uint8_t>; - using LNS5_2 = lns<5, 2, std::uint8_t>; - using LNS8_3 = lns<8, 3, std::uint8_t>; - using LNS9_4 = lns<9, 4, std::uint8_t>; - using LNS9_4_uint16 = lns<9, 4, std::uint16_t>; - using LNS10_4 = lns<10, 4, std::uint8_t>; #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns< 4,1,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns< 4,2,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns< 5,2,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns< 8,3,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns< 9,4,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns< 9,4,uint16_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns<10,4,uint8_t>", test_tag); + using LNS4_1_sat = lns<4, 1, Saturating, std::uint8_t>; +// using LNS4_2_sat = lns<4, 2, Saturating, std::uint8_t>; + using LNS5_2_sat = lns<5, 2, Saturating, std::uint8_t>; + using LNS8_3_sat = lns<8, 3, Saturating, std::uint8_t>; + + nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns< 4,1,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns< 5,2,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns< 8,3,Saturating,uint8_t>", test_tag); #endif #if REGRESSION_LEVEL_2 + using LNS9_4_sat = lns<9, 4, Saturating, std::uint8_t>; + using LNS9_4_sat_uint16 = lns<9, 4, Saturating, std::uint16_t>; + using LNS10_4_sat = lns<10, 4, Saturating, std::uint8_t>; + + nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns< 9,4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns< 9,4,Saturating,uint16_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyDivision(reportTestCases), "lns<10,4,Saturating,uint8_t>", test_tag); + #endif #if REGRESSION_LEVEL_3 diff --git a/tests/lns/arithmetic/multiplication.cpp b/tests/lns/arithmetic/multiplication.cpp index 14b6a24c3..7f9412fe4 100644 --- a/tests/lns/arithmetic/multiplication.cpp +++ b/tests/lns/arithmetic/multiplication.cpp @@ -16,8 +16,11 @@ namespace sw { namespace universal { // std::enable_if_t, LnsType> = 0 //> template - int VerifyMutliplication(bool reportTestCases) { + int VerifyMultiplication(bool reportTestCases) { constexpr size_t nbits = LnsType::nbits; + constexpr size_t rbits = LnsType::rbits; + constexpr ArithmeticBehavior behavior = LnsType::behavior; + using bt = typename LnsType::BlockType; constexpr size_t NR_ENCODINGS = (1ull << nbits); int nrOfFailedTestCases = 0; @@ -31,6 +34,9 @@ namespace sw { namespace universal { double db = double(b); double ref = da * db; + if (reportTestCases && !isInRange(ref)) { + std::cerr << da << " * " << db << " = " << ref << " which is not in range " << range() << '\n'; + } c = a * b; cref = ref; // std::cout << "ref : " << to_binary(ref) << " : " << ref << '\n'; @@ -38,13 +44,13 @@ namespace sw { namespace universal { if (c != cref) { ++nrOfFailedTestCases; if (reportTestCases) ReportBinaryArithmeticError("FAIL", "*", a, b, c, cref); - std::cout << "ref : " << to_binary(ref) << " : " << ref << '\n'; - std::cout << "cref : " << std::setw(68) << to_binary(cref) << " : " << cref << '\n'; +// std::cout << "ref : " << to_binary(ref) << " : " << ref << '\n'; +// 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 > 0) return 25; + if (nrOfFailedTestCases > 25) return nrOfFailedTestCases; } } return nrOfFailedTestCases; @@ -53,6 +59,25 @@ namespace sw { namespace universal { } } /* +Generate Value table for an LNS<4,1> in TXT format + # Binary sign scale value format + 0: 0b0.00.0 0 0 1 1 + 1: 0b0.00.1 0 0 1.41421 1.41421 + 2: 0b0.01.0 0 1 2 2 + 3: 0b0.01.1 0 1 2.82843 2.82843 + 4: 0b0.10.0 0 -2 0 0 + 5: 0b0.10.1 0 -2 0.353553 0.353553 + 6: 0b0.11.0 0 -1 0.5 0.5 + 7: 0b0.11.1 0 -1 0.707107 0.707107 + 8: 0b1.00.0 1 0 -1 -1 + 9: 0b1.00.1 1 0 -1.41421 -1.41421 + 10: 0b1.01.0 1 1 -2 -2 + 11: 0b1.01.1 1 1 -2.82843 -2.82843 + 12: 0b1.10.0 1 -2 -nan(ind) -nan(ind) + 13: 0b1.10.1 1 -2 -0.353553 -0.353553 + 14: 0b1.11.0 1 -1 -0.5 -0.5 + 15: 0b1.11.1 1 -1 -0.707107 -0.707107 + Generate Value table for an LNS<4,2> in TXT format # Binary sign scale value format 0: 0b0.0.00 0 0 1 1 @@ -109,7 +134,7 @@ Generate Value table for an LNS<5,2> in TXT format */ // Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override -#define MANUAL_TESTING 1 +#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 @@ -130,60 +155,74 @@ try { std::string test_suite = "lns multiplication validation"; std::string test_tag = "multiplication"; - bool reportTestCases = true; + bool reportTestCases = false; int nrOfFailedTestCases = 0; ReportTestSuiteResults(test_suite, nrOfFailedTestCases); #if MANUAL_TESTING - using LNS4_1 = lns<4, 1, std::uint8_t>; - using LNS4_2 = lns<4, 2, std::uint8_t>; - using LNS5_2 = lns<5, 2, std::uint8_t>; - using LNS8_3 = lns<8, 3, std::uint8_t>; - using LNS9_4 = lns<9, 4, std::uint8_t>; - using LNS16_5 = lns<16, 5, std::uint16_t>; - - { - LNS9_4 a; - a = 279.17; - std::cout << to_binary(a) << " : " << a << '\n'; - } -// nrOfFailedTestCases += ReportTestResult(VerifyMutliplication(reportTestCases), "lns<9,4>", test_tag); + using LNS4_1_mod = lns<4, 1, Modular, std::uint8_t>; + using LNS4_1_sat = lns<4, 1, Saturating, std::uint8_t>; + using LNS4_2 = lns<4, 2, Saturating, std::uint8_t>; + using LNS5_2 = lns<5, 2, Saturating, std::uint8_t>; + using LNS8_3 = lns<8, 3, Saturating, std::uint8_t>; + using LNS9_4 = lns<9, 4, Saturating, std::uint8_t>; + using LNS16_5 = lns<16, 5, Saturating, std::uint16_t>; - return 0; // generate individual testcases to hand trace/debug + TestCase(TestCaseOperator::MUL, 0.353f, -0.353f); TestCase(TestCaseOperator::MUL, INFINITY, INFINITY); TestCase(TestCaseOperator::MUL, 0.5f, -0.5f); // GenerateLnsTable<5, 2>(std::cout); - nrOfFailedTestCases += ReportTestResult(VerifyMutliplication(reportTestCases), "lns<4,1,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMutliplication(reportTestCases), "lns<4,2,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMutliplication(reportTestCases), "lns<5,2,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMutliplication(reportTestCases), "lns<8,3,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMutliplication(reportTestCases), "lns<9,4,uint8_t>", test_tag); +// nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(false), "lns<4,1, Modular,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<4,1, Saturating,uint8_t>", test_tag); +// nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<4,2, Saturating,uint8_t>", test_tag); +// nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<5,2, Saturating,uint8_t>", test_tag); +// nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<8,3, Saturating,uint8_t>", test_tag); +// nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<9,4, Saturating,uint8_t>", test_tag); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else - using LNS4_1 = lns<4, 1, std::uint8_t>; - using LNS4_2 = lns<4, 2, std::uint8_t>; - using LNS5_2 = lns<5, 2, std::uint8_t>; - using LNS8_3 = lns<8, 3, std::uint8_t>; - using LNS9_4 = lns<9, 4, std::uint8_t>; - using LNS10_4 = lns<10, 4, std::uint8_t>; #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyMutliplication(reportTestCases), "lns<4,1,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMutliplication(reportTestCases), "lns<4,2,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMutliplication(reportTestCases), "lns<5,2,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMutliplication(reportTestCases), "lns<8,3,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMutliplication(reportTestCases), "lns<9,4,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyMutliplication(reportTestCases), "lns<10,4,uint8_t>", test_tag); + using LNS4_0_sat = lns<4, 0, Saturating, std::uint8_t>; + using LNS4_1_sat = lns<4, 1, Saturating, std::uint8_t>; + using LNS4_2_sat = lns<4, 2, Saturating, std::uint8_t>; + using LNS4_3_sat = lns<4, 3, Saturating, std::uint8_t>; + using LNS5_2_sat = lns<5, 2, Saturating, std::uint8_t>; + using LNS8_1_sat = lns<8, 1, Saturating, std::uint8_t>; + using LNS8_4_sat = lns<8, 4, Saturating, std::uint8_t>; + using LNS8_7_sat = lns<8, 7, Saturating, std::uint8_t>; + using LNS9_0_sat = lns<9, 0, Saturating, std::uint8_t>; + using LNS9_4_sat = lns<9, 4, Saturating, std::uint8_t>; + using LNS9_8_sat = lns<9, 8, Saturating, std::uint8_t>; + + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<4,0, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<4,1, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<4,2, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<4,3, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<5,2, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<8,1, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<8,4, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<8,7, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<9,0, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<9,4, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<9,8, Saturating,uint8_t>", test_tag); + #endif #if REGRESSION_LEVEL_2 + using LNS10_0_sat = lns<10, 0, Saturating, std::uint8_t>; + using LNS10_4_sat = lns<10, 4, Saturating, std::uint8_t>; + using LNS10_9_sat = lns<10, 9, Saturating, std::uint8_t>; + + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<10,0, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<10,4, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication(reportTestCases), "lns<10,9, Saturating,uint8_t>", test_tag); #endif #if REGRESSION_LEVEL_3 diff --git a/tests/lns/arithmetic/subtraction.cpp b/tests/lns/arithmetic/subtraction.cpp index 8c26a5db9..c3d9e72f2 100644 --- a/tests/lns/arithmetic/subtraction.cpp +++ b/tests/lns/arithmetic/subtraction.cpp @@ -6,7 +6,11 @@ // minimum set of include files to reflect source code dependencies #include -#include +//#include // there is a generic VerifySubtraction there: we need a trait to break template match +// in the mean time: explicity bring in the dependencies to get the test running +#include +#include +#include namespace sw { namespace universal { @@ -14,8 +18,11 @@ namespace sw { namespace universal { // std::enable_if_t, LnsType> = 0 //> template - int ValidateSubtraction(bool reportTestCases) { + int VerifySubtraction(bool reportTestCases) { constexpr size_t nbits = LnsType::nbits; + constexpr size_t rbits = LnsType::rbits; + constexpr ArithmeticBehavior behavior = LnsType::behavior; + using bt = typename LnsType::BlockType; constexpr size_t NR_ENCODINGS = (1ull << nbits); int nrOfFailedTestCases = 0; @@ -29,6 +36,9 @@ namespace sw { namespace universal { double db = double(b); double ref = da - db; + if (reportTestCases && !isInRange(ref)) { + std::cerr << da << " * " << db << " = " << ref << " which is not in range " << range() << '\n'; + } c = a - b; cref = ref; //std::cout << "ref : " << to_binary(ref) << " : " << ref << '\n'; @@ -80,41 +90,44 @@ try { #if MANUAL_TESTING - using LNS4_1 = lns<4, 1, std::uint8_t>; - using LNS4_2 = lns<4, 2, std::uint8_t>; - using LNS5_2 = lns<5, 2, std::uint8_t>; - using LNS8_3 = lns<8, 3, std::uint8_t>; - using LNS9_4 = lns<9, 4, std::uint8_t>; - using LNS16_5 = lns<16, 5, std::uint16_t>; + using LNS4_1_sat = lns<4, 1, Saturating, std::uint8_t>; + using LNS4_2_sat = lns<4, 2, Saturating, std::uint8_t>; + using LNS5_2_sat = lns<5, 2, Saturating, std::uint8_t>; + using LNS8_3_sat = lns<8, 3, Saturating, std::uint8_t>; + using LNS9_4_sat = lns<9, 4, Saturating, std::uint8_t>; + using LNS16_5_sat = lns<16, 5, Saturating, std::uint16_t>; // generate individual testcases to hand trace/debug - TestCase< LNS16_5, double>(TestCaseOperator::ADD, INFINITY, INFINITY); - TestCase< LNS8_3, float>(TestCaseOperator::ADD, 0.5f, -0.5f); + TestCase< LNS16_5_sat, double>(TestCaseOperator::SUB, INFINITY, INFINITY); + TestCase< LNS8_3_sat, float>(TestCaseOperator::SUB, 0.5f, -0.5f); // manual exhaustive test - nrOfFailedTestCases += ReportTestResult(ValidateSubtraction(reportTestCases), "lns<8,2,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction(reportTestCases), "lns<8,2,Saturating,uint8_t>", test_tag); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; #else - using LNS4_1 = lns<4, 1, std::uint8_t>; - using LNS4_2 = lns<4, 2, std::uint8_t>; - using LNS5_2 = lns<5, 2, std::uint8_t>; - using LNS8_3 = lns<8, 3, std::uint8_t>; - using LNS9_4 = lns<9, 4, std::uint8_t>; - using LNS10_4 = lns<10, 4, std::uint8_t>; #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(ValidateSubtraction(reportTestCases), "lns<4,1,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(ValidateSubtraction(reportTestCases), "lns<4,2,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(ValidateSubtraction(reportTestCases), "lns<5,2,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(ValidateSubtraction(reportTestCases), "lns<8,3,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(ValidateSubtraction(reportTestCases), "lns<9,4,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(ValidateSubtraction(reportTestCases), "lns<10,4,uint8_t>", test_tag); + using LNS4_1_sat = lns<4, 1, Saturating, std::uint8_t>; + using LNS4_2_sat = lns<4, 2, Saturating, std::uint8_t>; + using LNS5_2_sat = lns<5, 2, Saturating, std::uint8_t>; + using LNS8_3_sat = lns<8, 3, Saturating, std::uint8_t>; + + nrOfFailedTestCases += ReportTestResult(VerifySubtraction(reportTestCases), "lns<4,1, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction(reportTestCases), "lns<4,2, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction(reportTestCases), "lns<5,2, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction(reportTestCases), "lns<8,3, Saturating,uint8_t>", test_tag); #endif #if REGRESSION_LEVEL_2 + using LNS9_4_sat = lns<9, 4, Saturating, std::uint8_t>; + using LNS10_4_sat = lns<10, 4, Saturating, std::uint8_t>; + + nrOfFailedTestCases += ReportTestResult(VerifySubtraction(reportTestCases), "lns<9,4, Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifySubtraction(reportTestCases), "lns<10,4, Saturating,uint8_t>", test_tag); + #endif #if REGRESSION_LEVEL_3 diff --git a/tests/lns/conversion/assignment.cpp b/tests/lns/conversion/assignment.cpp index d214c46ed..3983c32dc 100644 --- a/tests/lns/conversion/assignment.cpp +++ b/tests/lns/conversion/assignment.cpp @@ -34,6 +34,8 @@ int ValidateAssignment(bool reportTestCases) { } } + // test clipping or saturation + return nrOfFailedTestCases; } @@ -52,8 +54,22 @@ void GenerateBitWeightTable() { } } +template +void SampleTest(Real v) { + using namespace sw::universal; + std::cout << to_binary(lns<8, 0>(v)) << " : " << lns<8, 0>(v) << '\n'; + std::cout << to_binary(lns<8, 1>(v)) << " : " << lns<8, 1>(v) << '\n'; + std::cout << to_binary(lns<8, 2>(v)) << " : " << lns<8, 2>(v) << '\n'; + std::cout << to_binary(lns<8, 3>(v)) << " : " << lns<8, 3>(v) << '\n'; + std::cout << to_binary(lns<8, 4>(v)) << " : " << lns<8, 4>(v) << '\n'; + std::cout << to_binary(lns<8, 5>(v)) << " : " << lns<8, 5>(v) << '\n'; + std::cout << to_binary(lns<8, 6>(v)) << " : " << lns<8, 6>(v) << '\n'; + std::cout << to_binary(lns<8, 7>(v)) << " : " << lns<8, 7>(v) << '\n'; + // std::cout << to_binary(lns<8, 8>(v)) << " : " << lns<8, 8>(v) << '\n'; +} + // Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override -#define MANUAL_TESTING 0 +#define MANUAL_TESTING 1 // 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 @@ -81,22 +97,16 @@ try { #if MANUAL_TESTING - using LNS16_5 = lns<16, 5, std::uint16_t>; - using LNS11_5 = lns<11, 5, std::uint8_t>; - using LNS8_2 = lns<8, 2, std::uint8_t>; - using LNS5_2 = lns<5, 2, std::uint8_t>; - using LNS4_1 = lns<4, 1, std::uint8_t>; + using LNS16_5 = lns<16, 5, Saturating, std::uint16_t>; + using LNS11_5 = lns<11, 5, Saturating, std::uint8_t>; + using LNS8_2 = lns<8, 2, Saturating, std::uint8_t>; + using LNS5_2 = lns<5, 2, Saturating, std::uint8_t>; + using LNS4_1 = lns<4, 1, Saturating, std::uint8_t>; // GenerateBitWeightTable(); + SampleTest(1024.0f); + return 0; - // generate individual testcases to hand trace/debug - { - LNS5_2 a, b; - a.setnan(); - float fa = float(a); - b = fa; - std::cout << fa << " vs " << b << '\n'; - } // manual exhaustive test // nrOfFailedTestCases += ReportTestResult(ValidateAssignment(reportTestCases), type_tag(LNS4_1()), test_tag); diff --git a/tests/lns/conversion/conversion.cpp b/tests/lns/conversion/conversion.cpp new file mode 100644 index 000000000..c42c5c587 --- /dev/null +++ b/tests/lns/conversion/conversion.cpp @@ -0,0 +1,459 @@ +// conversion.cpp : test suite runner for conversion operators to logarithmic floating-point +// +// 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 + +namespace sw { namespace universal { + + template + void ReportConversionError(const std::string& test_case, const std::string& op, double input, const TestType& result, RefType ref, const std::string& rounding) { + constexpr size_t nbits = TestType::nbits; // number system concept requires a static member indicating its size in bits + auto old_precision = std::cerr.precision(); + std::cerr << std::setprecision(10); + std::cerr << test_case + << " " << op << " " + << std::setw(NUMBER_COLUMN_WIDTH) << input + << " did not convert to " + << std::setw(NUMBER_COLUMN_WIDTH) << ref << " instead it yielded " + << std::setw(NUMBER_COLUMN_WIDTH) << double(result) + << " encoding " << std::setw(nbits) << to_binary(result) << " converted from " << to_binary(ref) << " " << rounding; + std::cerr << '\n'; + std::cerr << std::setprecision(old_precision); + } + + template + void ReportConversionSuccess(const std::string& test_case, const std::string& op, double input, const TestType& result, RefType ref, const std::string& rounding) { + constexpr size_t nbits = TestType::nbits; // number system concept requires a static member indicating its size in bits + auto old_precision = std::cerr.precision(); + std::cerr << std::setprecision(10); + std::cerr << test_case + << " " << op << " " + << std::setw(NUMBER_COLUMN_WIDTH) << input + << " success " + << std::setw(NUMBER_COLUMN_WIDTH) << result << " golden reference is " + << std::setw(NUMBER_COLUMN_WIDTH) << ref + << " encoding " << std::setw(nbits) << to_binary(result) << " converted from " << to_binary(ref) << " " << rounding; + std::cerr << '\n'; + std::cerr << std::setprecision(old_precision); + } + + template + int Compare(double input, const TestType& result, const RefType& ref, const std::string& rounding, bool reportTestCases) { + int fail = 0; + double dresult = double(result); + double dref = double(ref); + if (std::fabs(dresult - dref) > 0.000000001) { + fail++; + if (reportTestCases) ReportConversionError("FAIL", "=", input, result, ref, rounding); + } + else { + //if (reportTestCases) ReportConversionSuccess("PASS", "=", input, result, ref, rounding); + } + return fail; + } + + // enumerate all conversion cases for a posit configuration + template + int VerifyConversion(bool reportTestCases) { + // we are going to generate a test set that consists of all lns configs and their midpoints + // we do this by enumerating an lns that is 1-bit larger than the test configuration + // These larger posits will be at the mid-point between the smaller sample values + // and we'll enumerate the exact value, and a perturbation smaller and a perturbation larger + // to test the rounding logic of the conversion. + using TestType = lns; + using ContainingType = lns; + + constexpr size_t max = nbits > 16 ? 16 : nbits; + size_t NR_TEST_CASES = (size_t(1) << (max + 1)); + size_t QUARTER = (size_t(1) << (max - 1)); + size_t HALF = (size_t(1) << max); + + if constexpr (nbits > 16) { + std::cout << "VerifyConversion: " << type_tag(TestType()) << " : NR_TEST_CASES = " << NR_TEST_CASES << " constrained due to nbits > 16" << std::endl; + } + +// ContainingType halfMinpos(SpecificValue::minpos); // in the more precise type +// double dhalfMinpos = double(halfMinpos); +// std::cerr << "half minpos : " << halfMinpos << " : " << to_binary(halfMinpos) << '\n'; + + // execute the test + int nrOfFailedTests = 0; + for (size_t i = 0; i < NR_TEST_CASES; i++) { + ContainingType ref, prev, next; + // std::cerr << "i : " << i << '\n'; + ref.setbits(i); + double da = double(ref); + double eps = da * 1.0e-6; // (da > 0 ? da * 1.0e-6 : da * -1.0e-6); + double input; + TestType a; + if (i % 2) { + if (i == QUARTER - 1) { + if (reportTestCases) std::cerr << " odd-1: special case of project to maxpos\n"; + input = da - eps; + a = input; + prev.setbits(i - 1); + nrOfFailedTests += Compare(input, a, prev, "round down to maxpos", reportTestCases); + input = da + eps; + a = input; + nrOfFailedTests += Compare(input, a, prev, "project down to maxpos", reportTestCases); + } + else if (i == HALF - 1) { + if (reportTestCases) std::cerr << " odd-2: special case of project to 1.0\n"; + input = da - eps; + a = input; + prev.setbits(i - 1); + nrOfFailedTests += Compare(input, a, prev, "round down to 1.0", reportTestCases); + input = da + eps; + a = input; + next.setbits(0); // encoding of 1.0 + nrOfFailedTests += Compare(input, a, next, "round up to 1.0", reportTestCases); + } + else if (i == NR_TEST_CASES - 1) { + if (reportTestCases) std::cerr << " odd-3: special case of project to -1.0\n"; + input = da - eps; + a = input; + prev.setbits(i - 1); + nrOfFailedTests += Compare(input, a, prev, "round down to -1.0", reportTestCases); + input = da + eps; + a = input; + next.setbits(0); + next.setsign(); // encoding of -1.0 + nrOfFailedTests += Compare(input, a, next, "round up to -1.0", reportTestCases); + } + else { + // for odd values, we are between lns values, so we create the round-up and round-down cases + // std::cerr << " odd-4: between value case\n"; + // round-down + input = da - eps; + a = input; + prev.setbits(i - 1); + //next.setbits(i + 1); + //std::cout << "da : " << da << '\n'; + //std::cout << "eps : " << eps << '\n'; + //std::cout << "input : " << input << '\n'; + //std::cout << "previous : " << to_binary(prev) << " : " << prev << '\n'; + //std::cout << "midpoint : " << to_binary(ref) << " : " << ref << '\n'; + //std::cout << "next : " << to_binary(next) << " : " << next << '\n'; + //std::cout << "sample : " << to_binary(a) << " : " << a << '\n'; + //std::cout << input << " : " << float(ref) << " : " << float(next) << '\n'; + nrOfFailedTests += Compare(input, a, prev, "round down", reportTestCases); + // round-up + input = da + eps; + a = input; + next.setbits(i + 1); + nrOfFailedTests += Compare(input, a, next, "round up", reportTestCases); + } + } + else { + // for the even values, we generate the round-to-actual cases + if (i == QUARTER) { + if (reportTestCases) std::cerr << "even-1: special case of rounding to 0\n"; + input = eps; + a = input; + nrOfFailedTests += Compare(input, a, ref, "round down", reportTestCases); + input = 0.0; + a = input; + nrOfFailedTests += Compare(input, a, ref, " == ", reportTestCases); + input = -eps; + a = input; + nrOfFailedTests += Compare(input, a, ref, "round up", reportTestCases); + } + else { + // std::cerr << "even-2: same value case\n"; + // round-up + input = da - eps; + a = input; + nrOfFailedTests += Compare(input, a, ref, "round up", reportTestCases); + a = da; + nrOfFailedTests += Compare(input, a, ref, " == ", reportTestCases); + // round-down + input = da + eps; + a = input; + nrOfFailedTests += Compare(input, a, ref, "round down", reportTestCases); + } + } + } + return nrOfFailedTests; + } + + // enumerate all conversion cases for integers + template + int VerifyIntegerConversion(bool reportTestCases) { + using TestType = lns; + + // we generate numbers from 1 via maxpos to -1 and through the special case of 0 back to 1 + constexpr unsigned max = nbits > 20 ? 20 : nbits; + size_t NR_TEST_CASES = (size_t(1) << (max - 1)) + 1; + int nrOfFailedTestCases = 0; + // special cases in case we are clipped by the nbits > 20 + long ref = 0x80000000; // -2147483648 + TestType result(ref); + if (ref != result) { + std::cout << " FAIL long(" << ref << ") != long(" << result << ") : reference = -2147483648" << std::endl; + nrOfFailedTestCases++; + } + TestType v(1); + for (size_t i = 0; i < NR_TEST_CASES; ++i) { + if (!v.isnan()) { + ref = (long)v; // obtain the integer cast of this lns + result = ref; // assign this integer to a lns + if (ref != result) { // compare the integer cast to the reference lns + if (reportTestCases) std::cout << " FAIL long(" << v << ") != long(" << result << ") : reference = " << ref << std::endl; + nrOfFailedTestCases++; + } + else { + //if (reportTestCases) std::cout << " PASS " << v << " casts to " << result << " : reference = " << ref << std::endl; + } + } + ++v; + } + return nrOfFailedTestCases; + } + +} } // namespace sw::universal + +template +void GenerateTestCase(double input, double reference, const TestType& result) { + if (std::fabs(double(result) - reference) > 0.000000001) + ReportConversionError("FAIL", "=", input, result, reference, std::string("faithful x = x")); + else + ReportConversionSuccess("PASS", "=", input, result, reference, std::string("faithful x = x")); + std::cout << std::endl; +} + +// 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; + + std::string test_suite = "lns<> conversion validation"; + std::string test_tag = "conversion"; + bool reportTestCases = false; + int nrOfFailedTestCases = 0; + + ReportTestSuiteHeader(test_suite, reportTestCases); + +#if MANUAL_TESTING + + { + using LNS5_2 = lns<5, 2, Saturating, std::uint8_t>; + LNS5_2 minpos(SpecificValue::minpos); + double mp = double(minpos); + LNS5_2 result = mp; + GenerateTestCase(mp, mp, result); + double halfMinpos = mp / 2.0; + result = halfMinpos; + GenerateTestCase(halfMinpos, 0.0, result); + double quarterMinpos = halfMinpos / 2.0; + result = quarterMinpos; + GenerateTestCase(quarterMinpos, 0.0, result); + double threeQuarterMinpos = halfMinpos + quarterMinpos; + result = threeQuarterMinpos; + GenerateTestCase(threeQuarterMinpos, mp, result); + + using LNS6_3 = lns<6, 3, Saturating, std::uint8_t>; + LNS6_3 ref; + ref.setbits(17); + std::cout << to_binary(ref) << " : " << ref << '\n'; + double input = double(ref); + result = input; + std::cout << to_binary(ref) << " : " << ref << " -> " << result << " : " << to_binary(result) << '\n'; + GenerateTestCase(input, double(LNS5_2(SpecificValue::minpos)), result); + } + + { + using LNS5_2 = lns<5, 2, Saturating, std::uint8_t>; + using LNS6_3 = lns<6, 3, Saturating, std::uint8_t>; + + constexpr size_t NR_SAMPLES = 32; + LNS5_2 a; + LNS6_3 b; + for (size_t i = 0; i < NR_SAMPLES; ++i) { + b.setbits(i); + if (i % 2 == 0) { + a.setbits(i / 2); + std::cout << to_binary(b) << " : " << std::setw(10) << b << " - " << std::setw(10) << a << " : " << to_binary(a) << '\n'; + } + else { + std::cout << to_binary(b) << " : " << std::setw(10) << b << '\n'; + } + } + } + + nrOfFailedTestCases += VerifyConversion<5, 2, Saturating, std::uint8_t>(true); + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return 0; + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<4, 1, Saturating, std::uint8_t>(true), "lns<4,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<5, 2, Saturating, std::uint8_t>(true), "lns<5,2>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyConversion<4, 1, Saturating, std::uint8_t>(true), "lns<4,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion<5, 2, Saturating, std::uint8_t>(true), "lns<5,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion<6, 3, Saturating, std::uint8_t>(true), "lns<6,3>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyConversion<4, 1, Saturating, std::uint8_t>(true), "lns<4,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion<5, 2, Saturating, std::uint8_t>(true), "lns<5,2>", test_tag); + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; +#else + +#if REGRESSION_LEVEL_1 + /* + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<3, 0, Saturating, std::uint8_t>(reportTestCases), "lns<3,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<4, 0, Saturating, std::uint8_t>(reportTestCases), "lns<4,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<5, 0, Saturating, std::uint8_t>(reportTestCases), "lns<5,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<6, 0, Saturating, std::uint8_t>(reportTestCases), "lns<6,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<7, 0, Saturating, std::uint8_t>(reportTestCases), "lns<7,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<8, 0, Saturating, std::uint8_t>(reportTestCases), "lns<8,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<9, 0, Saturating, std::uint8_t>(reportTestCases), "lns<9,0>", test_tag); + */ + + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 3, 0, Saturating, std::uint8_t>(reportTestCases), "lns<3,0,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 3, 1, Saturating, std::uint8_t>(reportTestCases), "lns<3,1,Saturating>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 4, 0, Saturating, std::uint8_t>(reportTestCases), "lns<4,0,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 4, 1, Saturating, std::uint8_t>(reportTestCases), "lns<4,1,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 4, 2, Saturating, std::uint8_t>(reportTestCases), "lns<4,2,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 4, 3, Saturating, std::uint8_t>(reportTestCases), "lns<4,3,Saturating>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 6, 0, Saturating, std::uint8_t>(reportTestCases), "lns<6,0,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 6, 1, Saturating, std::uint8_t>(reportTestCases), "lns<6,1,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 6, 2, Saturating, std::uint8_t>(reportTestCases), "lns<6,2,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 6, 3, Saturating, std::uint8_t>(reportTestCases), "lns<6,3,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 6, 4, Saturating, std::uint8_t>(reportTestCases), "lns<6,4,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 6, 5, Saturating, std::uint8_t>(reportTestCases), "lns<6,5,Saturating>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 0, Saturating, std::uint8_t>(reportTestCases), "lns<8,0,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 1, Saturating, std::uint8_t>(reportTestCases), "lns<8,1,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 2, Saturating, std::uint8_t>(reportTestCases), "lns<8,2,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 3, Saturating, std::uint8_t>(reportTestCases), "lns<8,3,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 4, Saturating, std::uint8_t>(reportTestCases), "lns<8,4,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 5, Saturating, std::uint8_t>(reportTestCases), "lns<8,5,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 6, Saturating, std::uint8_t>(reportTestCases), "lns<8,6,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 7, Saturating, std::uint8_t>(reportTestCases), "lns<8,7,Saturating>", test_tag); + + + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 0, Saturating, std::uint8_t>(reportTestCases), "lns<9,0,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 1, Saturating, std::uint8_t>(reportTestCases), "lns<9,1,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 2, Saturating, std::uint8_t>(reportTestCases), "lns<9,2,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 3, Saturating, std::uint8_t>(reportTestCases), "lns<9,3,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 4, Saturating, std::uint8_t>(reportTestCases), "lns<9,4,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 5, Saturating, std::uint8_t>(reportTestCases), "lns<9,5,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 6, Saturating, std::uint8_t>(reportTestCases), "lns<9,6,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 7, Saturating, std::uint8_t>(reportTestCases), "lns<9,7,Saturating>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 8, Saturating, std::uint8_t>(reportTestCases), "lns<9,8,Saturating>", test_tag); + + +#endif + +#if REGRESSION_LEVEL_2 + +#endif + +#if REGRESSION_LEVEL_3 + +#endif + +#if REGRESSION_LEVEL_4 + nrOfFailedTestCases += ReportTestResult(VerifyConversion<10, 0, Saturating, std::uint8_t>(reportTestCases), "lns<10,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion<10, 1, Saturating, std::uint8_t>(reportTestCases), "lns<10,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion<10, 2, Saturating, std::uint8_t>(reportTestCases), "lns<10,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion<10, 3, Saturating, std::uint8_t>(reportTestCases), "lns<10,3>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyConversion<12, 0, Saturating, std::uint8_t>(reportTestCases), "lns<12,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion<12, 1, Saturating, std::uint8_t>(reportTestCases), "lns<12,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion<12, 2, Saturating, std::uint8_t>(reportTestCases), "lns<12,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion<12, 3, Saturating, std::uint8_t>(reportTestCases), "lns<12,3>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyConversion<14, 0, Saturating, std::uint8_t>(reportTestCases), "lns<14,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion<14, 1, Saturating, std::uint8_t>(reportTestCases), "lns<14,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion<14, 2, Saturating, std::uint8_t>(reportTestCases), "lns<14,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion<14, 3, Saturating, std::uint8_t>(reportTestCases), "lns<14,3>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyConversion<16, 0, Saturating, std::uint8_t>(reportTestCases), "lns<16,0>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion<16, 1, Saturating, std::uint8_t>(reportTestCases), "lns<16,1>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion<16, 2, Saturating, std::uint8_t>(reportTestCases), "lns<16,2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyConversion<16, 3, Saturating, std::uint8_t>(reportTestCases), "lns<16,3>", test_tag); +#endif // REGRESSION_LEVEL_4 + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + +#endif // MANUAL_TESTING +} +catch (char const* msg) { + std::cerr << msg << std::endl; + return EXIT_FAILURE; +} +catch (const sw::universal::universal_arithmetic_exception& err) { + std::cerr << "Unexpected universal arithmetic exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (const sw::universal::universal_internal_exception& err) { + std::cerr << "Unexpected universal internal exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (const std::runtime_error& err) { + std::cerr << "Unexpected runtime exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} + +/* +Generate Value table for an LNS<5,2> in TXT format + # Binary sign scale value format + 0: 0b0.00.00 0 0 1 1 + 1: 0b0.00.01 0 0 1.18921 1.18921 + 2: 0b0.00.10 0 0 1.41421 1.41421 + 3: 0b0.00.11 0 0 1.68179 1.68179 + 4: 0b0.01.00 0 1 2 2 + 5: 0b0.01.01 0 1 2.37841 2.37841 + 6: 0b0.01.10 0 1 2.82843 2.82843 + 7: 0b0.01.11 0 1 3.36359 3.36359 + 8: 0b0.10.00 0 -2 0 0 + 9: 0b0.10.01 0 -2 0.297302 0.297302 + 10: 0b0.10.10 0 -2 0.353553 0.353553 + 11: 0b0.10.11 0 -2 0.420448 0.420448 + 12: 0b0.11.00 0 -1 0.5 0.5 + 13: 0b0.11.01 0 -1 0.594604 0.594604 + 14: 0b0.11.10 0 -1 0.707107 0.707107 + 15: 0b0.11.11 0 -1 0.840896 0.840896 + 16: 0b1.00.00 1 0 -1 -1 + 17: 0b1.00.01 1 0 -1.18921 -1.18921 + 18: 0b1.00.10 1 0 -1.41421 -1.41421 + 19: 0b1.00.11 1 0 -1.68179 -1.68179 + 20: 0b1.01.00 1 1 -2 -2 + 21: 0b1.01.01 1 1 -2.37841 -2.37841 + 22: 0b1.01.10 1 1 -2.82843 -2.82843 + 23: 0b1.01.11 1 1 -3.36359 -3.36359 + 24: 0b1.10.00 1 -2 -nan(ind) -nan(ind) + 25: 0b1.10.01 1 -2 -0.297302 -0.297302 + 26: 0b1.10.10 1 -2 -0.353553 -0.353553 + 27: 0b1.10.11 1 -2 -0.420448 -0.420448 + 28: 0b1.11.00 1 -1 -0.5 -0.5 + 29: 0b1.11.01 1 -1 -0.594604 -0.594604 + 30: 0b1.11.10 1 -1 -0.707107 -0.707107 + 31: 0b1.11.11 1 -1 -0.840896 -0.840896 + */ \ No newline at end of file diff --git a/tests/lns/logic/logic.cpp b/tests/lns/logic/logic.cpp index be402b4e6..7d13c1fb2 100644 --- a/tests/lns/logic/logic.cpp +++ b/tests/lns/logic/logic.cpp @@ -8,12 +8,14 @@ #include #include -template +namespace sw { + namespace universal { + +template int VerifyZeroEncoding(bool reportTestCases) { int nrOfFailedTestCases = 0; - // single block configurations - sw::universal::lns a, b; + TestType a, b; a.setzero(); b = a; if (!b.iszero()) { @@ -34,44 +36,44 @@ int VerifyZeroEncodings(bool reportTestCases) { std::string test_tag = "iszero()"; // single block configurations - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< 8, 4, std::uint8_t>(reportTestCases), "lns<8,4,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<16, 8, std::uint16_t>(reportTestCases), "lns<16,8,uint16_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<32, 16, std::uint32_t>(reportTestCases), "lns<32,16,uint32_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<64, 32, std::uint64_t>(reportTestCases), "lns<64,32,uint64_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns< 8, 4, Saturating, std::uint8_t > >(reportTestCases), "lns< 8, 4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<16, 8, Saturating, std::uint16_t> >(reportTestCases), "lns<16, 8,Saturating,uint16_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<32, 16, Saturating, std::uint32_t> >(reportTestCases), "lns<32,16,Saturating,uint32_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<64, 32, Saturating, std::uint64_t> >(reportTestCases), "lns<64,32,Saturating,uint64_t>", test_tag); // double block configurations with all special bits in the MSU - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<10, 4, std::uint8_t>(reportTestCases), "lns<10,4,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<18, 8, std::uint16_t>(reportTestCases), "lns<18,8,uint16_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<34, 16, std::uint32_t>(reportTestCases), "lns<34,16,uint32_t>", test_tag); -// nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<66, 32, std::uint64_t>(reportTestCases), "lns<66,32,uint64_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<10, 4, Saturating, std::uint8_t > >(reportTestCases), "lns<10, 4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<18, 8, Saturating, std::uint16_t> >(reportTestCases), "lns<18, 8,Saturating,uint16_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<34, 16, Saturating, std::uint32_t> >(reportTestCases), "lns<34,16,Saturating,uint32_t>", test_tag); +// nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<66, 32, Saturating, std::uint64_t> >(reportTestCases), "lns<66,32,Saturating,uint64_t>", test_tag); // double block configurations with special bits split between MSU and MSU - 1 - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< 9, 4, std::uint8_t>(reportTestCases), "lns<9,4,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<17, 8, std::uint16_t>(reportTestCases), "lns<17,8,uint16_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<33, 16, std::uint32_t>(reportTestCases), "lns<33,16,uint32_t>", test_tag); -// nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<65, 32, std::uint64_t>(reportTestCases), "lns<65,32,uint64_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns< 9, 4, Saturating, std::uint8_t > >(reportTestCases), "lns< 9, 4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<17, 8, Saturating, std::uint16_t> >(reportTestCases), "lns<17, 8,Saturating,uint16_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<33, 16, Saturating, std::uint32_t> >(reportTestCases), "lns<33,16,Saturating,uint32_t>", test_tag); +// nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<65, 32, Saturating, std::uint64_t> >(reportTestCases), "lns<65,32,Saturating,uint64_t>", test_tag); // triple block configurations with all special bits in the MSU - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<26, 4, std::uint8_t>(reportTestCases), "lns<26,4,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<50, 8, std::uint16_t>(reportTestCases), "lns<50,8,uint16_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<98, 16, std::uint32_t>(reportTestCases), "lns<98,16,uint32_t>", test_tag); -// nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<66, 32, std::uint64_t>(reportTestCases), "lns<66,32,uint64_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<26, 4, Saturating, std::uint8_t > >(reportTestCases), "lns<26, 4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<50, 8, Saturating, std::uint16_t> >(reportTestCases), "lns<50, 8,Saturating,uint16_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<98, 16, Saturating, std::uint32_t> >(reportTestCases), "lns<98,16,Saturating,uint32_t>", test_tag); +// nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<66, 32, Saturating, std::uint64_t> >(reportTestCases), "lns<66,32,Saturating,uint64_t>", test_tag); // triple block configurations with special bits split between MSU and MSU - 1 - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<25, 4, std::uint8_t>(reportTestCases), "lns<25,4,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<49, 8, std::uint16_t>(reportTestCases), "lns<49,8,uint16_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<97, 16, std::uint32_t>(reportTestCases), "lns<97,16,uint32_t>", test_tag); -// nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<65, 32, std::uint64_t>(reportTestCases), "lns<65,32,uint64_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<25, 4, Saturating, std::uint8_t > >(reportTestCases), "lns<25, 4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<49, 8, Saturating, std::uint16_t> >(reportTestCases), "lns<49, 8,Saturating,uint16_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<97, 16, Saturating, std::uint32_t> >(reportTestCases), "lns<97,16,Saturating,uint32_t>", test_tag); +// nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<65, 32, Saturating, std::uint64_t> >(reportTestCases), "lns<65,32,Saturating,uint64_t>", test_tag); return nrOfFailedTestCases; } -template +template int VerifyNaNEncoding(bool reportTestCases) { int nrOfFailedTestCases = 0; // single block configurations - sw::universal::lns a, b; + TestType a, b; a.setnan(); b = a; if (!b.isnan()) { @@ -92,38 +94,40 @@ int VerifyNaNEncodings(bool reportTestCases) { std::string test_tag = "isnan()"; // single block configurations - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< 8, 4, std::uint8_t>(reportTestCases), "lns<8,4,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding<16, 8, std::uint16_t>(reportTestCases), "lns<16,8,uint16_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding<32, 16, std::uint32_t>(reportTestCases), "lns<32,16,uint32_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding<64, 32, std::uint64_t>(reportTestCases), "lns<64,32,uint64_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns< 8, 4, Saturating, std::uint8_t > >(reportTestCases), "lns< 8, 4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns<16, 8, Saturating, std::uint16_t> >(reportTestCases), "lns<16, 8,Saturating,uint16_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns<32, 16, Saturating, std::uint32_t> >(reportTestCases), "lns<32,16,Saturating,uint32_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns<64, 32, Saturating, std::uint64_t> >(reportTestCases), "lns<64,32,Saturating,uint64_t>", test_tag); // double block configurations with all special bits in the MSU - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding<10, 4, std::uint8_t>(reportTestCases), "lns<10,4,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding<18, 8, std::uint16_t>(reportTestCases), "lns<18,8,uint16_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding<34, 16, std::uint32_t>(reportTestCases), "lns<34,16,uint32_t>", test_tag); - // nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<66, 32, std::uint64_t>(reportTestCases), "lns<66,32,uint64_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns<10, 4, Saturating, std::uint8_t > >(reportTestCases), "lns<10, 4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns<18, 8, Saturating, std::uint16_t> >(reportTestCases), "lns<18, 8,Saturating,uint16_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns<34, 16, Saturating, std::uint32_t> >(reportTestCases), "lns<34,16,Saturating,uint32_t>", test_tag); + // nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<66, 32, Saturating, std::uint64_t> >(reportTestCases), "lns<66,32,Saturating,uint64_t>", test_tag); // double block configurations with special bits split between MSU and MSU - 1 - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< 9, 4, std::uint8_t>(reportTestCases), "lns<9,4,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding<17, 8, std::uint16_t>(reportTestCases), "lns<17,8,uint16_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding<33, 16, std::uint32_t>(reportTestCases), "lns<33,16,uint32_t>", test_tag); - // nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<65, 32, std::uint64_t>(reportTestCases), "lns<65,32,uint64_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns< 9, 4, Saturating, std::uint8_t > >(reportTestCases), "lns< 9, 4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns<17, 8, Saturating, std::uint16_t> >(reportTestCases), "lns<17, 8,Saturating,uint16_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns<33, 16, Saturating, std::uint32_t> >(reportTestCases), "lns<33,16,Saturating,uint32_t>", test_tag); + // nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<65, 32, Saturating, std::uint64_t> (reportTestCases), "lns<65,32,Saturating,uint64_t>", test_tag); // triple block configurations with all special bits in the MSU - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding<26, 4, std::uint8_t>(reportTestCases), "lns<26,4,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding<50, 8, std::uint16_t>(reportTestCases), "lns<50,8,uint16_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding<98, 16, std::uint32_t>(reportTestCases), "lns<98,16,uint32_t>", test_tag); - // nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<66, 32, std::uint64_t>(reportTestCases), "lns<66,32,uint64_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns<26, 4, Saturating, std::uint8_t > >(reportTestCases), "lns<26, 4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns<50, 8, Saturating, std::uint16_t> >(reportTestCases), "lns<50, 8,Saturating,uint16_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns<98, 16, Saturating, std::uint32_t> >(reportTestCases), "lns<98,16,Saturating,uint32_t>", test_tag); + // nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<66, 32, Saturating, std::uint64_t> >(reportTestCases), "lns<66,32,Saturating,uint64_t>", test_tag); // triple block configurations with special bits split between MSU and MSU - 1 - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding<25, 4, std::uint8_t>(reportTestCases), "lns<25,4,uint8_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding<49, 8, std::uint16_t>(reportTestCases), "lns<49,8,uint16_t>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding<97, 16, std::uint32_t>(reportTestCases), "lns<97,16,uint32_t>", test_tag); - // nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding<65, 32, std::uint64_t>(reportTestCases), "lns<65,32,uint64_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns<25, 4, Saturating, std::uint8_t > >(reportTestCases), "lns<25, 4,Saturating,uint8_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns<49, 8, Saturating, std::uint16_t> >(reportTestCases), "lns<49, 8,Saturating,uint16_t>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNaNEncoding< lns<97, 16, Saturating, std::uint32_t> >(reportTestCases), "lns<97,16,Saturating,uint32_t>", test_tag); + // nrOfFailedTestCases += ReportTestResult(VerifyZeroEncoding< lns<65, 32, Saturating, std::uint64_t> >(reportTestCases), "lns<65,32,Saturating,uint64_t>", test_tag); return nrOfFailedTestCases; } +} } // namespace sw::universal + // 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 diff --git a/tests/lns/math/classify.cpp b/tests/lns/math/classify.cpp new file mode 100644 index 000000000..dc2b3d5f1 --- /dev/null +++ b/tests/lns/math/classify.cpp @@ -0,0 +1,143 @@ +// classify.cpp: test suite runner for classification functions specialized for logarithmic floats +// +// 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 + +bool isdenorm(float f) { + return (std::fpclassify(f) == FP_SUBNORMAL); +} +bool isdenorm(double d) { + return (std::fpclassify(d) == FP_SUBNORMAL); +} + +#define MANUAL_TESTING 0 + +int main() +try { + using namespace sw::universal; + + std::string test_suite = "lns<> mathlib classification validation"; + std::string test_tag = "classify"; + bool reportTestCases = false; + int nrOfFailedTestCases = 0; + + ReportTestSuiteHeader(test_suite, reportTestCases); + +#if MANUAL_TESTING + + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; // ignore failures +#else + +#define MY_DBL_MIN 2.2250738585072014e-308 // minpos value + + constexpr size_t nbits = 32; + constexpr size_t rbits = 8; + using bt = uint32_t; + using Number = lns; + Number cnan; cnan.setnan(); + Number cinf; cinf.setinf(false); + Number czero(0); + Number cminpos(SpecificValue::minpos); + Number cone(1); + + std::cout << type_tag(double()) << '\n' << std::boolalpha + << "isnormal(NaN) = " << std::isnormal(NAN) << '\n' + << "isnormal(Inf) = " << std::isnormal(INFINITY) << '\n' + << "isnormal(0.0) = " << std::isnormal(0.0) << '\n' + << "isnormal(DBL_MIN/2.0) = " << std::isnormal(MY_DBL_MIN / 2.0) << '\n' + << "isnormal(1.0) = " << std::isnormal(1.0) << '\n'; + std::cout << '\n' << type_tag(czero) << '\n' << std::boolalpha + << "isnormal(NaR) = " << isnormal(cnan) << '\n' + << "isnormal(Inf) = " << isnormal(cinf) << '\n' + << "isnormal(0.0) = " << isnormal(czero) << '\n' + << "isnormal(cminpos) = " << isnormal(cminpos) << '\n' + << "isnormal(1.0) = " << isnormal(cone) << '\n'; + + std::cout << '\n' << type_tag(double()) << '\n' << std::boolalpha + << "isdenorm(NaN) = " << isdenorm(NAN) << '\n' + << "isdenorm(Inf) = " << isdenorm(INFINITY) << '\n' + << "isdenorm(0.0) = " << isdenorm(0.0) << '\n' + << "isdenorm(DBL_MIN/2.0) = " << isdenorm(MY_DBL_MIN / 2.0) << " " << to_binary(MY_DBL_MIN / 2.0) << '\n' + << "isdenorm(1.0) = " << isdenorm(1.0) << '\n'; +#ifdef NOW + std::cout << '\n' << type_tag(czero) << '\n' << std::boolalpha + << "isdenorm(NaN) = " << isdenorm(cnan) << '\n' + << "isdenorm(Inf) = " << isdenorm(cinf) << '\n' + << "isdenorm(0.0) = " << isdenorm(czero) << '\n' + << "isdenorm(cminpos) = " << isdenorm(cminpos) << " " << to_binary(cminpos) << '\n' + << "isdenorm(1.0) = " << isdenorm(cone) << '\n'; +#endif + + std::cout << '\n' << type_tag(double()) << '\n' << std::boolalpha + << "isfinite(NaN) = " << std::isfinite(NAN) << '\n' + << "isfinite(Inf) = " << std::isfinite(INFINITY) << '\n' + << "isfinite(0.0) = " << std::isfinite(0.0) << '\n' + << "isfinite(DBL_MIN/2.0) = " << std::isfinite(MY_DBL_MIN / 2.0) << '\n' + << "isfinite(1.0) = " << std::isfinite(1.0) << '\n'; + std::cout << '\n' << type_tag(czero) << '\n' << std::boolalpha + << "isfinite(NaN) = " << isfinite(cnan) << '\n' + << "isfinite(Inf) = " << isfinite(cinf) << '\n' + << "isfinite(0.0) = " << isfinite(czero) << '\n' + << "isfinite(cminpos) = " << isfinite(cminpos) << '\n' + << "isfinite(1.0) = " << isfinite(cone) << '\n'; + + std::cout << '\n' << type_tag(double()) << '\n' << std::boolalpha + << "isinf(NaN) = " << std::isinf(NAN) << '\n' + << "isinf(Inf) = " << std::isinf(INFINITY) << '\n' + << "isinf(0.0) = " << std::isinf(0.0) << '\n' + << "isinf(DBL_MIN/2.0) = " << std::isinf(MY_DBL_MIN / 2.0) << '\n' + << "isinf(1.0) = " << std::isinf(1.0) << '\n'; + std::cout << '\n' << type_tag(czero) << '\n' << std::boolalpha + << "isinf(NaN) = " << isinf(cnan) << '\n' + << "isinf(Inf) = " << isinf(cinf) << '\n' + << "isinf(0.0) = " << isinf(czero) << '\n' + << "isinf(cminpos) = " << isinf(cminpos) << '\n' + << "isinf(1.0) = " << isinf(cone) << '\n'; + + std::cout << '\n' << type_tag(double()) << '\n' << std::boolalpha + << "isnan(NaN) = " << std::isnan(NAN) << '\n' + << "isnan(Inf) = " << std::isnan(INFINITY) << '\n' + << "isnan(0.0) = " << std::isnan(0.0) << '\n' + << "isnan(DBL_MIN/2.0) = " << std::isnan(MY_DBL_MIN / 2.0) << '\n' + << "isnan(1.0) = " << std::isnan(1.0) << '\n'; + std::cout << '\n' << type_tag(czero) << '\n' << std::boolalpha + << "isnan(NaN) = " << isnan(cnan) << '\n' + << "isnan(Inf) = " << isnan(cinf) << '\n' + << "isnan(0.0) = " << isnan(czero) << '\n' + << "isnan(cminpos) = " << isnan(cminpos) << '\n' + << "isnan(1.0) = " << isnan(cone) << '\n'; + + std::cout << '\n'; + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + +#endif // MANUAL_TESTING +} +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 (const std::runtime_error& err) { + std::cerr << "Caught runtime exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} diff --git a/tests/lns/math/exponent.cpp b/tests/lns/math/exponent.cpp new file mode 100644 index 000000000..35b8bf408 --- /dev/null +++ b/tests/lns/math/exponent.cpp @@ -0,0 +1,137 @@ +// exponent.cpp: test suite runner for exponent (exp, exp2, exp10) functions +// +// 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 + +// Background: http://numbers.computation.free.fr/Constants/E/e.html +// +// generate digits of Euler's number +void GenerateEulersNumber() { + int N = 9009, a[9009], x = 0; + for (int n = N - 1; n > 0; --n) { + a[n] = 1; + } + a[1] = 2; + while (N > 9) { + int n = N--; + while (--n) { + a[n] = x % n; + x = 10 * a[n - 1] + x / n; + } + std::cout << x; + } + std::cout << std::endl; +} + +// 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 +template +void GenerateTestCase(Ty a) { + Ty ref; + sw::universal::lns pa, pref, pexp; + pa = a; + ref = std::exp(a); + pref = ref; + pexp = sw::universal::exp(pa); + std::cout << std::setprecision(nbits - 2); + std::cout << std::setw(nbits) << a << " -> exp(" << a << ") = " << std::setw(nbits) << ref << std::endl; + std::cout << to_binary(pa) << " -> exp( " << pa << ") = " << to_binary(pexp) << " (reference: " << to_binary(pref) << ") "; + std::cout << (pref == pexp ? "PASS" : "FAIL") << std::endl << std::endl; + std::cout << std::setprecision(5); +} + +#define MANUAL_TESTING 0 +#define GENERATE_EXPONENT_TABLES 0 + +int main() +try { + using namespace sw::universal; + +// GenerateEulersNumber(); // 9000 digits of e + + std::string test_suite = "lns<> mathlib exponentiation validation"; + std::string test_tag = "exponentiation"; + bool reportTestCases = false; + int nrOfFailedTestCases = 0; + + std::cout << test_suite << '\n'; + +#if MANUAL_TESTING + // generate individual testcases to hand trace/debug + GenerateTestCase<16, 1, float>(4.0f); + +#if GENERATE_EXPONENT_TABLES + + GenerateExponentTable<5, 1>(); + GenerateExponentTable<5, 2>(); + GenerateExponentTable<6, 1>(); + GenerateExponentTable<6, 2>(); + GenerateExponentTable<6, 3>(); +#endif + + lns<8, 2, std::uint8_t> a, aexp2, aref; + a.setbits(0xFF); + aexp2 = sw::universal::exp2(a); + // generate reference + double da = double(a); + double dref = std::exp2(da); + aref = dref; + cout << to_binary(aref) << " : " << aref << " : " << to_binary(dref) << endl; + cout << to_binary(ieee754_parameter::fmask) << endl; + cout << to_binary(ieee754_parameter::snanmask) << endl; + + cout << endl; + + // manual exhaustive test + nrOfFailedTestCases += ReportTestResult(VerifyExp< lns<8, 2, uint8_t> >(reportTestCases), "lns<8,2>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2< lns<8, 4, uint8_t> >(reportTestCases), "lns<8,4>", "exp2"); + +#else + + nrOfFailedTestCases += ReportTestResult(VerifyExp< lns< 8, 2, Saturating, uint8_t> >(reportTestCases), "lns<8,2>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp< lns< 8, 3, Saturating, uint8_t> >(reportTestCases), "lns<8,3>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp< lns< 9, 2, Saturating, uint8_t> >(reportTestCases), "lns<9,2>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp< lns<10, 2, Saturating, uint8_t> >(reportTestCases), "lns<10,2>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp< lns<10, 3, Saturating, uint8_t> >(reportTestCases), "lns<10,3>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp< lns<12, 4, Saturating, uint8_t> >(reportTestCases), "lns<12,4>", "exp"); + nrOfFailedTestCases += ReportTestResult(VerifyExp< lns<16, 5, Saturating, uint8_t> >(reportTestCases), "lns<16,5>", "exp"); + + // base-2 exponent testing + nrOfFailedTestCases += ReportTestResult(VerifyExp2< lns<8, 2, Saturating, uint8_t> >(reportTestCases), "lns<8,2>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2< lns<8, 3, Saturating, uint8_t> >(reportTestCases), "lns<8,3>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2< lns<9, 2, Saturating, uint8_t> >(reportTestCases), "lns<9,2>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2< lns<10, 2, Saturating, uint8_t> >(reportTestCases), "lns<10,2>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2< lns<10, 3, Saturating, uint8_t> >(reportTestCases), "lns<10,3>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2< lns<12, 4, Saturating, uint8_t> >(reportTestCases), "lns<12,4>", "exp2"); + nrOfFailedTestCases += ReportTestResult(VerifyExp2< lns<16, 5, Saturating, uint8_t> >(reportTestCases), "lns<16,5>", "exp2"); + + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + +#endif // MANUAL_TESTING +} +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 (const std::runtime_error& err) { + std::cerr << "Caught runtime exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} diff --git a/tests/lns/math/fractional.cpp b/tests/lns/math/fractional.cpp new file mode 100644 index 000000000..de61eff28 --- /dev/null +++ b/tests/lns/math/fractional.cpp @@ -0,0 +1,478 @@ +// fractional.cpp: test suite runner for mod/frac/reminder functions specialized for logarithmic floats +// +// 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 + +namespace sw { namespace universal { + +template +int VerifyLnsFractionExponent(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, b, c; + int exp; + + for (size_t i = 1; i < NR_TEST_CASES; ++i) { + a.setbits(i); + b = frexp(a, &exp); + c = ldexp(b, exp); +// std::cout << "input : " << to_binary(a) << " : " << a << '\n'; +// std::cout << "frexp : " << to_binary(b) << " : " << b << '\n'; +// std::cout << "ldexp : " << to_binary(c) << " : " << c << '\n'; + if (a != c) { + if (a.isnan() && c.isnan()) continue; // (s)nan != (s)nan, so the regular equivalance test fails + nrOfFailedTests++; + if (reportTestCases) ReportOneInputFunctionError("FAIL", "frexp/ldexp", a, b, c); + } + else { + // if (reportTestCases) ReportOneInputFunctionError("PASS", "frexp/ldexp", a, b, c); + } + if (nrOfFailedTests > 24) return 25; + } + return nrOfFailedTests; +} + +// enumerate all fmod value combinations for a lns configuration +template +int VerifyLnsFmod(bool reportTestCases) { + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_TEST_CASES = (1 << nbits); + int nrOfFailedTests = 0; + TestType a, b, c, n, fref; + + for (size_t i = 0; i < NR_TEST_CASES; ++i) { + a.setbits(i); + for (size_t j = 0; j < NR_TEST_CASES; ++j) { + b.setbits(j); + c = fmod(a, b); + // generate reference + if (b.isnan()) { + fref.setnan(); + } + else if (b.iszero()) { // this must return a quiet NaN + fref.setnan(); + } + else if (a.iszero()) { + fref = a; // take the sign of a + } + else if (a.isinf()) { + fref.setnan(); + } + + else if (b.isinf()) { + fref = a; + } + else { + n = int(a / b); // we can use an int because this method can only run with lns that are small enough + fref = a - n * b; + } + + if (c != fref) { + if (c.isnan() && fref.isnan()) continue; // (s)nan != (s)nan, so the regular equivalance test fails + if (c.iszero() && fref.iszero()) continue; // optimizer destroys the sign + nrOfFailedTests++; + if (reportTestCases) ReportTwoInputFunctionError("FAIL", "fmod", a, b, c, fref); + std::cout << "a / b = " << n << '\n'; + std::cout << "n * y = " << (n * b) << '\n'; + std::cout << "cmod = " << c << '\n'; + std::cout << "fmod = " << std::fmod(float(a), float(b)) << '\n'; + std::cout << "fref = " << fref << '\n'; + } + else { + // if (reportTestCases) ReportTwoInputFunctionError("PASS", "fmod", a, b, c, fref); + } + if (nrOfFailedTests > 24) return 25; + } + } + return nrOfFailedTests; +} + +}} + +/* + std::fmod(x, y) + The floating-point remainder of the division operation x/y calculated by this function is + exactly the value x - n*y, where n is x/y with its fractional part truncated. + +The returned value has the same sign as x and is less than y in magnitude. + Parameters +x, y - floating point values +Return value +If successful, returns the floating-point remainder of the division x/y as defined above. + +If a domain error occurs, an implementation-defined value is returned (NaN where supported). + +If a range error occurs due to underflow, the correct result (after rounding) is returned. +*/ +template +Real trace_fmod(Real x, Real y) { + using namespace sw::universal; + using std::trunc; // incase Real is a native + constexpr size_t NR_DIGITS = 20; + + auto old_precision = std::cout.precision(); + std::cout << std::setprecision(NR_DIGITS); + std::cout << "fmod( " << x << ", " << y << ")\n"; + if (x < y) return x; + Real c = x / y; + std::cout << x << " / " << y << " = " << to_binary(c) << " : " << c << '\n'; + Real n = trunc(c); + //n.truncate(); + + std::cout << "x = " << to_binary(x) << " : " << x << '\n'; + std::cout << "n = " << to_binary(n) << " : " << n << '\n'; + Real n_times_y = n * y; + std::cout << "n*y = " << to_binary(n_times_y) << " : " << n_times_y << '\n'; + Real diff = x - n_times_y; + std::cout << "x - n*y = " << to_binary(diff) << " : " << diff << '\n'; + float floatmod = std::fmod(float(x), float(y)); + std::cout << "std::fmod = " << to_binary(floatmod) << " : " << floatmod << '\n'; + std::cout << std::setprecision(old_precision); + + return x - n_times_y; +} + +/* +std::remainder(x, y) +The IEEE floating-point remainder of the division operation x/y calculated by this function is +exactly the value x - n*y, where the value n is the integral value nearest the exact value x/y. +When |n-x/y| = ½, the value n is chosen to be even. + +In contrast to std::fmod(), the returned value is not guaranteed to have the same sign as x. + +If the returned value is 0, it will have the same sign as x. +Parameters +x, y - values of floating-point or integral types +Return value +If successful, returns the IEEE floating-point remainder of the division x/y as defined above. + +If a domain error occurs, an implementation-defined value is returned (NaN where supported) + +If a range error occurs due to underflow, the correct result is returned. + +If y is zero, but the domain error does not occur, zero is returned. +*/ +template +Real trace_remainder(Real x, Real y) { + using namespace sw::universal; + using std::trunc; // incase Real is a native + std::cout << "remainder( " << x << ", " << y << ")\n"; + if (x < y) return x; + Real c = x / y; + std::cout << x << " / " << y << " = " << c << '\n'; + Real n = trunc(c); + //n.truncate(); + + Real n_times_y = n * y; + std::cout << "x = " << x << '\n'; + std::cout << "n = " << n << '\n'; + std::cout << "n*y = " << n_times_y << '\n'; + std::cout << "x - n*y = " << x - n_times_y << '\n'; + + return x - n_times_y; +} + +/* +frac(x) returns the fractional value of x +*/ + +template +Real test_frac(Real x) { + using namespace sw::universal; + std::cout << "frac(" << x << ") = " << frac(x) << '\n'; + std::cout << "reference = " << (double(x) - (long long)(x)) << '\n'; + return frac(x); +} + +// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override +#define MANUAL_TESTING 1 +// 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 0 +#define REGRESSION_LEVEL_4 0 +#endif + +int main() +try { + using namespace sw::universal; + + std::string test_suite = "lns<> mathlib fractional validation"; + std::string test_tag = "fractional"; + bool reportTestCases = true; + int nrOfFailedTestCases = 0; + + ReportTestSuiteHeader(test_suite, reportTestCases); + +#if MANUAL_TESTING + + { + std::cout << std::setprecision(8); + float f = 1e9f / 3.0f; + std::cout << to_binary(f) << " : " << f << '\n'; + f = 3 * f; + std::cout << to_binary(f) << " : " << f << '\n'; + } + + { + float f = 3; + trace_fmod(1e1f, f); + trace_fmod(1e3f, f); + trace_fmod(1e6f, f); + trace_fmod(1e9f, f); + } + { + double f = 3; + trace_fmod(1e1, f); + trace_fmod(1e3, f); + trace_fmod(1e6, f); + trace_fmod(1e9, f); + } + + { + float f = 3.14159265358979f; + trace_fmod(1e1f, f); + trace_fmod(1e3f, f); + trace_fmod(1e6f, f); + trace_fmod(1e9f, f); + } + + { + using Real = sw::universal::lns<32, 8, Saturating, uint32_t>; + Real pi = Real(3.14159265358979); + std::cout << to_binary(pi) << " : " << pi << '\n'; + for (int i = 0; i < 10; ++i) { + Real powerOfTen = Real(std::pow(10.0f, float(i))); + std::cout << to_binary(powerOfTen) << " : " << powerOfTen << '\n'; + Real cmod = lnsmod(powerOfTen, pi); + float fmod = std::fmod(float(powerOfTen), float(pi)); + std::cout << "lnsmod : " << to_binary(cmod) << " : " << cmod << "\n"; + std::cout << "floatmod: " << to_binary(fmod) << " : " << fmod << '\n'; + } + + // std::cout << "float: " << std::fmod(1e9f, 3.14159265358979f) << "\n"; + } + + +// #define MY_DBL_MIN 2.2250738585072014e-308 // minpos value + + { + constexpr size_t nbits = 32; + constexpr size_t es = 8; + using bt = uint32_t; + using Real = lns; + + float fa(1.5), fb(2.25); + Real a(fa), b(fb); + + std::cout << "IEEE-754 float reference\n"; + std::cout << "fmod : " << fmod(fa, fb) << " : " << fa << " : " << fb << '\n'; + std::cout << "fmod : " << fmod(-fa, fb) << " : " << -fa << " : " << fb << '\n'; + std::cout << "fmod : " << fmod(fb, -fa) << " : " << fb << " : " << fa << '\n'; + std::cout << "fmod : " << fmod(fb, fa) << " : " << fb << " : " << -fa << '\n'; + std::cout << "remainder : " << remainder(fa, fb) << " : " << fa << " : " << fb << '\n'; + std::cout << "remainder : " << remainder(fb, fa) << " : " << fb << " : " << fa << '\n'; + // std::cout << "frac : " << std::frac(fa) << " : " << fa << '\n'; + + std::cout << "lns results\n"; + std::cout << "fmod : " << fmod(a, b) << " : " << a << " : " << b << '\n'; + std::cout << "fmod : " << fmod(-a, b) << " : " << -a << " : " << b << '\n'; + std::cout << "fmod : " << fmod(b, a) << " : " << b << " : " << a << '\n'; + std::cout << "fmod : " << fmod(b, -a) << " : " << b << " : " << -a << '\n'; + std::cout << "remainder : " << remainder(a, b) << " : " << a << " : " << b << '\n'; + std::cout << "remainder : " << remainder(b, a) << " : " << b << " : " << a << '\n'; + std::cout << "frac : " << frac(a) << " : " << a << '\n'; + std::cout << "frac : " << frac(Real(-2.0625)) << " : " << Real(-2.0625) << '\n'; + for (int i = 0; i < 10; ++i) { + Real x = 0.5; + Real exp = pow(10.0, i); + x += exp; + std::cout << "frac : " << to_binary(frac(x)) << " : " << frac(x) << " : " << to_binary(x) << " : " << x << '\n'; + } + } + + { + using Real = lns<16, 2, Saturating, uint8_t>; + Real a; + a = -1.5; +// a.showLimbs(); + std::cout << to_binary(a) << " : " << a << " : " << trunc(a) << " : " << to_binary(a) << " : " << a << '\n'; + } + + { + using Real = lns<16, 2, Saturating, uint8_t>; + Real a, b, c; + a = 1.5; b = 2.25; + c = trace_fmod(a, b); + std::cout << "fmod = " << c << '\n'; + c = trace_fmod(b, a); + std::cout << "fmod = " << c << '\n'; + c = trace_fmod(-a, b); + std::cout << "fmod = " << c << '\n'; + c = trace_fmod(b, -a); + std::cout << "fmod = " << c << '\n'; + } + + { + using Real = lns<32, 8, Saturating, uint8_t>; + Real a, b, c; + a = 1.5; b = 2.25; + c = trace_fmod(a, b); + std::cout << "fmod = " << c << '\n'; + c = trace_fmod(b, a); + std::cout << "fmod = " << c << '\n'; + } + + { + using Real = lns<32, 8, Saturating, uint32_t>; + float fa(1e9f), fb(3.14159265358979f), fc; + Real a(fa), b(fb), c; + std::cout << "lns : " << fmod(Real(a), Real(b)) << "\n"; + std::cout << "float : " << std::fmod(fa, fb) << "\n"; + fc = trace_fmod(fa, fb); + std::cout << "fmod = " << fc << '\n'; + c = trace_fmod(a, b); + std::cout << "fmod = " << c << '\n'; + } + + { + using Real = lns<32, 8, Saturating, uint8_t>; + Real a; + a = 1.5; + test_frac(a); + test_frac(a = 2.25); + test_frac(a = 0.25); + test_frac(a = 0.0625); + test_frac(a = -0.0625); + } + + { + using Real = lns<32, 23, Saturating, std::uint32_t>; + Real a, b, c; + float fa(32.0f), fb(0.0625f + 0.125f); + a = fa; + b = fb; + c = a + b; + std::cout << to_binary(a) << " : " << "scale : " << a.scale() << " : " << a << '\n'; + std::cout << to_binary(b) << " : " << "scale : " << b.scale() << " : " << b << '\n'; + std::cout << to_binary(c) << " : " << "scale : " << c.scale() << " : " << c << '\n'; + + int exp; + auto fr = frexp(c, &exp); + std::cout << to_binary(fr) << " : " << "scale : " << exp << " : " << fr << '\n'; + c = ldexp(fr, exp); + std::cout << to_binary(c) << " : " << "scale : " << c.scale() << " : " << c << '\n'; + + std::cout << "fmod " << fmod(fa, fb) << '\n'; + std::cout << "cmod " << fmod(a, b) << '\n'; + + } + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; // ignore failures +#else + + { + using Real = lns<8, 4, uint8_t>; + Real a, b, c; + a.setbits(1u); + b.setinf(false); + + //float fa = 0.0214844f; + //float fb = 0.00585938f; + float fa = 0.5f; + float fb = 0.00195312f; + a = fa; + b = fb; + + std::cout << "a = " << a << " and b = " << b << '\n'; + std::cout << "a = " << color_print(a) << " and b = " << color_print(b) << '\n'; + c = lnsmod(a, b); + std::cout << "lnsmod(" << a << ", " << b << ") = " << c << '\n'; + + Real d = a / b; + Real n = trunc(d); + + std::cout << "a / b " << d << " : " << n << " : " << (n * b) << " : " << (a - (n * b)) << '\n'; + std::cout << "fmod " << fmod(fa, fb) << '\n'; + std::cout << "cmod " << fmod(a, b) << '\n'; + + } + + { + float a, b, c; + a = 0.001953125f; + b = INFINITY; + c = fmod(a, b); + std::cout << a << " " << b << " = " << c << '\n'; + } + + { + float a, b, c; + a = INFINITY; + b = 0.001953125f; + c = fmod(a, b); + std::cout << a << " " << b << " = " << c << '\n'; + } + + + +#if REGRESSION_LEVEL_1 + { + using LNS8_4 = lns<8, 4, std::uint8_t>; + + nrOfFailedTestCases += ReportTestResult(VerifyLnsFractionExponent < LNS8_4 >(reportTestCases), type_tag(LNS8_4()), "frexp/ldexp"); + nrOfFailedTestCases += ReportTestResult(VerifyLnsFmod < LNS8_4 >(reportTestCases), type_tag(LNS8_4()), "fmod"); + } + +#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 << "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 (const std::runtime_error& err) { + std::cerr << "Caught runtime exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} diff --git a/tests/lns/math/hyperbolic.cpp b/tests/lns/math/hyperbolic.cpp new file mode 100644 index 000000000..e59d83c4a --- /dev/null +++ b/tests/lns/math/hyperbolic.cpp @@ -0,0 +1,165 @@ +// hyperbolic.cpp: test suite runner for hyperbolic functions (sinh/cosh/tanh/atanh/acosh/asinh) using logarithmic floats +// +// 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 +// use default library configuration +#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 +template +void GenerateTestCaseSinh(Ty v) { + Ty ref; + sw::universal::lns a, aref, asinh; + a = v; + ref = std::sinh(v); + aref = ref; + asinh = sw::universal::sinh(a); + std::cout << std::setprecision(nbits - 2); + std::cout << std::setw(nbits) << a << " -> sinh(" << a << ") = " << std::setw(nbits) << ref << std::endl; + std::cout << sw::universal::to_binary(a) << " -> sinh( " << a << ") = " << sw::universal::to_binary(asinh) << " (reference: " << sw::universal::to_binary(aref) << ") " ; + std::cout << (aref == asinh ? "PASS" : "FAIL") << std::endl << std::endl; + std::cout << std::setprecision(5); +} + +template +void GenerateTestCaseCosh(Ty v) { + Ty ref; + sw::universal::lns a, aref, acosh; + a = v; + ref = std::cosh(v); + aref = ref; + acosh = sw::universal::cosh(a); + std::cout << std::setprecision(nbits - 2); + std::cout << std::setw(nbits) << a << " -> cosh(" << a << ") = " << std::setw(nbits) << ref << std::endl; + std::cout << sw::universal::to_binary(a) << " -> cosh( " << a << ") = " << sw::universal::to_binary(acosh) << " (reference: " << sw::universal::to_binary(aref) << ") "; + std::cout << (aref == acosh ? "PASS" : "FAIL") << std::endl << std::endl; + std::cout << std::setprecision(5); +} + +template +void GenerateTestCaseTanh(Ty v) { + Ty ref; + sw::universal::lns a, aref, atanh; + a = v; + ref = std::tanh(v); + aref = ref; + atanh = sw::universal::tanh(a); + std::cout << std::setprecision(nbits - 2); + std::cout << std::setw(nbits) << a << " -> tanh(" << a << ") = " << std::setw(nbits) << ref << std::endl; + std::cout << sw::universal::to_binary(a) << " -> tanh( " << a << ") = " << sw::universal::to_binary(atanh) << " (reference: " << sw::universal::to_binary(aref) << ") "; std::cout << (aref == atanh ? "PASS" : "FAIL") << std::endl << std::endl; + std::cout << std::setprecision(5); +} + +template +void GenerateTestCaseAsinh(Ty v) { + Ty ref; + sw::universal::lns a, aref, aasinh; + a = v; + ref = std::asinh(v); + aref = ref; + aasinh = sw::universal::asinh(a); + std::cout << std::setprecision(nbits - 2); + std::cout << std::setw(nbits) << a << " -> asinh(" << a << ") = " << std::setw(nbits) << ref << std::endl; + std::cout << sw::universal::to_binary(a) << " -> asinh( " << a << ") = " << sw::universal::to_binary(aasinh) << " (reference: " << sw::universal::to_binary(aref) << ") "; std::cout << (aref == aasinh ? "PASS" : "FAIL") << std::endl << std::endl; + std::cout << (aref == aasinh ? "PASS" : "FAIL") << std::endl << std::endl; + std::cout << std::setprecision(5); +} + +template +void GenerateTestCaseAcosh(Ty v) { + Ty ref; + sw::universal::lns a, aref, aacosh; + a = v; + ref = std::acosh(v); + aref = ref; + aacosh = sw::universal::acosh(a); + std::cout << std::setprecision(nbits - 2); + std::cout << std::setw(nbits) << a << " -> acosh(" << a << ") = " << std::setw(nbits) << ref << std::endl; + std::cout << sw::universal::to_binary(a) << " -> acosh( " << a << ") = " << sw::universal::to_binary(aacosh) << " (reference: " << sw::universal::to_binary(aref) << ") "; std::cout << (aref == aacosh ? "PASS" : "FAIL") << std::endl << std::endl; + std::cout << (aref == aacosh ? "PASS" : "FAIL") << std::endl << std::endl; + std::cout << std::setprecision(5); +} + +template +void GenerateTestCaseAtanh(Ty v) { + Ty ref; + sw::universal::lns a, aref, aatanh; + a = v; + ref = std::atanh(v); + aref = ref; + aatanh = sw::universal::atanh(a); + std::cout << std::setprecision(nbits - 2); + std::cout << std::setw(nbits) << a << " -> atanh(" << a << ") = " << std::setw(nbits) << ref << std::endl; + std::cout << sw::universal::to_binary(a) << " -> atanh( " << a << ") = " << sw::universal::to_binary(aatanh) << " (reference: " << sw::universal::to_binary(aref) << ") "; std::cout << (aref == aatanh ? "PASS" : "FAIL") << std::endl << std::endl; + std::cout << (aref == aatanh ? "PASS" : "FAIL") << std::endl << std::endl; + std::cout << std::setprecision(5); +} + + +#define MANUAL_TESTING 1 + +const double pi = 3.14159265358979323846; + +int main() +try { + using namespace sw::universal; + + std::string test_suite = "lns<> mathlib hyperbolic function validation"; + std::string test_tag = "hyperbolic"; + bool reportTestCases = false; + int nrOfFailedTestCases = 0; + + ReportTestSuiteHeader(test_suite, reportTestCases); + +#if MANUAL_TESTING + // generate individual testcases to hand trace/debug + GenerateTestCaseSinh<16, 1, Saturating, uint16_t, double>(pi / 4.0); + GenerateTestCaseCosh<16, 1, Saturating, uint16_t, double>(pi / 4.0); + GenerateTestCaseTanh<16, 1, Saturating, uint16_t, double>(pi / 4.0); + GenerateTestCaseAsinh<16, 1, Saturating, uint16_t, double>(pi / 2.0); + GenerateTestCaseAcosh<16, 1, Saturating, uint16_t, double>(pi / 2.0); + GenerateTestCaseAtanh<16, 1, Saturating, uint16_t, double>(pi / 4.0); + + std::cout << '\n'; + + // manual exhaustive test + nrOfFailedTestCases += ReportTestResult(VerifySinh< lns<8, 2, Saturating, uint8_t> >(reportTestCases), "lns<8,2>", "sinh"); + nrOfFailedTestCases += ReportTestResult(VerifyCosh< lns<8, 2, Saturating, uint8_t> >(reportTestCases), "lns<8,2>", "cosh"); + nrOfFailedTestCases += ReportTestResult(VerifyTanh< lns<8, 2, Saturating, uint8_t> >(reportTestCases), "lns<8,2>", "tanh"); + nrOfFailedTestCases += ReportTestResult(VerifyAtanh< lns<8, 2, Saturating, uint8_t> >(reportTestCases), "lns<8,2>", "atanh"); + nrOfFailedTestCases += ReportTestResult(VerifyAcosh< lns<8, 2, Saturating, uint8_t> >(reportTestCases), "lns<8,2>", "acosh"); + nrOfFailedTestCases += ReportTestResult(VerifyAsinh< lns<8, 2, Saturating, uint8_t> >(reportTestCases), "lns<8,2>", "asinh"); + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; // ignore failures +#else + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + +#endif // MANUAL_TESTING +} +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 (const std::runtime_error& err) { + std::cerr << "Caught runtime exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} diff --git a/tests/lns/math/hypotenuse.cpp b/tests/lns/math/hypotenuse.cpp new file mode 100644 index 000000000..3adb11c0e --- /dev/null +++ b/tests/lns/math/hypotenuse.cpp @@ -0,0 +1,115 @@ +// hypotenuse.cpp: test suite runner for the hypotenuse functions (hypot, hypotf, hypotl) +// +// 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 + +// 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 +template +void GenerateTestCase(Ty _a, Ty _b) { + sw::universal::lns a, b, pref, result; + a = _a; + b = _b; + Ty ref = std::hypot(_a, _b); + pref = ref; + result = sw::universal::hypot(a, b); + std::cout << std::setprecision(nbits - 2); + std::cout << " hypot(" << _a << ", " << _b << ") = " << ref << '\n'; + std::cout << " hypot(" << a << ", " << b << ") = " << result << " : " << to_binary(result) << " (reference: " << to_binary(pref) << ") "; + std::cout << (pref == result ? "PASS" : "FAIL") << "\n\n"; + std::cout << std::setprecision(5); +} + + +// 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 0 +#define REGRESSION_LEVEL_4 0 +#endif + + +int main() +try { + using namespace sw::universal; + + std::string test_suite = "lns hypotenuse validation"; + std::string test_tag = "hypotenuse"; + bool reportTestCases = true; + int nrOfFailedTestCases = 0; + + ReportTestSuiteHeader(test_suite, reportTestCases); + +#if MANUAL_TESTING + // generate individual testcases to hand trace/debug + lns<8, 3, std::uint8_t> a(SpecificValue::maxpos); + std::cout << "maxpos " << type_tag(a) << " : " << a << '\n'; + GenerateTestCase< 8, 3, Saturating, std::uint8_t, float>(3.0f, 4.0f); + GenerateTestCase<16, 5, Saturating, std::uint8_t, float>(3.0f, 4.0f); + + nrOfFailedTestCases += ReportTestResult(VerifyHypot< lns<4, 1, Saturating, std::uint8_t> >(reportTestCases), "lns<4, 1>", "hypot"); + nrOfFailedTestCases += ReportTestResult(VerifyHypot< lns<8, 4, Saturating, std::uint8_t> >(reportTestCases), "lns<8, 4>", "hypot"); + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; // ignore errors +#else + +#if REGRESSION_LEVEL_1 + nrOfFailedTestCases += ReportTestResult(VerifyHypot< lns<4, 1, Saturating, std::uint8_t> >(reportTestCases), "lns<4, 1>", "hypot"); + nrOfFailedTestCases += ReportTestResult(VerifyHypot< lns<5, 1, Saturating, std::uint8_t> >(reportTestCases), "lns<5, 1>", "hypot"); + nrOfFailedTestCases += ReportTestResult(VerifyHypot< lns<6, 2, Saturating, std::uint8_t> >(reportTestCases), "lns<6, 2>", "hypot"); + nrOfFailedTestCases += ReportTestResult(VerifyHypot< lns<7, 2, Saturating, std::uint8_t> >(reportTestCases), "lns<7, 2>", "hypot"); + nrOfFailedTestCases += ReportTestResult(VerifyHypot< lns<8, 3, Saturating, std::uint8_t> >(reportTestCases), "lns<8, 3>", "hypot"); +#endif + +#if REGRESSION_LEVEL_2 + +#endif + +#if REGRESSION_LEVEL_3 + +#endif + +#if REGRESSION_LEVEL_4 + // nbits=64 requires long double compiler support + nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(reportTestCases, OPCODE_SQRT, 1000), "posit<64,2>", "hypot"); +#endif + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + +#endif // MANUAL_TESTING +} +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 (const std::runtime_error& err) { + std::cerr << "Caught runtime exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} diff --git a/tests/lns/math/logarithm.cpp b/tests/lns/math/logarithm.cpp new file mode 100644 index 000000000..5fe7f49e2 --- /dev/null +++ b/tests/lns/math/logarithm.cpp @@ -0,0 +1,103 @@ +// logarithm.cpp: test suite runner for the logarithm functions (log2, log10, ln) +// +// 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 + +// 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 +template +void GenerateTestCase(Ty a) { + Ty ref; + sw::universal::lns pa, pref, plog; + pa = a; + ref = std::log(a); + pref = ref; + plog = sw::universal::log(pa); + std::cout << std::setprecision(nbits - 2); + std::cout << std::setw(nbits) << a << " -> log(" << a << ") = " << std::setw(nbits) << ref << std::endl; + std::cout << sw::universal::to_binary(pa) << " -> log( " << pa << ") = " << sw::universal::to_binary(plog) << " (reference: " << sw::universal::to_binary(pref) << ") " ; + std::cout << (pref == plog ? "PASS" : "FAIL") << std::endl << std::endl; + std::cout << std::setprecision(5); +} + +#define MANUAL_TESTING 1 +#define GENERATE_LOG_TABLES 0 + +int main() +try { + using namespace sw::universal; + + std::string test_suite = "lns<> mathlib logarithm validation"; + std::string test_tag = "logarithm"; + bool reportTestCases = false; + int nrOfFailedTestCases = 0; + + ReportTestSuiteHeader(test_suite, reportTestCases); + +#if MANUAL_TESTING + // generate individual testcases to hand trace/debug + GenerateTestCase<16, 1, Saturating, uint8_t>(4.0f); + +#if GENERATE_LOG_TABLES + GenerateLogarithmTable<3, 0>(); + GenerateLogarithmTable<4, 0>(); + GenerateLogarithmTable<4, 1>(); + GenerateLogarithmTable<5, 0>(); + GenerateLogarithmTable<5, 1>(); + GenerateLogarithmTable<5, 2>(); + GenerateLogarithmTable<6, 0>(); + GenerateLogarithmTable<6, 1>(); + GenerateLogarithmTable<6, 2>(); + GenerateLogarithmTable<6, 3>(); + GenerateLogarithmTable<7, 0>(); +#endif + + // manual exhaustive test + nrOfFailedTestCases += ReportTestResult(VerifyLog< lns<8, 4, Saturating, uint8_t> >(reportTestCases), "lns<8,4>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog2< lns<8, 4, Saturating, uint8_t> >(reportTestCases), "lns<8,4>", "log2"); + nrOfFailedTestCases += ReportTestResult(VerifyLog10< lns <8, 4, Saturating, uint8_t > >(reportTestCases), "lns<8,4>", "log10"); + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; // ignore failures +#else + + // nbits=64 requires long double compiler support + nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(bReportIndividualTestCases, OPCODE_SQRT, 1000), "lns<64,2>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 3>(bReportIndividualTestCases, OPCODE_SQRT, 1000), "lns<64,3>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 4>(bReportIndividualTestCases, OPCODE_SQRT, 1000), "lns<64,4>", "log"); + + + nrOfFailedTestCases += ReportTestResult(VerifyLog<10, 1>(bReportIndividualTestCases), "lns<10,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog<12, 1>(bReportIndividualTestCases), "lns<12,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog<14, 1>(bReportIndividualTestCases), "lns<14,1>", "log"); + nrOfFailedTestCases += ReportTestResult(VerifyLog<16, 1>(bReportIndividualTestCases), "lns<16,1>", "log"); + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + +#endif // MANUAL_TESTING +} +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 (const std::runtime_error& err) { + std::cerr << "Caught runtime exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} diff --git a/tests/lns/math/next.cpp b/tests/lns/math/next.cpp new file mode 100644 index 000000000..e0db9218e --- /dev/null +++ b/tests/lns/math/next.cpp @@ -0,0 +1,95 @@ +// next.cpp: test suite runner for ULP functions nextafter, nextforward +// +// 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 + +namespace sw { namespace universal { + + +} } // namespace sw::universal + +// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override +#define MANUAL_TESTING 1 +// 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; + + std::string test_suite = "lns<> nextafter/toward validation"; + std::string test_tag = "nextafter/toward"; + bool reportTestCases = false; + int nrOfFailedTestCases = 0; + + ReportTestSuiteHeader(test_suite, reportTestCases); + +#if MANUAL_TESTING + // generate individual testcases to hand trace/debug + + nrOfFailedTestCases += ReportTestResult(VerifyNextafter< lns< 16, 5, Saturating, std::uint16_t> >(reportTestCases), "lns< 16, 5>", test_tag); + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; // ignore errors + +#else + +#if REGRESSION_LEVEL_1 + nrOfFailedTestCases += ReportTestResult(VerifyNextafter< lns< 8, 2, Saturating, std::uint8_t > >(reportTestCases), "lns< 8, 2>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNextafter< lns< 16, 5, Saturating, std::uint16_t> >(reportTestCases), "lns< 16, 5>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNextafter< lns< 32, 8, Saturating, std::uint32_t> >(reportTestCases), "lns< 32, 8>", test_tag); + nrOfFailedTestCases += ReportTestResult(VerifyNextafter< lns< 64,11, Saturating, std::uint64_t> >(reportTestCases), "lns< 64,11>", test_tag); +#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 << "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 (const std::runtime_error& err) { + std::cerr << "Caught runtime exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} diff --git a/tests/lns/math/pow.cpp b/tests/lns/math/pow.cpp new file mode 100644 index 000000000..8c6951e45 --- /dev/null +++ b/tests/lns/math/pow.cpp @@ -0,0 +1,98 @@ +// pow.cpp: test suite runner for power function +// +// 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 + +// 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 +template +void GenerateTestCase(Ty a, Ty b) { + Ty ref; + sw::universal::lns pa, pb, pref, ppow; + pa = a; + pb = b; + ref = std::pow(a,b); + pref = ref; + ppow = sw::universal::pow(pa,pb); + std::cout << std::setprecision(nbits - 2); + std::cout << std::setw(nbits) << " -> pow(" << a << "," << b << ") = " << std::setw(nbits) << ref << std::endl; + std::cout << " -> pow( " << pa << "," << pb << ") = " << ppow.get() << " (reference: " << pref.get() << ") " ; + std::cout << (pref == ppow ? "PASS" : "FAIL") << std::endl << std::endl; + std::cout << std::setprecision(5); +} + +#define MANUAL_TESTING 0 +#define STRESS_TESTING 0 + +int main() +try { + using namespace sw::universal; + + std::string test_suite = "lns<> mathlib power function validation"; + std::string test_tag = "pow"; + bool reportTestCases = false; + int nrOfFailedTestCases = 0; + + ReportTestSuiteHeader(test_suite, reportTestCases); + +#if MANUAL_TESTING + // generate individual testcases to hand trace/debug + GenerateTestCase<16, 1, Saturating, std::uint16_t, float>(4.0f, 2.0f); + +#if GENERATE_POW_TABLES + GeneratePowTable<3, 0>(); + GeneratePowTable<4, 0>(); + GeneratePowTable<4, 1>(); + GeneratePowTable<5, 0>(); + GeneratePowTable<5, 1>(); + GeneratePowTable<5, 2>(); + GeneratePowTable<6, 0>(); + GeneratePowTable<6, 1>(); + GeneratePowTable<6, 2>(); + GeneratePowTable<6, 3>(); + GeneratePowTable<7, 0>(); +#endif + + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<4, 1>("Manual Testing", reportTestCases), "lns<4,1>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<5, 2>("Manual Testing", reportTestCases), "lns<5,2>", test_tag); + + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<8, 4>("Manual Testing", reportTestCases), "lns<8,4>", test_tag); + + //nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction<16, 1>("Manual Testing", reportTestCases), "lns<16,1>", test_tag); + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; // ignore errors +#else + + nrOfFailedTestCases += ReportTestResult(VerifyPowerFunction< lns<8, 2> >(reportTestCases), "lns<8,2>", "pow"); + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + +#endif // MANUAL_TESTING +} +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 (const std::runtime_error& err) { + std::cerr << "Caught runtime exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} diff --git a/tests/lns/math/trigonometry.cpp b/tests/lns/math/trigonometry.cpp new file mode 100644 index 000000000..c3cecf037 --- /dev/null +++ b/tests/lns/math/trigonometry.cpp @@ -0,0 +1,257 @@ +// trigonometry.cpp: test suite runner for trigonometric functions (sin/cos/tan/atan/acos/asin) +// +// 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 +// use default library configuration +#include +#include + +/* +Writes result sine result sin(Ï€a) to the location pointed to by sp +Writes result cosine result cos(Ï€a) to the location pointed to by cp + +In extensive testing, no errors > 0.97 ulp were found in either the sine +or cosine results, suggesting the results returned are faithfully rounded. + +Reference: +https://stackoverflow.com/questions/42792939/implementation-of-sinpi-and-cospi-using-standard-c-math-library +*/ +void my_sincospi(double a, double *sp, double *cp) +{ + double c, r, s, t, az; + int64_t i; + + az = a * 0.0; // must be evaluated with IEEE-754 semantics + /* for |a| >= 2**53, cospi(a) = 1.0, but cospi(Inf) = NaN */ + a = (fabs(a) < 9.0071992547409920e+15) ? a : az; // 0x1.0p53 + /* reduce argument to primary approximation interval (-0.25, 0.25) */ + r = nearbyint(a + a); // must use IEEE-754 "to nearest" rounding + i = (int64_t)r; + t = fma(-0.5, r, a); + /* compute core approximations */ + s = t * t; + /* Approximate cos(pi*x) for x in [-0.25,0.25] */ + r = -1.0369917389758117e-4; + r = fma(r, s, 1.9294935641298806e-3); + r = fma(r, s, -2.5806887942825395e-2); + r = fma(r, s, 2.3533063028328211e-1); + r = fma(r, s, -1.3352627688538006e+0); + r = fma(r, s, 4.0587121264167623e+0); + r = fma(r, s, -4.9348022005446790e+0); + c = fma(r, s, 1.0000000000000000e+0); + /* Approximate sin(pi*x) for x in [-0.25,0.25] */ + r = 4.6151442520157035e-4; + r = fma(r, s, -7.3700183130883555e-3); + r = fma(r, s, 8.2145868949323936e-2); + r = fma(r, s, -5.9926452893214921e-1); + r = fma(r, s, 2.5501640398732688e+0); + r = fma(r, s, -5.1677127800499516e+0); + s = s * t; + r = r * s; + s = fma(t, 3.1415926535897931e+0, r); + /* map results according to quadrant */ + if (i & 2) { + s = 0.0 - s; // must be evaluated with IEEE-754 semantics + c = 0.0 - c; // must be evaluated with IEEE-754 semantics + } + if (i & 1) { + t = 0.0 - s; // must be evaluated with IEEE-754 semantics + s = c; + c = t; + } + /* IEEE-754: sinPi(+n) is +0 and sinPi(-n) is -0 for native integers n */ + if (a == floor(a)) s = az; + *sp = s; + *cp = c; +} + +double sinpi(double arg) { + double s, c; + my_sincospi(arg, &s, &c); + return s; +} + +double cospi(double arg) { + double s, c; + my_sincospi(arg, &s, &c); + return c; +} + +#ifdef CPP17_HEXFLOAT_LITERALS +/* +Writes result sine result sin(Ï€a) to the location pointed to by sp +Writes result cosine result cos(Ï€a) to the location pointed to by cp + +In exhaustive testing, the maximum error in sine results was 0.96677 ulp, +the maximum error in cosine results was 0.96563 ulp, meaning results are +faithfully rounded. +*/ +void my_sincospif(float a, float *sp, float *cp) +{ + float az, t, c, r, s; + int32_t i; + + az = a * 0.0f; // must be evaluated with IEEE-754 semantics + /* for |a| > 2**24, cospi(a) = 1.0f, but cospi(Inf) = NaN */ + a = (fabsf(a) < 0x1.0p24f) ? a : az; + r = nearbyintf(a + a); // must use IEEE-754 "to nearest" rounding + i = (int32_t)r; + t = fmaf(-0.5f, r, a); + /* compute core approximations */ + s = t * t; + /* Approximate cos(pi*x) for x in [-0.25,0.25] */ + r = 0x1.d9e000p-3f; + r = fmaf(r, s, -0x1.55c400p+0f); + r = fmaf(r, s, 0x1.03c1cep+2f); + r = fmaf(r, s, -0x1.3bd3ccp+2f); + c = fmaf(r, s, 0x1.000000p+0f); + /* Approximate sin(pi*x) for x in [-0.25,0.25] */ + r = -0x1.310000p-1f; + r = fmaf(r, s, 0x1.46737ep+1f); + r = fmaf(r, s, -0x1.4abbfep+2f); + r = (t * s) * r; + s = fmaf(t, 0x1.921fb6p+1f, r); + if (i & 2) { + s = 0.0f - s; // must be evaluated with IEEE-754 semantics + c = 0.0f - c; // must be evaluated with IEEE-754 semantics + } + if (i & 1) { + t = 0.0f - s; // must be evaluated with IEEE-754 semantics + s = c; + c = t; + } + /* IEEE-754: sinPi(+n) is +0 and sinPi(-n) is -0 for native floats n */ + if (a == floorf(a)) s = az; + *sp = s; + *cp = c; +} +#endif + +/* +This function computes the great-circle distance of two points on earth +using the Haversine formula, assuming spherical shape of the planet. A +well-known numerical issue with the formula is reduced accuracy in the +case of near antipodal points. + +lat1, lon1 latitude and longitude of first point, in degrees [-90,+90] +lat2, lon2 latitude and longitude of second point, in degrees [-180,+180] +radius radius of the earth in user-defined units, e.g. 6378.2 km or +3963.2 miles + +returns: distance of the two points, in the same units as radius + +Reference: http://en.wikipedia.org/wiki/Great-circle_distance +*/ +double haversine(double lat1, double lon1, double lat2, double lon2, double radius) { + double dlat, dlon, c1, c2, d1, d2, a, c, t; + + c1 = cospi(lat1 / 180.0); + c2 = cospi(lat2 / 180.0); + dlat = lat2 - lat1; + dlon = lon2 - lon1; + d1 = sinpi(dlat / 360.0); + d2 = sinpi(dlon / 360.0); + t = d2 * d2 * c1 * c2; + a = d1 * d1 + t; + c = 2.0 * asin(fmin(1.0, sqrt(a))); + return radius * c; +} + +// 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 +template +void GenerateTestCase(Ty a) { + Ty ref; + sw::universal::lns pa, pref, psin; + pa = a; + ref = std::sin(a); + pref = ref; + psin = sw::universal::sin(pa); + std::cout << std::setprecision(nbits - 2); + std::cout << std::setw(nbits) << a << " -> sin(" << a << ") = " << std::setw(nbits) << ref << std::endl; + std::cout << sw::universal::to_binary(pa) << " -> sin( " << pa << ") = " << sw::universal::to_binary(psin) << " (reference: " << sw::universal::to_binary(pref) << ") " ; + std::cout << (pref == psin ? "PASS" : "FAIL") << std::endl << std::endl; + std::cout << std::setprecision(5); +} + +#define MANUAL_TESTING 0 + +int main() +try { + using namespace sw::universal; + + std::string test_suite = "lns<> mathlib trigonometry validation"; + std::string test_tag = "trigonometry"; + bool reportTestCases = false; + int nrOfFailedTestCases = 0; + + ReportTestSuiteHeader(test_suite, reportTestCases); + +#if MANUAL_TESTING + // generate individual testcases to hand trace/debug +// GenerateTestCase<8, 0, double>(m_pi); +// GenerateTestCase<16, 1, double>(m_pi); +// GenerateTestCase<32, 2, double>(m_pi); +// GenerateTestCase<64, 3, float>(m_pi); +// GenerateTestCase<128, 4, float>(m_pi); +// GenerateTestCase<256, 5, float>(m_pi); + + std::cout << "Standard sin(pi/2) : " << std::sin(m_pi*0.5) << " vs sinpi(0.5): " << sinpi(0.5) << '\n'; + std::cout << "Standard sin(pi) : " << std::sin(m_pi) << " vs sinpi(1.0): " << sinpi(1.0) << '\n'; + std::cout << "Standard sin(3pi/2): " << std::sin(m_pi*1.5) << " vs sinpi(1.5): " << sinpi(1.5) << '\n'; + std::cout << "Standard sin(2pi) : " << std::sin(m_pi*2) << " vs sinpi(2.0): " << sinpi(2.0) << '\n'; + + std::cout << "haversine(0.0, 0.0, 90.0, 0.0, 1.0) = " << haversine(0.0, 0.0, 90.0, 0.0, 1.0) << '\n'; + std::cout << "haversine(0.0, 0.0, 180.0, 0.0, 1.0) = " << haversine(0.0, 0.0, 180, 0.0, 1.0) << '\n'; + + GenerateTestCase<16, 1, uint16_t, true, true, false, double>(m_pi_2); + + nrOfFailedTestCases += ReportTestResult(VerifySine < lns<8, 2> >(reportTestCases), "lns<8,2>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifyCosine < lns<8, 2> >(reportTestCases), "lns<8,2>", "cos"); + nrOfFailedTestCases += ReportTestResult(VerifyTangent< lns<8, 2> >(reportTestCases), "lns<8,2>", "tan"); + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; // ignore failures in manual testing mode +#else + + nrOfFailedTestCases += ReportTestResult(VerifySine < lns<8, 2, Saturating, uint8_t> >(reportTestCases), "lns< 8,2>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifyCosine < lns<8, 2, Saturating, uint8_t> >(reportTestCases), "lns< 8,2>", "cos"); + nrOfFailedTestCases += ReportTestResult(VerifyTangent< lns<8, 2, Saturating, uint8_t> >(reportTestCases), "lns< 8,2>", "tan"); + nrOfFailedTestCases += ReportTestResult(VerifyAtan < lns<8, 2, Saturating, uint8_t> >(reportTestCases), "lns< 8,2>", "atan"); + nrOfFailedTestCases += ReportTestResult(VerifyAsin < lns<8, 2, Saturating, uint8_t> >(reportTestCases), "lns< 8,2>", "asin"); + nrOfFailedTestCases += ReportTestResult(VerifyAcos < lns<8, 2, Saturating, uint8_t> >(reportTestCases), "lns< 8,2>", "acos"); + + // nbits=64 requires long double compiler support + // nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(reportTestCases, OPCODE_SQRT, 1000), "lns<64,2>", "sin"); + + nrOfFailedTestCases += ReportTestResult(VerifySine < lns<16, 5> >(reportTestCases), "lns<16,5>", "sin"); + nrOfFailedTestCases += ReportTestResult(VerifyCosine < lns<16, 5> >(reportTestCases), "lns<16,5>", "cos"); + nrOfFailedTestCases += ReportTestResult(VerifyTangent< lns<16, 5> >(reportTestCases), "lns<16,5>", "tan"); + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + +#endif // MANUAL_TESTING +} +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 (const std::runtime_error& err) { + std::cerr << "Caught runtime exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} diff --git a/tests/lns/math/truncate.cpp b/tests/lns/math/truncate.cpp new file mode 100644 index 000000000..95069855d --- /dev/null +++ b/tests/lns/math/truncate.cpp @@ -0,0 +1,145 @@ +// truncate.cpp: test suite runner for truncation functions trunc, round, floor, and ceil +// +// 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 +// use default number system library configuration +#include +#include + +namespace sw { namespace universal { + +template +int VerifyFloor(bool reportTestCases) { + using namespace sw::universal; + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_VALUES = (1ull << nbits); + int nrOfFailedTestCases = 0; + + TestType a; + for (size_t i = 0; i < NR_VALUES; ++i) { + a.setbits(i); + TestType l1 = floor(a); + // generate the reference + float f = float(a); // we can stay with floats as the state space NR_VALUES is always going to be small to be practical (nbits < 16) + float ff = std::floor(f); + TestType l2 = ff; + if (l1 != l2) { + if (a.isnan() || l1.isnan()) continue; + std::cout << to_binary(a) << " : " << a << '\n'; + std::cout << "floor(" << f << ") = " << l2 << " vs result " << l1 << '\n'; + ++nrOfFailedTestCases; + if (reportTestCases) ReportOneInputFunctionError("floor", "floor", a, l1, l2); + } + } + return nrOfFailedTestCases; +} + +template +int VerifyCeil(bool reportTestCases) { + using namespace sw::universal; + constexpr size_t nbits = TestType::nbits; + constexpr size_t NR_VALUES = (1ull << nbits); + int nrOfFailedTestCases = 0; + + TestType a; + for (size_t i = 0; i < NR_VALUES; ++i) { + a.setbits(i); + TestType l1 = ceil(a); + // generate the reference + float f = float(a); + float cf = std::ceil(f); + TestType l2 = cf; + if (l1 != l2) { + if (a.isnan() || l1.isnan()) continue; + std::cout << to_binary(a) << " : " << a << '\n'; + std::cout << "ceil(" << f << ") = " << l2 << " vs result " << l1 << '\n'; + ++nrOfFailedTestCases; + if (reportTestCases) ReportOneInputFunctionError("ceil", "ceil", a, l1, l2); + } + } + return nrOfFailedTestCases; +} + +} } // namespace sw::universal + +// 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; + + std::string test_suite = "lnsfloat<> mathlib truncation validation"; + std::string test_tag = "truncation"; + bool reportTestCases = false; + int nrOfFailedTestCases = 0; + + ReportTestSuiteHeader(test_suite, reportTestCases); + +#if MANUAL_TESTING + // generate individual testcases to hand trace/debug + + nrOfFailedTestCases = ReportTestResult(VerifyFloor< lns<8, 2, Saturating, uint8_t> >(reportTestCases), "floor", "lns<8,2>"); + nrOfFailedTestCases = ReportTestResult(VerifyCeil < lns<8, 2, Saturating, uint8_t> >(reportTestCases), "ceil ", "lns<8,2>"); + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; // ignore failures in manual testing mode +#else + +#if REGRESSION_LEVEL_1 + nrOfFailedTestCases = ReportTestResult(VerifyFloor< lns<8, 2, Saturating, uint8_t> >(reportTestCases), "floor", "lns<8,2>"); + nrOfFailedTestCases = ReportTestResult(VerifyCeil < lns<8, 2, Saturating, uint8_t> >(reportTestCases), "ceil ", "lns<8,2>"); + +#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 << "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 (const std::runtime_error& err) { + std::cerr << "Caught runtime exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} diff --git a/tests/lns/performance/perf.cpp b/tests/lns/performance/perf.cpp index 9819abcbb..59031f69c 100644 --- a/tests/lns/performance/perf.cpp +++ b/tests/lns/performance/perf.cpp @@ -119,34 +119,34 @@ namespace sw::universal::internal { std::cout << "\nArithmetic operator performance\n"; size_t NR_OPS = 1024ull * 1024ull; - PerformanceRunner("lns< 4, 1, uint8_t > add/subtract ", AdditionSubtractionWorkload< lns< 4, 1, uint8_t> >, NR_OPS); - PerformanceRunner("lns< 8, 3, uint8_t > add/subtract ", AdditionSubtractionWorkload< lns< 8, 3, uint8_t> >, NR_OPS); - PerformanceRunner("lns<12, 4, uint8_t > add/subtract ", AdditionSubtractionWorkload< lns<12, 4, uint8_t> >, NR_OPS); - PerformanceRunner("lns<12, 4, uint16_t> add/subtract ", AdditionSubtractionWorkload< lns<12, 4, uint16_t> >, NR_OPS); - PerformanceRunner("lns<16, 5, uint16_t> add/subtract ", AdditionSubtractionWorkload< lns<16, 5, uint16_t> >, NR_OPS); - PerformanceRunner("lns<16, 5, uint32_t> add/subtract ", AdditionSubtractionWorkload< lns<16, 5, uint32_t> >, NR_OPS); - PerformanceRunner("lns<20, 6, uint32_t> add/subtract ", AdditionSubtractionWorkload< lns<20, 6, uint32_t> >, NR_OPS); - PerformanceRunner("lns<32, 8, uint32_t> add/subtract ", AdditionSubtractionWorkload< lns<32, 8, uint32_t> >, NR_OPS); + PerformanceRunner("lns< 4, 1, Saturating, uint8_t > add/subtract ", AdditionSubtractionWorkload< lns< 4, 1, Saturating, uint8_t> >, NR_OPS); + PerformanceRunner("lns< 8, 3, Saturating, uint8_t > add/subtract ", AdditionSubtractionWorkload< lns< 8, 3, Saturating, uint8_t> >, NR_OPS); + PerformanceRunner("lns<12, 4, Saturating, uint8_t > add/subtract ", AdditionSubtractionWorkload< lns<12, 4, Saturating, uint8_t> >, NR_OPS); + PerformanceRunner("lns<12, 4, Saturating, uint16_t> add/subtract ", AdditionSubtractionWorkload< lns<12, 4, Saturating, uint16_t> >, NR_OPS); + PerformanceRunner("lns<16, 5, Saturating, uint16_t> add/subtract ", AdditionSubtractionWorkload< lns<16, 5, Saturating, uint16_t> >, NR_OPS); + PerformanceRunner("lns<16, 5, Saturating, uint32_t> add/subtract ", AdditionSubtractionWorkload< lns<16, 5, Saturating, uint32_t> >, NR_OPS); + PerformanceRunner("lns<20, 6, Saturating, uint32_t> add/subtract ", AdditionSubtractionWorkload< lns<20, 6, Saturating, uint32_t> >, NR_OPS); + PerformanceRunner("lns<32, 8, Saturating, uint32_t> add/subtract ", AdditionSubtractionWorkload< lns<32, 8, Saturating, uint32_t> >, NR_OPS); NR_OPS = 1024ull * 1024ull; - PerformanceRunner("lns< 4, 1, uint8_t > multiplication ", MultiplicationWorkload< lns< 4, 1, uint8_t> >, NR_OPS); - PerformanceRunner("lns< 8, 3, uint8_t > multiplication ", MultiplicationWorkload< lns< 8, 3, uint8_t> >, NR_OPS); - PerformanceRunner("lns<12, 4, uint8_t > multiplication ", MultiplicationWorkload< lns<12, 4, uint8_t> >, NR_OPS); - PerformanceRunner("lns<12, 4, uint16_t> multiplication ", MultiplicationWorkload< lns<12, 4, uint16_t> >, NR_OPS); - PerformanceRunner("lns<16, 5, uint16_t> multiplication ", MultiplicationWorkload< lns<16, 5, uint16_t> >, NR_OPS); - PerformanceRunner("lns<16, 5, uint32_t> multiplication ", MultiplicationWorkload< lns<16, 5, uint32_t> >, NR_OPS); - PerformanceRunner("lns<20, 6, uint32_t> multiplication ", MultiplicationWorkload< lns<20, 6, uint32_t> >, NR_OPS); - PerformanceRunner("lns<32, 8, uint32_t> multiplication ", MultiplicationWorkload< lns<32, 8, uint32_t> >, NR_OPS); + PerformanceRunner("lns< 4, 1, Saturating, uint8_t > multiplication ", MultiplicationWorkload< lns< 4, 1, Saturating, uint8_t> >, NR_OPS); + PerformanceRunner("lns< 8, 3, Saturating, uint8_t > multiplication ", MultiplicationWorkload< lns< 8, 3, Saturating, uint8_t> >, NR_OPS); + PerformanceRunner("lns<12, 4, Saturating, uint8_t > multiplication ", MultiplicationWorkload< lns<12, 4, Saturating, uint8_t> >, NR_OPS); + PerformanceRunner("lns<12, 4, Saturating, uint16_t> multiplication ", MultiplicationWorkload< lns<12, 4, Saturating, uint16_t> >, NR_OPS); + PerformanceRunner("lns<16, 5, Saturating, uint16_t> multiplication ", MultiplicationWorkload< lns<16, 5, Saturating, uint16_t> >, NR_OPS); + PerformanceRunner("lns<16, 5, Saturating, uint32_t> multiplication ", MultiplicationWorkload< lns<16, 5, Saturating, uint32_t> >, NR_OPS); + PerformanceRunner("lns<20, 6, Saturating, uint32_t> multiplication ", MultiplicationWorkload< lns<20, 6, Saturating, uint32_t> >, NR_OPS); + PerformanceRunner("lns<32, 8, Saturating, uint32_t> multiplication ", MultiplicationWorkload< lns<32, 8, Saturating, uint32_t> >, NR_OPS); NR_OPS = 1024ull * 1024ull; - PerformanceRunner("lns< 4, 1, uint8_t > division ", DivisionWorkload< lns< 4, 1, uint8_t> >, NR_OPS); - PerformanceRunner("lns< 8, 3, uint8_t > division ", DivisionWorkload< lns< 8, 3, uint8_t> >, NR_OPS); - PerformanceRunner("lns<12, 4, uint8_t > division ", DivisionWorkload< lns<12, 4, uint8_t> >, NR_OPS); - PerformanceRunner("lns<12, 4, uint16_t> division ", DivisionWorkload< lns<12, 4, uint16_t> >, NR_OPS); - PerformanceRunner("lns<16, 5, uint16_t> division ", DivisionWorkload< lns<16, 5, uint16_t> >, NR_OPS); - PerformanceRunner("lns<16, 5, uint32_t> division ", DivisionWorkload< lns<16, 5, uint32_t> >, NR_OPS); - PerformanceRunner("lns<20, 6, uint32_t> division ", DivisionWorkload< lns<20, 6, uint32_t> >, NR_OPS); - PerformanceRunner("lns<32, 8, uint32_t> division ", DivisionWorkload< lns<32, 8, uint32_t> >, NR_OPS); + PerformanceRunner("lns< 4, 1, Saturating, uint8_t > division ", DivisionWorkload< lns< 4, 1, Saturating, uint8_t> >, NR_OPS); + PerformanceRunner("lns< 8, 3, Saturating, uint8_t > division ", DivisionWorkload< lns< 8, 3, Saturating, uint8_t> >, NR_OPS); + PerformanceRunner("lns<12, 4, Saturating, uint8_t > division ", DivisionWorkload< lns<12, 4, Saturating, uint8_t> >, NR_OPS); + PerformanceRunner("lns<12, 4, Saturating, uint16_t> division ", DivisionWorkload< lns<12, 4, Saturating, uint16_t> >, NR_OPS); + PerformanceRunner("lns<16, 5, Saturating, uint16_t> division ", DivisionWorkload< lns<16, 5, Saturating, uint16_t> >, NR_OPS); + PerformanceRunner("lns<16, 5, Saturating, uint32_t> division ", DivisionWorkload< lns<16, 5, Saturating, uint32_t> >, NR_OPS); + PerformanceRunner("lns<20, 6, Saturating, uint32_t> division ", DivisionWorkload< lns<20, 6, Saturating, uint32_t> >, NR_OPS); + PerformanceRunner("lns<32, 8, Saturating, uint32_t> division ", DivisionWorkload< lns<32, 8, Saturating, uint32_t> >, NR_OPS); } @@ -176,25 +176,25 @@ namespace sw::universal::internal { std::cout << "\nArithmetic operator performance\n"; size_t NR_OPS = 1024ull * 1024ull; - PerformanceRunner("lns< 8, 2, uint8_t > add/subtract ", AdditionSubtractionWorkload< lns< 8, 2, uint8_t> >, NR_OPS); - PerformanceRunner("lns< 16, 5, uint16_t> add/subtract ", AdditionSubtractionWorkload< lns< 16, 5, uint16_t> >, NR_OPS); - PerformanceRunner("lns< 32, 8, uint32_t> add/subtract ", AdditionSubtractionWorkload< lns< 32, 8, uint32_t> >, NR_OPS); - PerformanceRunner("lns< 64,11, uint32_t> add/subtract ", AdditionSubtractionWorkload< lns< 64, 11, uint32_t> >, NR_OPS); - PerformanceRunner("lns<128,15, uint32_t> add/subtract ", AdditionSubtractionWorkload< lns<128, 15, uint32_t> >, NR_OPS / 2); + PerformanceRunner("lns< 8, 2, Saturating, uint8_t > add/subtract ", AdditionSubtractionWorkload< lns< 8, 2, Saturating, uint8_t> >, NR_OPS); + PerformanceRunner("lns< 16, 5, Saturating, uint16_t> add/subtract ", AdditionSubtractionWorkload< lns< 16, 5, Saturating, uint16_t> >, NR_OPS); + PerformanceRunner("lns< 32, 8, Saturating, uint32_t> add/subtract ", AdditionSubtractionWorkload< lns< 32, 8, Saturating, uint32_t> >, NR_OPS); + PerformanceRunner("lns< 64,11, Saturating, uint32_t> add/subtract ", AdditionSubtractionWorkload< lns< 64, 11, Saturating, uint32_t> >, NR_OPS); + PerformanceRunner("lns<128,15, Saturating, uint32_t> add/subtract ", AdditionSubtractionWorkload< lns<128, 15, Saturating, uint32_t> >, NR_OPS / 2); NR_OPS = 1024ull * 1024ull; - PerformanceRunner("lns< 8, 2, uint8_t > multiplication", MultiplicationWorkload< lns< 8, 2, uint8_t> >, NR_OPS); - PerformanceRunner("lns< 16, 5, uint16_t> multiplication", MultiplicationWorkload< lns< 16, 5, uint16_t> >, NR_OPS); - PerformanceRunner("lns< 32, 8, uint32_t> multiplication", MultiplicationWorkload< lns< 32, 8, uint32_t> >, NR_OPS); - PerformanceRunner("lns< 64,11, uint32_t> multiplication", MultiplicationWorkload< lns< 64, 11, uint32_t> >, NR_OPS); - PerformanceRunner("lns<128,15, uint32_t> multiplication", MultiplicationWorkload< lns<128, 15, uint32_t> >, NR_OPS); + PerformanceRunner("lns< 8, 2, Saturating, uint8_t > multiplication", MultiplicationWorkload< lns< 8, 2, Saturating, uint8_t> >, NR_OPS); + PerformanceRunner("lns< 16, 5, Saturating, uint16_t> multiplication", MultiplicationWorkload< lns< 16, 5, Saturating, uint16_t> >, NR_OPS); + PerformanceRunner("lns< 32, 8, Saturating, uint32_t> multiplication", MultiplicationWorkload< lns< 32, 8, Saturating, uint32_t> >, NR_OPS); + PerformanceRunner("lns< 64,11, Saturating, uint32_t> multiplication", MultiplicationWorkload< lns< 64, 11, Saturating, uint32_t> >, NR_OPS); + PerformanceRunner("lns<128,15, Saturating, uint32_t> multiplication", MultiplicationWorkload< lns<128, 15, Saturating, uint32_t> >, NR_OPS); NR_OPS = 1024ull * 1024ull; - PerformanceRunner("lns< 8, 2, uint8_t > division ", DivisionWorkload< lns< 8, 2, uint8_t> >, NR_OPS); - PerformanceRunner("lns< 16, 5, uint16_t> division ", DivisionWorkload< lns< 16, 5, uint16_t> >, NR_OPS); - PerformanceRunner("lns< 32, 8, uint32_t> division ", DivisionWorkload< lns< 32, 8, uint32_t> >, NR_OPS); - PerformanceRunner("lns< 64,11, uint32_t> division ", DivisionWorkload< lns< 64, 11, uint32_t> >, NR_OPS); - PerformanceRunner("lns<128,15, uint32_t> division ", DivisionWorkload< lns<128, 15, uint32_t> >, NR_OPS); + PerformanceRunner("lns< 8, 2, Saturating, uint8_t > division ", DivisionWorkload< lns< 8, 2, Saturating, uint8_t> >, NR_OPS); + PerformanceRunner("lns< 16, 5, Saturating, uint16_t> division ", DivisionWorkload< lns< 16, 5, Saturating, uint16_t> >, NR_OPS); + PerformanceRunner("lns< 32, 8, Saturating, uint32_t> division ", DivisionWorkload< lns< 32, 8, Saturating, uint32_t> >, NR_OPS); + PerformanceRunner("lns< 64,11, Saturating, uint32_t> division ", DivisionWorkload< lns< 64, 11, Saturating, uint32_t> >, NR_OPS); + PerformanceRunner("lns<128,15, Saturating, uint32_t> division ", DivisionWorkload< lns<128, 15, Saturating, uint32_t> >, NR_OPS); } /* @@ -217,17 +217,17 @@ namespace sw::universal::internal { constexpr size_t NR_OPS = 32ull * 1024ull * 1024ull; - PerformanceRunner("lns< 8, 2, uint8_t> assignment/copy ", AssignmentCopyWorkload< lns< 8, 2, uint8_t> >, NR_OPS); - PerformanceRunner("lns<16, 5, uint8_t> assignment/copy ", AssignmentCopyWorkload< lns<16, 5, uint8_t> >, NR_OPS); - PerformanceRunner("lns<32, 8, uint8_t> assignment/copy ", AssignmentCopyWorkload< lns<32, 8, uint8_t> >, NR_OPS); + PerformanceRunner("lns< 8, 2, Saturating, uint8_t> assignment/copy ", AssignmentCopyWorkload< lns< 8, 2, Saturating, uint8_t> >, NR_OPS); + PerformanceRunner("lns<16, 5, Saturating, uint8_t> assignment/copy ", AssignmentCopyWorkload< lns<16, 5, Saturating, uint8_t> >, NR_OPS); + PerformanceRunner("lns<32, 8, Saturating, uint8_t> assignment/copy ", AssignmentCopyWorkload< lns<32, 8, Saturating, uint8_t> >, NR_OPS); - PerformanceRunner("lns< 8, 2, uint32_t> assignment/copy ", AssignmentCopyWorkload< lns< 8, 2, uint32_t> >, NR_OPS); - PerformanceRunner("lns<16, 5, uint32_t> assignment/copy ", AssignmentCopyWorkload< lns<16, 5, uint32_t> >, NR_OPS); - PerformanceRunner("lns<32, 8, uint32_t> assignment/copy ", AssignmentCopyWorkload< lns<32, 8, uint32_t> >, NR_OPS); + PerformanceRunner("lns< 8, 2, Saturating, uint32_t> assignment/copy ", AssignmentCopyWorkload< lns< 8, 2, Saturating, uint32_t> >, NR_OPS); + PerformanceRunner("lns<16, 5, Saturating, uint32_t> assignment/copy ", AssignmentCopyWorkload< lns<16, 5, Saturating, uint32_t> >, NR_OPS); + PerformanceRunner("lns<32, 8, Saturating, uint32_t> assignment/copy ", AssignmentCopyWorkload< lns<32, 8, Saturating, uint32_t> >, NR_OPS); - PerformanceRunner("lns< 8, 2, uint64_t> assignment/copy ", AssignmentCopyWorkload< lns< 8, 2, uint64_t> >, NR_OPS); - PerformanceRunner("lns<16, 5, uint64_t> assignment/copy ", AssignmentCopyWorkload< lns<16, 5, uint64_t> >, NR_OPS); - PerformanceRunner("lns<32, 8, uint64_t> assignment/copy ", AssignmentCopyWorkload< lns<32, 8, uint64_t> >, NR_OPS); + PerformanceRunner("lns< 8, 2, Saturating, uint64_t> assignment/copy ", AssignmentCopyWorkload< lns< 8, 2, Saturating, uint64_t> >, NR_OPS); + PerformanceRunner("lns<16, 5, Saturating, uint64_t> assignment/copy ", AssignmentCopyWorkload< lns<16, 5, Saturating, uint64_t> >, NR_OPS); + PerformanceRunner("lns<32, 8, Saturating, uint64_t> assignment/copy ", AssignmentCopyWorkload< lns<32, 8, Saturating, uint64_t> >, NR_OPS); } } diff --git a/tests/posit/api/assignment.cpp b/tests/posit/api/assignment.cpp deleted file mode 100644 index e210c9b16..000000000 --- a/tests/posit/api/assignment.cpp +++ /dev/null @@ -1,146 +0,0 @@ -// assignment.cpp : test suite runner for native type literal assignments for posits -// -// Copyright (C) 2017-2021 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 - -#ifdef DEPRECATED -#define FLOAT_TABLE_WIDTH 20 - -template -void ReportAssignmentError(const std::string& test_case, const std::string& op, const sw::universal::posit& pref, const sw::universal::posit& presult, const Ty& value) { - std::cerr << test_case - << " " << op << " " - << std::setw(FLOAT_TABLE_WIDTH) << value - << " != " - << std::setw(FLOAT_TABLE_WIDTH) << pref << " instead it yielded " - << std::setw(FLOAT_TABLE_WIDTH) << presult - << " " << presult.get() << " vs " << pref.get() << std::endl; -} - -template -void ReportAssignmentSuccess(const std::string& test_case, const std::string& op, const sw::universal::posit& pref, const sw::universal::posit& presult, const Ty& value) { - std::cerr << test_case - << " " << op << " " - << std::setw(FLOAT_TABLE_WIDTH) << value - << " == " - << std::setw(FLOAT_TABLE_WIDTH) << presult << " reference value is " - << std::setw(FLOAT_TABLE_WIDTH) << pref - << " posit fields " << sw::universal::pretty_print(presult) << std::endl; -} -#endif - -template -Ty GenerateValue(const sw::universal::posit& p) { - Ty value = 0; - if (std::numeric_limits::is_exact) { - if (std::numeric_limits::is_signed) { - value = (long long)(p); - } - else { - value = (unsigned long long)(p); - } - } - else { - value = (long double)(p); - } - return value; -} - -template -int ValidateAssignment(bool bReportIndividualTestCases) { - 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 - sw::universal::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; - // TODO: how to make this work for integers: std::cout << p << " " << value << " " << assigned << std::endl; - if (p != assigned) { - nrOfFailedTestCases++; - if (bReportIndividualTestCases) ReportAssignmentError("FAIL", "=", p, assigned, value); - } - else { - //if (bReportIndividualTestCases) ReportAssignmentSuccess("PASS", "=", p, assigned, value); - } - } - return nrOfFailedTestCases; -} - -int main() -try { - using namespace sw::universal; - - bool bReportIndividualTestCases = true; - int nrOfFailedTestCases = 0; - std::string tag = "Assignment"; - - // - // TODO: How to make this work for integers - // nrOfFailedTestCases = ReportTestResult(ValidateAssignment<3, 0, int>(bReportIndividualTestCases), tag, "posit<3,0> int"); - - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<3, 0, float>(bReportIndividualTestCases), tag, "posit<3,0>"); - - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<4, 0, float>(bReportIndividualTestCases), tag, "posit<4,0>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<4, 1, float>(bReportIndividualTestCases), tag, "posit<4,1>"); - - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<5, 0, float>(bReportIndividualTestCases), tag, "posit<5,0>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<5, 1, float>(bReportIndividualTestCases), tag, "posit<5,1>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<5, 2, float>(bReportIndividualTestCases), tag, "posit<5,2>"); - - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<6, 0, float>(bReportIndividualTestCases), tag, "posit<6,0>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<6, 1, float>(bReportIndividualTestCases), tag, "posit<6,1>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<6, 2, float>(bReportIndividualTestCases), tag, "posit<6,2>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<6, 3, float>(bReportIndividualTestCases), tag, "posit<6,3>"); - - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<7, 0, float>(bReportIndividualTestCases), tag, "posit<7,0>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<7, 1, float>(bReportIndividualTestCases), tag, "posit<7,1>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<7, 2, float>(bReportIndividualTestCases), tag, "posit<7,2>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<7, 3, float>(bReportIndividualTestCases), tag, "posit<7,3>"); - - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<8, 0, float>(bReportIndividualTestCases), tag, "posit<8,0>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<8, 1, float>(bReportIndividualTestCases), tag, "posit<8,1>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<8, 2, float>(bReportIndividualTestCases), tag, "posit<8,2>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<8, 3, float>(bReportIndividualTestCases), tag, "posit<8,3>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<8, 4, float>(bReportIndividualTestCases), tag, "posit<8,4>"); - - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<9, 0, float>(bReportIndividualTestCases), tag, "posit<9,0>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<9, 1, float>(bReportIndividualTestCases), tag, "posit<9,1>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<9, 2, float>(bReportIndividualTestCases), tag, "posit<9,2>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<9, 3, float>(bReportIndividualTestCases), tag, "posit<9,3>"); - nrOfFailedTestCases = ReportTestResult(ValidateAssignment<9, 4, float>(bReportIndividualTestCases), tag, "posit<9,4>"); - - return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); -} -catch (char const* msg) { - std::cerr << msg << std::endl; - return EXIT_FAILURE; -} -catch (const sw::universal::posit_arithmetic_exception& err) { - std::cerr << "Uncaught posit arithmetic exception: " << err.what() << std::endl; - return EXIT_FAILURE; -} -catch (const sw::universal::posit_internal_exception& err) { - std::cerr << "Uncaught posit internal exception: " << err.what() << std::endl; - return EXIT_FAILURE; -} -catch (const std::runtime_error& err) { - std::cerr << "Uncaught runtime exception: " << err.what() << std::endl; - return EXIT_FAILURE; -} -catch (...) { - std::cerr << "Caught unknown exception" << std::endl; - return EXIT_FAILURE; -} - - - diff --git a/tests/posit/arithmetic/addition.cpp b/tests/posit/arithmetic/addition.cpp index 61e14779a..399f4fe2c 100644 --- a/tests/posit/arithmetic/addition.cpp +++ b/tests/posit/arithmetic/addition.cpp @@ -1,9 +1,9 @@ -// arithmetic_add.cpp: test suite runner for posit addition +// addition.cpp: test suite runner for posit addition // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 // Configure the posit template environment // first: enable general or specialized posit configurations //#define POSIT_FAST_SPECIALIZATION @@ -13,13 +13,8 @@ // when you define POSIT_VERBOSE_OUTPUT executing an ADD the code will print intermediate results //#define POSIT_VERBOSE_OUTPUT #define POSIT_TRACE_ADD - -// minimum set of include files to reflect source code dependencies -#include -#include -#include -#include -#include +#include +#include #include #include @@ -58,15 +53,16 @@ void GenerateTestCase(Ty a, Ty b) { #define REGRESSION_LEVEL_4 1 #endif -int main(int argc, char** argv) +int main() try { using namespace sw::universal; - std::cout << "Posit addition validation\n"; - bool bReportIndividualTestCases = false; + std::string test_suite = "posit addition validation"; + std::string test_tag = "addition"; + bool reportTestCases = false; int nrOfFailedTestCases = 0; - std::string tag = "Addition failed: "; + ReportTestSuiteHeader(test_suite, reportTestCases); #if MANUAL_TESTING // generate individual testcases to hand trace/debug @@ -82,85 +78,88 @@ try { // 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"); - + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyAddition<2, 0>(bReportIndividualTestCases), "posit< 2,0>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<3, 0>(bReportIndividualTestCases), "posit< 3,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<3, 1>(bReportIndividualTestCases), "posit< 3,1>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 0>(bReportIndividualTestCases), "posit< 4,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 1>(bReportIndividualTestCases), "posit< 4,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<4, 2>(bReportIndividualTestCases), "posit< 4,2>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<5, 0>(bReportIndividualTestCases), "posit< 5,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<5, 1>(bReportIndividualTestCases), "posit< 5,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<5, 2>(bReportIndividualTestCases), "posit< 5,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<5, 3>(bReportIndividualTestCases), "posit< 5,3>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<6, 0>(bReportIndividualTestCases), "posit< 6,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<6, 1>(bReportIndividualTestCases), "posit< 6,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<6, 2>(bReportIndividualTestCases), "posit< 6,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<6, 3>(bReportIndividualTestCases), "posit< 6,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<6, 4>(bReportIndividualTestCases), "posit< 6,4>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 0>(bReportIndividualTestCases), "posit< 7,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 1>(bReportIndividualTestCases), "posit< 7,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 2>(bReportIndividualTestCases), "posit< 7,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 3>(bReportIndividualTestCases), "posit< 7,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 4>(bReportIndividualTestCases), "posit< 7,4>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<7, 5>(bReportIndividualTestCases), "posit< 7,5>", "addition"); - - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 0>(bReportIndividualTestCases), "posit< 8,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 1>(bReportIndividualTestCases), "posit< 8,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 2>(bReportIndividualTestCases), "posit< 8,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 3>(bReportIndividualTestCases), "posit< 8,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 4>(bReportIndividualTestCases), "posit< 8,4>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 5>(bReportIndividualTestCases), "posit< 8,5>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<8, 6>(bReportIndividualTestCases), "posit< 8,6>", "addition"); + 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"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 0>(bReportIndividualTestCases), "posit<10,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 1>(bReportIndividualTestCases), "posit<10,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 2>(bReportIndividualTestCases), "posit<10,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<10, 3>(bReportIndividualTestCases), "posit<10,3>", "addition"); + 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(VerifyBinaryOperatorThroughRandoms<16, 2>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<16,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<24, 2>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<24,1>", "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"); #endif #if REGRESSION_LEVEL_3 - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<20, 1>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<20,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<28, 1>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<28,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<20, 1>(reportTestCases, OPCODE_ADD, 1000), "posit<20,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<28, 1>(reportTestCases, OPCODE_ADD, 1000), "posit<28,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 1>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<32,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 2>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<32,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 3>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<32,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 1>(reportTestCases, OPCODE_ADD, 1000), "posit<32,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 2>(reportTestCases, OPCODE_ADD, 1000), "posit<32,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 3>(reportTestCases, OPCODE_ADD, 1000), "posit<32,3>", "addition"); #endif #if REGRESSION_LEVEL_4 // nbits=48 also shows failures - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<48, 2>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<48,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<48, 2>(reportTestCases, OPCODE_ADD, 1000), "posit<48,2>", "addition"); // nbits=64 requires long double compiler support - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 2>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<64,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 3>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<64,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<64,4>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 2>(reportTestCases, OPCODE_ADD, 1000), "posit<64,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 3>(reportTestCases, OPCODE_ADD, 1000), "posit<64,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(reportTestCases, OPCODE_ADD, 1000), "posit<64,4>", "addition"); #ifdef HARDWARE_ACCELERATION - nrOfFailedTestCases += ReportTestResult(VerifyAddition<12, 1>(bReportIndividualTestCases), "posit<12,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<14, 1>(bReportIndividualTestCases), "posit<14,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(VerifyAddition<16, 1>(bReportIndividualTestCases), "posit<16,1>", "addition"); + 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"); #endif // HARDWARE_ACCELERATION #endif // REGRESSION_LEVEL_4 -#endif // MANUAL_TESTING - + 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/tests/posit/arithmetic/complex_add.cpp b/tests/posit/arithmetic/complex_add.cpp index 6d2f27567..c38eff373 100644 --- a/tests/posit/arithmetic/complex_add.cpp +++ b/tests/posit/arithmetic/complex_add.cpp @@ -1,9 +1,9 @@ // complex_add.cpp: test suite runner for posit complex addition // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 // Configure the posit template environment // first: enable general or specialized posit configurations //#define POSIT_FAST_SPECIALIZATION @@ -13,13 +13,8 @@ // when you define POSIT_VERBOSE_OUTPUT executing an ADD the code will print intermediate results //#define POSIT_VERBOSE_OUTPUT #define POSIT_TRACE_ADD - -// minimum set of include files to reflect source code dependencies -#include -#include -#include -#include -#include +#include +#include #include #include @@ -46,7 +41,7 @@ void ReportBinaryArithmeticError(const std::string& test_case, const std::string // enumerate all addition cases for a posit configuration template -int ValidateComplexAddition(bool bReportIndividualTestCases) { +int ValidateComplexAddition(bool reportTestCases) { using namespace sw::universal; const size_t NR_POSITS = (size_t(1) << nbits); int nrOfFailedTests = 0; @@ -75,10 +70,10 @@ int ValidateComplexAddition(bool bReportIndividualTestCases) { if (result.real() != ref.real() || result.imag() != ref.imag()) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportBinaryArithmeticError("FAIL", "+", a, b, ref, result); + if (reportTestCases) ReportBinaryArithmeticError("FAIL", "+", a, b, ref, result); } else { - //if (bReportIndividualTestCases) ReportBinaryArithmeticSuccess("PASS", "+", a, b, ref, result); + //if (reportTestCases) ReportBinaryArithmeticSuccess("PASS", "+", a, b, ref, result); } } } @@ -88,18 +83,33 @@ int ValidateComplexAddition(bool bReportIndividualTestCases) { return nrOfFailedTests; } +// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 0 -#define STRESS_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 std; // needed to get the imaginary literals using namespace sw::universal; - bool bReportIndividualTestCases = false; + std::string test_suite = "posit complex addition validation"; + std::string test_tag = "complex addition"; + bool reportTestCases = false; int nrOfFailedTestCases = 0; - std::string tag = "posit complex addition failed: "; + ReportTestSuiteHeader(test_suite, reportTestCases); #if MANUAL_TESTING // generate individual testcases to hand trace/debug @@ -134,7 +144,7 @@ try { cout << z1 << endl; } - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<2, 0>(bReportIndividualTestCases), "posit<2,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<2, 0>(reportTestCases), "posit<2,0>", "addition"); // manual exhaustive test nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<5, 0>(true), "complex>", "addition"); nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<5, 1>(true), "complex>", "addition"); @@ -144,75 +154,81 @@ try { // 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"); + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; #else - cout << "Posit complex addition validation" << endl; +#if REGRESSION_LEVEL_1 + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<2, 0>(reportTestCases), "posit<2,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<2, 0>(bReportIndividualTestCases), "posit<2,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<3, 0>(reportTestCases), "posit<3,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<3, 1>(reportTestCases), "posit<3,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<3, 0>(bReportIndividualTestCases), "posit<3,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<3, 1>(bReportIndividualTestCases), "posit<3,1>", "addition"); - - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<4, 0>(bReportIndividualTestCases), "posit<4,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<4, 1>(bReportIndividualTestCases), "posit<4,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<4, 2>(bReportIndividualTestCases), "posit<4,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<4, 0>(reportTestCases), "posit<4,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<4, 1>(reportTestCases), "posit<4,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<4, 2>(reportTestCases), "posit<4,2>", "addition"); +#endif +#if REGRESSION_LEVEL_2 +#endif +#if REGRESSION_LEVEL_3 /* TODO - nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<16, 1>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<16,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<24, 1>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<24,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<32, 1>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<32,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<32, 2>(bReportIndividualTestCases, 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"); */ -#if STRESS_TESTING - - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<5, 0>(bReportIndividualTestCases), "posit<5,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<5, 1>(bReportIndividualTestCases), "posit<5,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<5, 2>(bReportIndividualTestCases), "posit<5,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<5, 3>(bReportIndividualTestCases), "posit<5,3>", "addition"); - - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<6, 0>(bReportIndividualTestCases), "posit<6,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<6, 1>(bReportIndividualTestCases), "posit<6,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<6, 2>(bReportIndividualTestCases), "posit<6,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<6, 3>(bReportIndividualTestCases), "posit<6,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<6, 4>(bReportIndividualTestCases), "posit<6,4>", "addition"); - - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<7, 0>(bReportIndividualTestCases), "posit<7,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<7, 1>(bReportIndividualTestCases), "posit<7,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<7, 2>(bReportIndividualTestCases), "posit<7,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<7, 3>(bReportIndividualTestCases), "posit<7,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<7, 4>(bReportIndividualTestCases), "posit<7,4>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<7, 5>(bReportIndividualTestCases), "posit<7,5>", "addition"); - - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<8, 0>(bReportIndividualTestCases), "posit<8,0>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<8, 1>(bReportIndividualTestCases), "posit<8,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<8, 2>(bReportIndividualTestCases), "posit<8,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<8, 3>(bReportIndividualTestCases), "posit<8,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<8, 4>(bReportIndividualTestCases), "posit<8,4>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<8, 5>(bReportIndividualTestCases), "posit<8,5>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<8, 6>(bReportIndividualTestCases), "posit<8,6>", "addition"); +#endif + +#if REGRESSION_LEVEL_4 + + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<5, 0>(reportTestCases), "posit<5,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<5, 1>(reportTestCases), "posit<5,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<5, 2>(reportTestCases), "posit<5,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<5, 3>(reportTestCases), "posit<5,3>", "addition"); + + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<6, 0>(reportTestCases), "posit<6,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<6, 1>(reportTestCases), "posit<6,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<6, 2>(reportTestCases), "posit<6,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<6, 3>(reportTestCases), "posit<6,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<6, 4>(reportTestCases), "posit<6,4>", "addition"); + + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<7, 0>(reportTestCases), "posit<7,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<7, 1>(reportTestCases), "posit<7,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<7, 2>(reportTestCases), "posit<7,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<7, 3>(reportTestCases), "posit<7,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<7, 4>(reportTestCases), "posit<7,4>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<7, 5>(reportTestCases), "posit<7,5>", "addition"); + + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<8, 0>(reportTestCases), "posit<8,0>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<8, 1>(reportTestCases), "posit<8,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<8, 2>(reportTestCases), "posit<8,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<8, 3>(reportTestCases), "posit<8,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<8, 4>(reportTestCases), "posit<8,4>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<8, 5>(reportTestCases), "posit<8,5>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<8, 6>(reportTestCases), "posit<8,6>", "addition"); // nbits=48 also shows failures - nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<48, 2>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<48,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<48, 2>(reportTestCases, OPCODE_ADD, 1000), "posit<48,2>", "addition"); // nbits=64 requires long double compiler support - nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<64, 2>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<64,2>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<64, 3>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<64,3>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<64, 4>(bReportIndividualTestCases, OPCODE_ADD, 1000), "posit<64,4>", "addition"); - + nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<64, 2>(reportTestCases, OPCODE_ADD, 1000), "posit<64,2>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<64, 3>(reportTestCases, OPCODE_ADD, 1000), "posit<64,3>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateThroughRandoms<64, 4>(reportTestCases, OPCODE_ADD, 1000), "posit<64,4>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<10, 1>(bReportIndividualTestCases), "posit<10,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<12, 1>(bReportIndividualTestCases), "posit<12,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<14, 1>(bReportIndividualTestCases), "posit<14,1>", "addition"); - nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<16, 1>(bReportIndividualTestCases), "posit<16,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<10, 1>(reportTestCases), "posit<10,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<12, 1>(reportTestCases), "posit<12,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<14, 1>(reportTestCases), "posit<14,1>", "addition"); + nrOfFailedTestCases += ReportTestResult(ValidateComplexAddition<16, 1>(reportTestCases), "posit<16,1>", "addition"); +#endif // REGRESSION_LEVEL_4 -#endif // STRESS_TESTING + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); #endif // MANUAL_TESTING - - return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); } catch (char const* msg) { std::cerr << msg << std::endl; diff --git a/tests/posit/arithmetic/decrement.cpp b/tests/posit/arithmetic/decrement.cpp index 0d321eadc..1dee80672 100644 --- a/tests/posit/arithmetic/decrement.cpp +++ b/tests/posit/arithmetic/decrement.cpp @@ -1,23 +1,40 @@ // decrement.cpp: test suite runner for decrement operator // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 +// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 0 -#define STRESS_TESTING 0 - -int main(int argc, char** argv) +// 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; - bool bReportIndividualTestCases = true; + std::string test_suite = "posit decrement validation"; + std::string test_tag = "decrement"; + bool reportTestCases = false; int nrOfFailedTestCases = 0; + ReportTestSuiteHeader(test_suite, reportTestCases); + #if MANUAL_TESTING constexpr size_t nbits = 5; constexpr size_t es = 0; @@ -29,79 +46,87 @@ try { std::cout << s.get() << " " << s << '\n'; }); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement(bReportIndividualTestCases), positConfig, "operator++"); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement(reportTestCases), positConfig, test_tag); + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; #else // Note: increment/decrement depend on the 2's complement ordering of the posit encoding // This implies that this functionality is independent of the configuration of the posit. // Otherwise stated, an enumeration of tests for different posit configurations is a bit superfluous. - // DECREMENT tests - std::cout << "\n posit decrement operator tests\n"; +#if REGRESSION_LEVEL_1 + nrOfFailedTestCases += ReportTestResult(VerifyDecrement<3, 0>(reportTestCases), "posit<3,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<3, 0>(bReportIndividualTestCases), "posit<3,0>", "operator--"); + 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<4, 0>(bReportIndividualTestCases), "posit<4,0>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<4, 1>(bReportIndividualTestCases), "posit<4,1>", "operator--"); + 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<5, 0>(bReportIndividualTestCases), "posit<5,0>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<5, 1>(bReportIndividualTestCases), "posit<5,1>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<5, 2>(bReportIndividualTestCases), "posit<5,2>", "operator--"); + 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<6, 0>(bReportIndividualTestCases), "posit<6,0>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<6, 1>(bReportIndividualTestCases), "posit<6,1>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<6, 2>(bReportIndividualTestCases), "posit<6,2>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<6, 3>(bReportIndividualTestCases), "posit<6,3>", "operator--"); + 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<7, 0>(bReportIndividualTestCases), "posit<7,0>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<7, 1>(bReportIndividualTestCases), "posit<7,1>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<7, 2>(bReportIndividualTestCases), "posit<7,2>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<7, 3>(bReportIndividualTestCases), "posit<7,3>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<7, 4>(bReportIndividualTestCases), "posit<7,4>", "operator--"); + 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); +#endif - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<8, 0>(bReportIndividualTestCases), "posit<8,0>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<8, 1>(bReportIndividualTestCases), "posit<8,1>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<8, 2>(bReportIndividualTestCases), "posit<8,2>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<8, 3>(bReportIndividualTestCases), "posit<8,3>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<8, 4>(bReportIndividualTestCases), "posit<8,4>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<8, 5>(bReportIndividualTestCases), "posit<8,5>", "operator--"); +#if REGRESSION_LEVEL_2 +#endif -#endif // MANUAL_TESTING +#if REGRESSION_LEVEL_3 +#endif - // long running - if (argc == 2 && std::string(argv[1]) == std::string("-l")) { - // AD/DA adapted data path configurations - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<10, 0>(bReportIndividualTestCases), "posit<10,0>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<10, 1>(bReportIndividualTestCases), "posit<10,1>", "operator--"); +#if REGRESSION_LEVEL_4 - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<12, 0>(bReportIndividualTestCases), "posit<12,0>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<12, 1>(bReportIndividualTestCases), "posit<12,1>", "operator--"); + // 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<14, 0>(bReportIndividualTestCases), "posit<14,0>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<14, 1>(bReportIndividualTestCases), "posit<14,1>", "operator--"); + 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<15, 0>(bReportIndividualTestCases), "posit<15,0>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<15, 1>(bReportIndividualTestCases), "posit<15,1>", "operator--"); + 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<16, 0>(bReportIndividualTestCases), "posit<16,0>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<16, 1>(bReportIndividualTestCases), "posit<16,1>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<16, 2>(bReportIndividualTestCases), "posit<16,2>", "operator--"); + 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<18, 0>(bReportIndividualTestCases), "posit<18,0>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<18, 1>(bReportIndividualTestCases), "posit<18,1>", "operator--"); - nrOfFailedTestCases += ReportTestResult(VerifyDecrement<18, 2>(bReportIndividualTestCases), "posit<18,2>", "operator--"); + 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<20, 1>(bReportIndividualTestCases), "posit<20,1>", "operator--"); + 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); - // legit float replacement - //nrOfFailedTestCases += ReportTestResult(VerifyDecrement<24, 1>(bReportIndividualTestCases), "posit<24,1>", "operator--"); - //nrOfFailedTestCases += ReportTestResult(VerifyDecrement<28, 1>(bReportIndividualTestCases), "posit<28,2>", "operator--"); + nrOfFailedTestCases += ReportTestResult(VerifyDecrement<20, 1>(reportTestCases), "posit<20,1>", test_tag); - // legit double replacement - //nrOfFailedTestCases += ReportTestResult(VerifyDecrement<32, 2>(bReportIndividualTestCases), "posit<32,2>", "operator--"); - } + // 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); + // legit double replacement + //nrOfFailedTestCases += ReportTestResult(VerifyDecrement<32, 2>(reportTestCases), "posit<32,2>", test_tag); +#endif // REGRESSION_LEVEL_4 + + 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/tests/posit/arithmetic/division.cpp b/tests/posit/arithmetic/division.cpp index 908050f6e..51e4c06df 100644 --- a/tests/posit/arithmetic/division.cpp +++ b/tests/posit/arithmetic/division.cpp @@ -1,9 +1,9 @@ // arithmetic_divide.cpp: test suite runner for posit division // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 // Configure the posit template environment // first: enable general or specialized posit configurations //#define POSIT_FAST_SPECIALIZATION @@ -13,13 +13,8 @@ // when you define POSIT_VERBOSE_OUTPUT executing an ADD the code will print intermediate results //#define POSIT_VERBOSE_OUTPUT #define POSIT_TRACE_DIV - -// minimum set of include files to reflect source code dependencies -#include -#include -#include -#include -#include +#include +#include #include #include @@ -176,15 +171,16 @@ void ToughDivisions2() { #define REGRESSION_LEVEL_4 1 #endif -int main(int argc, char** argv) +int main() try { using namespace sw::universal; - std::cout << "Posit division validation\n"; - bool bReportIndividualTestCases = false; + std::string test_suite = "posit division validation"; + std::string test_tag = "division"; + bool reportTestCases = false; int nrOfFailedTestCases = 0; - std::string tag = "Division failed: "; + ReportTestSuiteHeader(test_suite, reportTestCases); #if MANUAL_TESTING // generate individual testcases to hand trace/debug @@ -217,85 +213,88 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyDivision<5, 0>("Manual Testing", true), "posit<5,0>", "division"); nrOfFailedTestCases += ReportTestResult(VerifyDivision<8, 0>("Manual Testing", true), "posit<8,0>", "division"); + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyDivision<2, 0>(bReportIndividualTestCases), "posit< 2,0>", "division"); - - nrOfFailedTestCases += ReportTestResult(VerifyDivision<3, 0>(bReportIndividualTestCases), "posit< 3,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<3, 1>(bReportIndividualTestCases), "posit< 3,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<3, 2>(bReportIndividualTestCases), "posit< 3,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<3, 3>(bReportIndividualTestCases), "posit< 3,3>", "division"); - - nrOfFailedTestCases += ReportTestResult(VerifyDivision<4, 0>(bReportIndividualTestCases), "posit< 4,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<4, 1>(bReportIndividualTestCases), "posit< 4,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<4, 2>(bReportIndividualTestCases), "posit< 4,2>", "division"); - - nrOfFailedTestCases += ReportTestResult(VerifyDivision<5, 0>(bReportIndividualTestCases), "posit< 5,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<5, 1>(bReportIndividualTestCases), "posit< 5,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<5, 2>(bReportIndividualTestCases), "posit< 5,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<5, 3>(bReportIndividualTestCases), "posit< 5,3>", "division"); - - nrOfFailedTestCases += ReportTestResult(VerifyDivision<6, 0>(bReportIndividualTestCases), "posit< 6,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<6, 1>(bReportIndividualTestCases), "posit< 6,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<6, 2>(bReportIndividualTestCases), "posit< 6,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<6, 3>(bReportIndividualTestCases), "posit< 6,3>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<6, 4>(bReportIndividualTestCases), "posit< 6,4>", "division"); - - nrOfFailedTestCases += ReportTestResult(VerifyDivision<7, 0>(bReportIndividualTestCases), "posit< 7,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<7, 1>(bReportIndividualTestCases), "posit< 7,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<7, 2>(bReportIndividualTestCases), "posit< 7,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<7, 3>(bReportIndividualTestCases), "posit< 7,3>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<7, 4>(bReportIndividualTestCases), "posit< 7,4>", "division"); - - nrOfFailedTestCases += ReportTestResult(VerifyDivision<8, 0>(bReportIndividualTestCases), "posit< 8,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<8, 1>(bReportIndividualTestCases), "posit< 8,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<8, 2>(bReportIndividualTestCases), "posit< 8,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<8, 3>(bReportIndividualTestCases), "posit< 8,3>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<8, 4>(bReportIndividualTestCases), "posit< 8,4>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<8, 5>(bReportIndividualTestCases), "posit< 8,5>", "division"); + 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"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifyDivision<10, 0>(bReportIndividualTestCases), "posit<10,0>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<10, 1>(bReportIndividualTestCases), "posit<10,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<10, 2>(bReportIndividualTestCases), "posit<10,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<10, 3>(bReportIndividualTestCases), "posit<10,3>", "division"); + 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(VerifyBinaryOperatorThroughRandoms<16, 2>(bReportIndividualTestCases, OPCODE_DIV, 1000), "posit<16,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<24, 2>(bReportIndividualTestCases, OPCODE_DIV, 1000), "posit<24,2>", "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"); #endif #if REGRESSION_LEVEL_3 - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<20, 1>(bReportIndividualTestCases, OPCODE_DIV, 1000), "posit<20,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<28, 1>(bReportIndividualTestCases, OPCODE_DIV, 1000), "posit<28,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<20, 1>(reportTestCases, OPCODE_DIV, 1000), "posit<20,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<28, 1>(reportTestCases, OPCODE_DIV, 1000), "posit<28,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 1>(bReportIndividualTestCases, OPCODE_DIV, 1000), "posit<32,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 2>(bReportIndividualTestCases, OPCODE_DIV, 1000), "posit<32,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 3>(bReportIndividualTestCases, OPCODE_DIV, 1000), "posit<32,3>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 1>(reportTestCases, OPCODE_DIV, 1000), "posit<32,1>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 2>(reportTestCases, OPCODE_DIV, 1000), "posit<32,2>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 3>(reportTestCases, OPCODE_DIV, 1000), "posit<32,3>", "division"); #endif #if REGRESSION_LEVEL_4 // nbits = 48 also shows failures - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<48, 2>(bReportIndividualTestCases, OPCODE_DIV, 1000), "posit<48,2>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<48, 2>(reportTestCases, OPCODE_DIV, 1000), "posit<48,2>", "division"); // nbits=64 requires long double compiler support - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 2>(bReportIndividualTestCases, OPCODE_DIV, 1000), "posit<64,2>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 3>(bReportIndividualTestCases, OPCODE_DIV, 1000), "posit<64,3>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 2>(reportTestCases, OPCODE_DIV, 1000), "posit<64,2>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 3>(reportTestCases, OPCODE_DIV, 1000), "posit<64,3>", "division"); // posit<64,4> is hitting subnormal numbers - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(bReportIndividualTestCases, OPCODE_DIV, 1000), "posit<64,4>", "division"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(reportTestCases, OPCODE_DIV, 1000), "posit<64,4>", "division"); #ifdef HARDWARE_ACCELERATION - nrOfFailedTestCases += ReportTestResult(VerifyDivision<12, 1>(bReportIndividualTestCases), "posit<12,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<14, 1>(bReportIndividualTestCases), "posit<14,1>", "division"); - nrOfFailedTestCases += ReportTestResult(VerifyDivision<16, 1>(bReportIndividualTestCases), "posit<16,1>", "division"); + 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"); #endif // HARDWARE_ACCELERATION #endif // REGRESSION_LEVEL_4 -#endif // MANUAL_TESTING - + 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/tests/posit/arithmetic/fma.cpp b/tests/posit/arithmetic/fma.cpp index 5e969f6a7..be0f8e606 100644 --- a/tests/posit/arithmetic/fma.cpp +++ b/tests/posit/arithmetic/fma.cpp @@ -1,18 +1,17 @@ // arithmetic_fma.cpp: test suite runner for fused-multiply-add // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 // uint8_t, etc. #include // for frexp/frexpf and std::fma #include // feclearexcept/fetestexcept -// minimum set of include files to reflect source code dependencies // enable/disable posit arithmetic exceptions #define POSIT_THROW_ARITHMETIC_EXCEPTION 0 -#include -// posit type manipulators such as pretty printers -#include +#include +#include #include // generate specific test case that you can trace with the trace conditions in posit.h @@ -35,22 +34,38 @@ void GenerateTestCase(Ty a, Ty b, Ty c) { std::cout << std::setprecision(5); } +// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 1 -#define STRESS_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 // forward references void ReportSizeof(); void ReportFmaResults(); void ReportErrors(); -int main(int argc, char** argv) +// TODO +int main() try { using namespace sw::universal; - //bool bReportIndividualTestCases = false; + std::string test_suite = "posit fma validation"; + std::string test_tag = "fma"; + bool reportTestCases = false; int nrOfFailedTestCases = 0; - std::string tag = "Fused Multiply-Accumulate failed: "; + ReportTestSuiteHeader(test_suite, reportTestCases); #if MANUAL_TESTING @@ -80,7 +95,6 @@ try { std::cout << pfma << " : " << (long double)(pfma) << '\n'; } - return 0; { // this is not a good test case, because 0.1 is not representable in binary so you get round-off in the conversion GenerateTestCase<16, 1, double>(0.1, 10, -1); @@ -88,19 +102,27 @@ try { GenerateTestCase<64, 3, double>(0.1, 10, -1); } - + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; #else +#if REGRESSION_LEVEL_1 nrOfFailedTestCases += ReportTestResult(ValidateFMA<2, 0>(tag, bReportIndividualTestCases), "posit<2,0>", "fused multiply-accumulate"); +#endif +#if REGRESSION_LEVEL_2 +#endif -#if STRESS_TESTING - +#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/tests/posit/arithmetic/increment.cpp b/tests/posit/arithmetic/increment.cpp index 1de61795a..921abc7bf 100644 --- a/tests/posit/arithmetic/increment.cpp +++ b/tests/posit/arithmetic/increment.cpp @@ -1,23 +1,39 @@ // increment.cpp: test suite runner for increment operator // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 +// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 0 -#define STRESS_TESTING 0 - -int main(int argc, char** argv) +// 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; - bool bReportIndividualTestCases = true; + std::string test_suite = "posit increment validation"; + std::string test_tag = "increment"; + bool reportTestCases = false; int nrOfFailedTestCases = 0; + ReportTestSuiteHeader(test_suite, reportTestCases); + #if MANUAL_TESTING constexpr size_t nbits = 5; constexpr size_t es = 0; @@ -29,78 +45,86 @@ try { std::cout << s.get() << " " << s << std::endl; }); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement(bReportIndividualTestCases), positConfig, "operator++"); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement(reportTestCases), positConfig, test_tag); + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; #else // Note: increment/decrement depend on the 2's complement ordering of the posit encoding // This implies that this functionality is independent of the configuration of the posit. // Otherwise stated, an enumeration of tests for different posit configurations is a bit superfluous. - // INCREMENT tests - std::cout << "\n posit increment operator tests\n"; - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<3, 0>(bReportIndividualTestCases), "posit<3,0>", "operator++"); +#if REGRESSION_LEVEL_1 + nrOfFailedTestCases += ReportTestResult(VerifyIncrement<3, 0>(reportTestCases), "posit<3,0>", test_tag); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<4, 0>(bReportIndividualTestCases), "posit<4,0>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<4, 1>(bReportIndividualTestCases), "posit<4,1>", "operator++"); + 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>(bReportIndividualTestCases), "posit<5,0>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<5, 1>(bReportIndividualTestCases), "posit<5,1>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<5, 2>(bReportIndividualTestCases), "posit<5,2>", "operator++"); + 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>(bReportIndividualTestCases), "posit<6,0>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<6, 1>(bReportIndividualTestCases), "posit<6,1>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<6, 2>(bReportIndividualTestCases), "posit<6,2>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<6, 3>(bReportIndividualTestCases), "posit<6,3>", "operator++"); + 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>(bReportIndividualTestCases), "posit<7,0>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<7, 1>(bReportIndividualTestCases), "posit<7,1>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<7, 2>(bReportIndividualTestCases), "posit<7,2>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<7, 3>(bReportIndividualTestCases), "posit<7,3>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<7, 4>(bReportIndividualTestCases), "posit<7,4>", "operator++"); + 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>(bReportIndividualTestCases), "posit<8,0>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<8, 1>(bReportIndividualTestCases), "posit<8,1>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<8, 2>(bReportIndividualTestCases), "posit<8,2>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<8, 3>(bReportIndividualTestCases), "posit<8,3>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<8, 4>(bReportIndividualTestCases), "posit<8,4>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<8, 5>(bReportIndividualTestCases), "posit<8,5>", "operator++"); + 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); +#endif -#endif // MANUAL_TESTING +#if REGRESSION_LEVEL_2 +#endif - if (argc == 2 && std::string(argv[1]) == std::string("-l")) { - // AD/DA adapted data path configurations - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<10, 0>(bReportIndividualTestCases), "posit<10,0>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<10, 1>(bReportIndividualTestCases), "posit<10,1>", "operator++"); +#if REGRESSION_LEVEL_3 +#endif - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<12, 0>(bReportIndividualTestCases), "posit<12,0>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<12, 1>(bReportIndividualTestCases), "posit<12,1>", "operator++"); +#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<14, 0>(bReportIndividualTestCases), "posit<14,0>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<14, 1>(bReportIndividualTestCases), "posit<14,1>", "operator++"); + 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<15, 0>(bReportIndividualTestCases), "posit<15,0>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<15, 1>(bReportIndividualTestCases), "posit<15,1>", "operator++"); + 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<16, 0>(bReportIndividualTestCases), "posit<16,0>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<16, 1>(bReportIndividualTestCases), "posit<16,1>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<16, 2>(bReportIndividualTestCases), "posit<16,2>", "operator++"); + 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<18, 0>(bReportIndividualTestCases), "posit<18,0>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<18, 1>(bReportIndividualTestCases), "posit<18,1>", "operator++"); - nrOfFailedTestCases += ReportTestResult(VerifyIncrement<18, 2>(bReportIndividualTestCases), "posit<18,2>", "operator++"); + 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<20, 1>(bReportIndividualTestCases), "posit<20,1>", "operator++"); - - // legit float replacement - //nrOfFailedTestCases += ReportTestResult(VerifyIncrement<24, 1>(bReportIndividualTestCases), "posit<24,1>", "operator++"); - //nrOfFailedTestCases += ReportTestResult(VerifyIncrement<28, 2>(bReportIndividualTestCases), "posit<28,2>", "operator++"); + 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); - // legit double replacement - //nrOfFailedTestCases += ReportTestResult(VerifyIncrement<32, 2>(bReportIndividualTestCases), "posit<32,2>", "operator++"); + nrOfFailedTestCases += ReportTestResult(VerifyIncrement<20, 1>(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); - } + // legit double replacement + //nrOfFailedTestCases += ReportTestResult(VerifyIncrement<32, 2>(reportTestCases), "posit<32,2>", test_tag); +#endif // REGRESSION_LEVEL_4 + 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/tests/posit/arithmetic/literals.cpp b/tests/posit/arithmetic/literals.cpp index 1b617ddda..ea571537c 100644 --- a/tests/posit/arithmetic/literals.cpp +++ b/tests/posit/arithmetic/literals.cpp @@ -1,9 +1,9 @@ // arithmetic_literals.cpp: test suite runner for the use of literals in posit equations // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 // Configure the posit template environment // first: enable general or specialized specialized posit configurations //#define POSIT_FAST_SPECIALIZATION @@ -15,31 +15,23 @@ #define POSIT_TRACE_ADD // forth: enable/disable the ability to use literals in binary logic and arithmetic operators #define POSIT_ENABLE_LITERALS 1 - -// minimum set of include files to reflect source code dependencies -#include -#include -#include -#include -#include -#include // ReportTestResult -//#include +#include #include #include // enumerate all addition cases for a posit configuration: is within 10sec till about nbits = 14 template -int ValidateAdditionWithLiteral(const std::string& tag, bool bReportIndividualTestCases) { +int ValidateAdditionWithLiteral(bool reportTestCases) { const int NR_POSITS = (unsigned(1) << nbits); int nrOfFailedTests = 0; sw::universal::posit pa, pb, psum1, psum2, pref; double da, db; - for (int i = 0; i < NR_POSITS; i++) { + for (size_t i = 0; i < NR_POSITS; ++i) { pa.setbits(i); da = double(pa); - for (int j = 0; j < NR_POSITS; j++) { + for (size_t j = 0; j < NR_POSITS; ++j) { pb.setbits(j); db = double(pb); psum1 = pa + db; @@ -47,10 +39,10 @@ int ValidateAdditionWithLiteral(const std::string& tag, bool bReportIndividualTe pref = da + db; if (psum1 != pref || psum2 != pref || psum1 != psum2) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportBinaryArithmeticError("FAIL", "+", pa, pb, pref, psum1); + if (reportTestCases) ReportBinaryArithmeticError("FAIL", "+", pa, pb, pref, psum1); } else { - //if (bReportIndividualTestCases) ReportBinaryArithmeticSuccess("PASS", "+", pa, pb, pref, psum1); + //if (reportTestCases) ReportBinaryArithmeticSuccess("PASS", "+", pa, pb, pref, psum1); } } } @@ -60,16 +52,16 @@ int ValidateAdditionWithLiteral(const std::string& tag, bool bReportIndividualTe // enumerate all subtraction cases for a posit configuration template -int ValidateSubtractionWithLiteral(const std::string& tag, bool bReportIndividualTestCases) { +int ValidateSubtractionWithLiteral(bool reportTestCases) { const int NR_POSITS = (unsigned(1) << nbits); int nrOfFailedTests = 0; sw::universal::posit pa, pb, pdiff1, pdiff2, pref; double da, db; - for (int i = 0; i < NR_POSITS; i++) { + for (size_t i = 0; i < NR_POSITS; ++i) { pa.setbits(i); da = double(pa); - for (int j = 0; j < NR_POSITS; j++) { + for (size_t j = 0; j < NR_POSITS; ++j) { pb.setbits(j); db = double(pb); pdiff1 = pa - db; @@ -77,10 +69,10 @@ int ValidateSubtractionWithLiteral(const std::string& tag, bool bReportIndividua pref = da - db; if (pdiff1 != pref || pdiff2 != pref || pdiff1 != pdiff2) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportBinaryArithmeticError("FAIL", "-", pa, pb, pref, pdiff1); + if (reportTestCases) ReportBinaryArithmeticError("FAIL", "-", pa, pb, pref, pdiff1); } else { - //if (bReportIndividualTestCases) ReportBinaryArithmeticSuccess("PASS", "-", pa, pb, pref, pdiff1); + //if (reportTestCases) ReportBinaryArithmeticSuccess("PASS", "-", pa, pb, pref, pdiff1); } } } @@ -90,16 +82,16 @@ int ValidateSubtractionWithLiteral(const std::string& tag, bool bReportIndividua // enumerate all multiplication cases for a posit configuration template -int ValidateMultiplicationWithLiteral(const std::string& tag, bool bReportIndividualTestCases) { +int ValidateMultiplicationWithLiteral(bool reportTestCases) { const int NR_POSITS = (unsigned(1) << nbits); int nrOfFailedTests = 0; sw::universal::posit pa, pb, pmul1, pmul2, pref; double da, db; - for (int i = 0; i < NR_POSITS; i++) { + for (size_t i = 0; i < NR_POSITS; ++i) { pa.setbits(i); da = double(pa); - for (int j = 0; j < NR_POSITS; j++) { + for (size_t j = 0; j < NR_POSITS; ++j) { pb.setbits(j); db = double(pb); pmul1 = pa * db; @@ -107,10 +99,10 @@ int ValidateMultiplicationWithLiteral(const std::string& tag, bool bReportIndivi pref = da * db; if (pmul1 != pref || pmul2 != pref || pmul1 != pmul2) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportBinaryArithmeticError("FAIL", "*", pa, pb, pref, pmul1); + if (reportTestCases) ReportBinaryArithmeticError("FAIL", "*", pa, pb, pref, pmul1); } else { - //if (bReportIndividualTestCases) ReportBinaryArithmeticSuccess("PASS", "*", pa, pb, pref, pmul1); + //if (reportTestCases) ReportBinaryArithmeticSuccess("PASS", "*", pa, pb, pref, pmul1); } } } @@ -120,16 +112,16 @@ int ValidateMultiplicationWithLiteral(const std::string& tag, bool bReportIndivi // enumerate all division cases for a posit configuration template -int ValidateDivisionWithLiteral(const std::string& tag, bool bReportIndividualTestCases) { +int ValidateDivisionWithLiteral(bool reportTestCases) { const int NR_POSITS = (unsigned(1) << nbits); int nrOfFailedTests = 0; sw::universal::posit pa, pb, pdiv1, pdiv2, pref; double da, db; - for (int i = 0; i < NR_POSITS; i++) { + for (size_t i = 0; i < NR_POSITS; ++i) { pa.setbits(i); da = double(pa); - for (int j = 0; j < NR_POSITS; j++) { + for (size_t j = 0; j < NR_POSITS; ++j) { pb.setbits(j); db = double(pb); pdiv1 = pa / db; @@ -137,10 +129,10 @@ int ValidateDivisionWithLiteral(const std::string& tag, bool bReportIndividualTe pref = da / db; if (pdiv1 != pref || pdiv2 != pref || pdiv1 != pdiv2) { nrOfFailedTests++; - if (bReportIndividualTestCases) ReportBinaryArithmeticError("FAIL", "+", pa, pb, pref, pdiv1); + if (reportTestCases) ReportBinaryArithmeticError("FAIL", "+", pa, pb, pref, pdiv1); } else { - //if (bReportIndividualTestCases) ReportBinaryArithmeticSuccess("PASS", "+", pa, pb, pref, pdiv1); + //if (reportTestCases) ReportBinaryArithmeticSuccess("PASS", "+", pa, pb, pref, pdiv1); } } } @@ -166,16 +158,33 @@ void GenerateTestCase(Ty a, Ty b) { std::cout << std::setprecision(5); } +// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 0 -#define STRESS_TESTING 0 - -int main(int argc, char** argv) +// 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; - bool bReportIndividualTestCases = false; + std::string test_suite = "posit arithmetic with literals validation"; + std::string test_tag = "literals"; + bool reportTestCases = false; int nrOfFailedTestCases = 0; + ReportTestSuiteHeader(test_suite, reportTestCases); + std::string tag = "Arithmetic with literals failed: "; #if MANUAL_TESTING @@ -198,52 +207,57 @@ try { nrOfFailedTestCases += ReportTestResult(ValidateMultiplicationWithLiteral<8, 2>("Manual Testing", true), "posit<8,2>", "multiplication with literal"); nrOfFailedTestCases += ReportTestResult(ValidateDivisionWithLiteral<8, 2>("Manual Testing", true), "posit<8,2>", "division with literal"); + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; #else - std::cout << "Posit addition validation\n"; - - - nrOfFailedTestCases += ReportTestResult(ValidateAdditionWithLiteral<8, 2> (tag, bReportIndividualTestCases), "posit<8,2>", "addition with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateSubtractionWithLiteral<8, 2> (tag, bReportIndividualTestCases), "posit<8,2>", "subtraction with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateMultiplicationWithLiteral<8, 2>(tag, bReportIndividualTestCases), "posit<8,2>", "multiplication with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateDivisionWithLiteral<8, 2> (tag, bReportIndividualTestCases), "posit<8,2>", "division with literal"); - - -#if STRESS_TESTING - - nrOfFailedTestCases += ReportTestResult(ValidateAdditionWithLiteral<8, 0>(tag, bReportIndividualTestCases), "posit<8,0>", "addition with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateAdditionWithLiteral<8, 1>(tag, bReportIndividualTestCases), "posit<8,1>", "addition with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateAdditionWithLiteral<8, 2>(tag, bReportIndividualTestCases), "posit<8,2>", "addition with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateAdditionWithLiteral<8, 3>(tag, bReportIndividualTestCases), "posit<8,3>", "addition with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateAdditionWithLiteral<8, 4>(tag, bReportIndividualTestCases), "posit<8,4>", "addition with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateAdditionWithLiteral<8, 5>(tag, bReportIndividualTestCases), "posit<8,5>", "addition with literal"); - - nrOfFailedTestCases += ReportTestResult(ValidateSubtractionWithLiteral<8, 0>(tag, bReportIndividualTestCases), "posit<8,0>", "subtraction with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateSubtractionWithLiteral<8, 1>(tag, bReportIndividualTestCases), "posit<8,1>", "subtraction with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateSubtractionWithLiteral<8, 2>(tag, bReportIndividualTestCases), "posit<8,2>", "subtraction with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateSubtractionWithLiteral<8, 3>(tag, bReportIndividualTestCases), "posit<8,3>", "subtraction with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateSubtractionWithLiteral<8, 4>(tag, bReportIndividualTestCases), "posit<8,4>", "subtraction with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateSubtractionWithLiteral<8, 5>(tag, bReportIndividualTestCases), "posit<8,5>", "subtraction with literal"); - - nrOfFailedTestCases += ReportTestResult(ValidateMultiplicationWithLiteral<8, 0>(tag, bReportIndividualTestCases), "posit<8,0>", "multiplication with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateMultiplicationWithLiteral<8, 1>(tag, bReportIndividualTestCases), "posit<8,1>", "multiplication with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateMultiplicationWithLiteral<8, 2>(tag, bReportIndividualTestCases), "posit<8,2>", "multiplication with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateMultiplicationWithLiteral<8, 3>(tag, bReportIndividualTestCases), "posit<8,3>", "multiplication with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateMultiplicationWithLiteral<8, 4>(tag, bReportIndividualTestCases), "posit<8,4>", "multiplication with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateMultiplicationWithLiteral<8, 5>(tag, bReportIndividualTestCases), "posit<8,5>", "multiplication with literal"); - - nrOfFailedTestCases += ReportTestResult(ValidateDivisionWithLiteral<8, 0>(tag, bReportIndividualTestCases), "posit<8,0>", "division with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateDivisionWithLiteral<8, 1>(tag, bReportIndividualTestCases), "posit<8,1>", "division with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateDivisionWithLiteral<8, 2>(tag, bReportIndividualTestCases), "posit<8,2>", "division with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateDivisionWithLiteral<8, 3>(tag, bReportIndividualTestCases), "posit<8,3>", "division with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateDivisionWithLiteral<8, 4>(tag, bReportIndividualTestCases), "posit<8,4>", "division with literal"); - nrOfFailedTestCases += ReportTestResult(ValidateDivisionWithLiteral<8, 5>(tag, bReportIndividualTestCases), "posit<8,5>", "division with literal"); - -#endif // STRESS_TESTING +#if REGRESSION_LEVEL_1 + nrOfFailedTestCases += ReportTestResult(ValidateAdditionWithLiteral<8, 2> (reportTestCases), "posit<8,2>", "addition with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateSubtractionWithLiteral<8, 2> (reportTestCases), "posit<8,2>", "subtraction with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateMultiplicationWithLiteral<8, 2>(reportTestCases), "posit<8,2>", "multiplication with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateDivisionWithLiteral<8, 2> (reportTestCases), "posit<8,2>", "division with literal"); +#endif + +#if REGRESSION_LEVEL_2 +#endif + +#if REGRESSION_LEVEL_3 +#endif + +#if REGRESSION_LEVEL_4 + nrOfFailedTestCases += ReportTestResult(ValidateAdditionWithLiteral<8, 0>(reportTestCases), "posit<8,0>", "addition with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateAdditionWithLiteral<8, 1>(reportTestCases), "posit<8,1>", "addition with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateAdditionWithLiteral<8, 2>(reportTestCases), "posit<8,2>", "addition with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateAdditionWithLiteral<8, 3>(reportTestCases), "posit<8,3>", "addition with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateAdditionWithLiteral<8, 4>(reportTestCases), "posit<8,4>", "addition with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateAdditionWithLiteral<8, 5>(reportTestCases), "posit<8,5>", "addition with literal"); + + nrOfFailedTestCases += ReportTestResult(ValidateSubtractionWithLiteral<8, 0>(reportTestCases), "posit<8,0>", "subtraction with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateSubtractionWithLiteral<8, 1>(reportTestCases), "posit<8,1>", "subtraction with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateSubtractionWithLiteral<8, 2>(reportTestCases), "posit<8,2>", "subtraction with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateSubtractionWithLiteral<8, 3>(reportTestCases), "posit<8,3>", "subtraction with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateSubtractionWithLiteral<8, 4>(reportTestCases), "posit<8,4>", "subtraction with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateSubtractionWithLiteral<8, 5>(reportTestCases), "posit<8,5>", "subtraction with literal"); + + nrOfFailedTestCases += ReportTestResult(ValidateMultiplicationWithLiteral<8, 0>(reportTestCases), "posit<8,0>", "multiplication with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateMultiplicationWithLiteral<8, 1>(reportTestCases), "posit<8,1>", "multiplication with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateMultiplicationWithLiteral<8, 2>(reportTestCases), "posit<8,2>", "multiplication with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateMultiplicationWithLiteral<8, 3>(reportTestCases), "posit<8,3>", "multiplication with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateMultiplicationWithLiteral<8, 4>(reportTestCases), "posit<8,4>", "multiplication with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateMultiplicationWithLiteral<8, 5>(reportTestCases), "posit<8,5>", "multiplication with literal"); + + nrOfFailedTestCases += ReportTestResult(ValidateDivisionWithLiteral<8, 0>(reportTestCases), "posit<8,0>", "division with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateDivisionWithLiteral<8, 1>(reportTestCases), "posit<8,1>", "division with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateDivisionWithLiteral<8, 2>(reportTestCases), "posit<8,2>", "division with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateDivisionWithLiteral<8, 3>(reportTestCases), "posit<8,3>", "division with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateDivisionWithLiteral<8, 4>(reportTestCases), "posit<8,4>", "division with literal"); + nrOfFailedTestCases += ReportTestResult(ValidateDivisionWithLiteral<8, 5>(reportTestCases), "posit<8,5>", "division with literal"); +#endif // REGRESSION_LEVEL_4 + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); #endif // MANUAL_TESTING - - return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); } catch (char const* msg) { std::cerr << msg << std::endl; diff --git a/tests/posit/arithmetic/multiplication.cpp b/tests/posit/arithmetic/multiplication.cpp index 895f12cd6..7b154fc85 100644 --- a/tests/posit/arithmetic/multiplication.cpp +++ b/tests/posit/arithmetic/multiplication.cpp @@ -1,9 +1,9 @@ // arithmetic_multiply.cpp: test suite runner for posit multiplication // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 // Configure the posit template environment // first: enable general or specialized specialized posit configurations //#define POSIT_FAST_SPECIALIZATION @@ -13,13 +13,8 @@ // when you define POSIT_VERBOSE_OUTPUT executing a MUL the code will print intermediate results //#define POSIT_VERBOSE_OUTPUT #define POSIT_TRACE_MUL - -// minimum set of include files to reflect source code dependencies -#include -#include -#include -#include -#include +#include +#include #include #include @@ -117,15 +112,16 @@ void DifficultRoundingCases() { #define REGRESSION_LEVEL_4 1 #endif -int main(int argc, char** argv) +int main() try { using namespace sw::universal; - std::cout << "Posit multiplication validation\n"; - bool bReportIndividualTestCases = true; + std::string test_suite = "posit multiplication validation"; + std::string test_tag = "multiplication"; + bool reportTestCases = false; int nrOfFailedTestCases = 0; - std::string tag = "Multiplication failed: "; + ReportTestSuiteHeader(test_suite, reportTestCases); #if MANUAL_TESTING // generate individual testcases to hand trace/debug @@ -158,87 +154,90 @@ try { DifficultRoundingCases(); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<2, 0>("Manual Testing: ", bReportIndividualTestCases), "posit<2,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 0>("Manual Testing: ", bReportIndividualTestCases), "posit<3,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 1>("Manual Testing: ", bReportIndividualTestCases), "posit<3,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 0>("Manual Testing: ", bReportIndividualTestCases), "posit<4,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<2, 0>("Manual Testing: ", reportTestCases), "posit<2,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 0>("Manual Testing: ", reportTestCases), "posit<3,0>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 1>("Manual Testing: ", reportTestCases), "posit<3,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 0>("Manual Testing: ", reportTestCases), "posit<4,0>", "multiplication"); + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<2, 0>(bReportIndividualTestCases), "posit< 2,0>", "multiplication"); - - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 0>(bReportIndividualTestCases), "posit< 3,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 1>(bReportIndividualTestCases), "posit< 3,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 2>(bReportIndividualTestCases), "posit< 3,2>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<3, 3>(bReportIndividualTestCases), "posit< 3,3>", "multiplication"); - - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 0>(bReportIndividualTestCases), "posit< 4,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 1>(bReportIndividualTestCases), "posit< 4,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<4, 2>(bReportIndividualTestCases), "posit< 4,2>", "multiplication"); - - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<5, 0>(bReportIndividualTestCases), "posit< 5,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<5, 1>(bReportIndividualTestCases), "posit< 5,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<5, 2>(bReportIndividualTestCases), "posit< 5,2>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<5, 3>(bReportIndividualTestCases), "posit< 5,3>", "multiplication"); - - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<6, 0>(bReportIndividualTestCases), "posit< 6,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<6, 1>(bReportIndividualTestCases), "posit< 6,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<6, 2>(bReportIndividualTestCases), "posit< 6,2>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<6, 3>(bReportIndividualTestCases), "posit< 6,3>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<6, 4>(bReportIndividualTestCases), "posit< 6,4>", "multiplication"); - - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<7, 0>(bReportIndividualTestCases), "posit< 7,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<7, 1>(bReportIndividualTestCases), "posit< 7,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<7, 2>(bReportIndividualTestCases), "posit< 7,2>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<7, 3>(bReportIndividualTestCases), "posit< 7,3>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<7, 4>(bReportIndividualTestCases), "posit< 7,4>", "multiplication"); - - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 0>(bReportIndividualTestCases), "posit< 8,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 1>(bReportIndividualTestCases), "posit< 8,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 2>(bReportIndividualTestCases), "posit< 8,2>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 3>(bReportIndividualTestCases), "posit< 8,3>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 4>(bReportIndividualTestCases), "posit< 8,4>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<8, 5>(bReportIndividualTestCases), "posit< 8,5>", "multiplication"); + 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"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 0>(bReportIndividualTestCases), "posit<10,0>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 1>(bReportIndividualTestCases), "posit<10,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 2>(bReportIndividualTestCases), "posit<10,2>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<10, 3>(bReportIndividualTestCases), "posit<10,3>", "multiplication"); + 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(VerifyBinaryOperatorThroughRandoms<16, 2>(bReportIndividualTestCases, OPCODE_MUL, 1000), "posit<16,2>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<24, 2>(bReportIndividualTestCases, OPCODE_MUL, 1000), "posit<24,2>", "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"); #endif #if REGRESSION_LEVEL_3 - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 1>(bReportIndividualTestCases, OPCODE_MUL, 1000), "posit<32,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 2>(bReportIndividualTestCases, OPCODE_MUL, 1000), "posit<32,2>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 3>(bReportIndividualTestCases, OPCODE_MUL, 1000), "posit<32,3>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 1>(reportTestCases, OPCODE_MUL, 1000), "posit<32,1>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 2>(reportTestCases, OPCODE_MUL, 1000), "posit<32,2>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 3>(reportTestCases, OPCODE_MUL, 1000), "posit<32,3>", "multiplication"); #endif #if REGRESSION_LEVEL_4 // nbits=48 is also showing failures - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<48, 2>(bReportIndividualTestCases, OPCODE_MUL, 1000), "posit<48,2>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<48, 2>(reportTestCases, OPCODE_MUL, 1000), "posit<48,2>", "multiplication"); // nbits=64 requires long double compiler support - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 2>(bReportIndividualTestCases, OPCODE_MUL, 1000), "posit<64,2>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 3>(bReportIndividualTestCases, OPCODE_MUL, 1000), "posit<64,3>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 2>(reportTestCases, OPCODE_MUL, 1000), "posit<64,2>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 3>(reportTestCases, OPCODE_MUL, 1000), "posit<64,3>", "multiplication"); // posit<64,4> is hitting subnormal numbers - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(bReportIndividualTestCases, OPCODE_MUL, 1000), "posit<64,4>", "multiplication"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(reportTestCases, OPCODE_MUL, 1000), "posit<64,4>", "multiplication"); #ifdef HARDWARE_ACCELERATION - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<12, 1>(bReportIndividualTestCases), "posit<12,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<14, 1>(bReportIndividualTestCases), "posit<14,1>", "multiplication"); - nrOfFailedTestCases += ReportTestResult(VerifyMultiplication<16, 1>(bReportIndividualTestCases), "posit<16,1>", "multiplication"); + 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"); #endif // HARDWARE_ACCELERATION #endif // REGRESSION_LEVEL_4 -#endif // MANUAL_TESTING - + 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/tests/posit/arithmetic/negation.cpp b/tests/posit/arithmetic/negation.cpp index bc100fce6..2e022755a 100644 --- a/tests/posit/arithmetic/negation.cpp +++ b/tests/posit/arithmetic/negation.cpp @@ -1,9 +1,9 @@ // arithmetic_negate.cpp: test suite runner for posit arithmetic negation // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 // Configure the posit template environment // first: enable general or specialized specialized posit configurations //#define POSIT_FAST_SPECIALIZATION @@ -13,12 +13,8 @@ // when you define POSIT_VERBOSE_OUTPUT executing an negation the code will print intermediate results //#define POSIT_VERBOSE_OUTPUT #define POSIT_TRACE_NEGATE - -// minimum set of include files to reflect source code dependencies -#include -#include -#include -#include +#include +#include #include // generate specific test case that you can trace with the trace conditions in posit.h @@ -32,19 +28,32 @@ void GenerateTestCase(Ty fa) { std::cout << "reference " << pref << " result " << pneg << std::endl << std::endl; } +// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 0 -#define STRESS_TESTING 0 - -int main(int argc, char** argv) +// 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; - bool bReportIndividualTestCases = false; + std::string test_suite = "posit negation validation"; + std::string test_tag = "negation"; + bool reportTestCases = false; int nrOfFailedTestCases = 0; - std::cout << "Posit negation validation\n"; - - std::string tag = "Negation failed: "; + ReportTestSuiteHeader(test_suite, reportTestCases); #if MANUAL_TESTING // generate individual testcases to hand trace/debug @@ -52,53 +61,62 @@ try { GenerateTestCase<5, 0, float>(-0.500f); nrOfFailedTestCases += ReportTestResult(VerifyNegation<5, 0>("Manual Testing: ", 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<2, 0>(bReportIndividualTestCases), "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<3, 0>(bReportIndividualTestCases), "posit<3,0>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<3, 1>(bReportIndividualTestCases), "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<4, 0>(bReportIndividualTestCases), "posit<4,0>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<4, 1>(bReportIndividualTestCases), "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<5, 0>(bReportIndividualTestCases), "posit<5,0>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<5, 1>(bReportIndividualTestCases), "posit<5,1>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<5, 2>(bReportIndividualTestCases), "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<6, 0>(bReportIndividualTestCases), "posit<6,0>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<6, 1>(bReportIndividualTestCases), "posit<6,1>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<6, 2>(bReportIndividualTestCases), "posit<6,2>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<6, 3>(bReportIndividualTestCases), "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<7, 0>(bReportIndividualTestCases), "posit<7,0>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<7, 1>(bReportIndividualTestCases), "posit<7,1>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<7, 2>(bReportIndividualTestCases), "posit<7,2>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<7, 3>(bReportIndividualTestCases), "posit<7,3>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<7, 4>(bReportIndividualTestCases), "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<8, 0>(bReportIndividualTestCases), "posit<8,0>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<8, 1>(bReportIndividualTestCases), "posit<8,1>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<8, 2>(bReportIndividualTestCases), "posit<8,2>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<8, 3>(bReportIndividualTestCases), "posit<8,3>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<8, 4>(bReportIndividualTestCases), "posit<8,4>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<8, 5>(bReportIndividualTestCases), "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"); +#endif - nrOfFailedTestCases += ReportTestResult(VerifyNegation<10, 1>(bReportIndividualTestCases), "posit<10,1>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<12, 1>(bReportIndividualTestCases), "posit<12,1>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<16, 1>(bReportIndividualTestCases), "posit<16,1>", "negation"); +#if REGRESSION_LEVEL_2 +#endif -#if STRESS_TESTING - nrOfFailedTestCases += ReportTestResult(VerifyNegation<20, 1>(bReportIndividualTestCases), "posit<20,1>", "negation"); - nrOfFailedTestCases += ReportTestResult(VerifyNegation<24, 1>(bReportIndividualTestCases), "posit<24,1>", "negation"); +#if REGRESSION_LEVEL_3 +#endif -#endif // STRESS_TESTING +#if REGRESSION_LEVEL_4 + nrOfFailedTestCases += ReportTestResult(VerifyNegation<20, 1>(reportTestCases), "posit<20,1>", "negation"); + nrOfFailedTestCases += ReportTestResult(VerifyNegation<24, 1>(reportTestCases), "posit<24,1>", "negation"); -#endif // MANUAL_TESTING - +#endif // REGRESSION_LEVEL_4 + + 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/tests/posit/arithmetic/reciprocation.cpp b/tests/posit/arithmetic/reciprocation.cpp index ebaf29828..1e580dbc0 100644 --- a/tests/posit/arithmetic/reciprocation.cpp +++ b/tests/posit/arithmetic/reciprocation.cpp @@ -1,9 +1,9 @@ // arithmetic_reciprocate.cpp: test suite runner for posit arithmetic reciprocation // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 // Configure the posit template environment // first: enable general or specialized posit configurations //#define POSIT_FAST_SPECIALIZATION @@ -14,13 +14,8 @@ //#define POSIT_VERBOSE_OUTPUT #define POSIT_TRACE_RECIPROCATE #define POSIT_TRACE_CONVERSION - -// minimum set of include files to reflect source code dependencies -#include -#include -#include -// posit type manipulators such as pretty printers -#include +#include +#include #include // generate specific test case that you can trace with the trace conditions in posit.hpp @@ -36,19 +31,32 @@ void GenerateTestCase(Ty a) { std::cout << "input " << a << " reference 1/fa " << reference << " pref " << double(pref) << '(' << pref << ") result " << double(preciprocal) << '(' << preciprocal << ')' << std::endl; } +// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 0 -#define STRESS_TESTING 0 - -int main(int argc, char** argv) +// 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; - bool bReportIndividualTestCases = false; + std::string test_suite = "posit reciprocation validation"; + std::string test_tag = "reciprocate"; + bool reportTestCases = false; int nrOfFailedTestCases = 0; - std::cout << "Posit reciprocate validation\n"; - - std::string tag = "Reciprocation failed: "; + ReportTestSuiteHeader(test_suite, reportTestCases); #if MANUAL_TESTING // generate individual testcases to hand trace/debug @@ -81,50 +89,61 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<8, 2>(tag, true), "posit<8,2>", "reciprocation"); + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; #else - tag = "Reciprocation failed: "; - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<3, 0>(bReportIndividualTestCases), "posit<3,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<4, 0>(bReportIndividualTestCases), "posit<4,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<4, 1>(bReportIndividualTestCases), "posit<4,1>", "reciprocation"); +#if REGRESSION_LEVEL_1 + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<3, 0>(reportTestCases), "posit<3,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<5, 0>(bReportIndividualTestCases), "posit<5,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<5, 1>(bReportIndividualTestCases), "posit<5,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<5, 2>(bReportIndividualTestCases), "posit<5,2>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<4, 0>(reportTestCases), "posit<4,0>", "reciprocation"); + nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<4, 1>(reportTestCases), "posit<4,1>", "reciprocation"); -#if STRESS_TESTING + 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"); +#endif - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<6, 0>(bReportIndividualTestCases), "posit<6,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<6, 1>(bReportIndividualTestCases), "posit<6,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<6, 2>(bReportIndividualTestCases), "posit<6,2>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<6, 3>(bReportIndividualTestCases), "posit<6,3>", "reciprocation"); +#if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<7, 0>(bReportIndividualTestCases), "posit<7,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<7, 1>(bReportIndividualTestCases), "posit<7,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<7, 2>(bReportIndividualTestCases), "posit<7,2>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<7, 3>(bReportIndividualTestCases), "posit<7,3>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<7, 4>(bReportIndividualTestCases), "posit<7,4>", "reciprocation"); +#endif - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<8, 0>(bReportIndividualTestCases), "posit<8,0>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<8, 1>(bReportIndividualTestCases), "posit<8,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<8, 2>(bReportIndividualTestCases), "posit<8,2>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<8, 3>(bReportIndividualTestCases), "posit<8,3>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<8, 4>(bReportIndividualTestCases), "posit<8,4>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<8, 5>(bReportIndividualTestCases), "posit<8,5>", "reciprocation"); +#if REGRESSION_LEVEL_3 - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<10, 1>(bReportIndividualTestCases), "posit<10,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<12, 1>(bReportIndividualTestCases), "posit<12,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<14, 1>(bReportIndividualTestCases), "posit<14,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<16, 1>(bReportIndividualTestCases), "posit<16,1>", "reciprocation"); +#endif - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<18, 1>(bReportIndividualTestCases), "posit<18,1>", "reciprocation"); - nrOfFailedTestCases += ReportTestResult(VerifyReciprocation<20, 1>(bReportIndividualTestCases), "posit<20,1>", "reciprocation"); +#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"); -#endif // STRESS_TESTING + 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"); -#endif // MANUAL_TESTING + 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"); +#endif // REGRESSION_LEVEL_4 + + 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/tests/posit/arithmetic/sqrt.cpp b/tests/posit/arithmetic/sqrt.cpp index 467372761..3ee5f5fa1 100644 --- a/tests/posit/arithmetic/sqrt.cpp +++ b/tests/posit/arithmetic/sqrt.cpp @@ -1,9 +1,9 @@ // sqrt.cpp: test suite runner for posit sqrt // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 // Configure the posit template environment // first: enable general or specialized posit configurations //#define POSIT_FAST_SPECIALIZATION @@ -13,13 +13,8 @@ // when you define POSIT_VERBOSE_OUTPUT executing an SQRT the code will print intermediate results //#define POSIT_VERBOSE_OUTPUT #define POSIT_TRACE_SQRT - -// minimum set of include files to reflect source code dependencies -#include -#include -#include -#include -#include +#include +#include #include #include #include @@ -41,18 +36,32 @@ void GenerateTestCase(Ty a) { std::cout << std::setprecision(5); } +// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 0 -#define STRESS_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(int argc, char** argv) +int main() try { using namespace sw::universal; - bool bReportIndividualTestCases = true; + std::string test_suite = "posit square root validation"; + std::string test_tag = "sqrt"; + bool reportTestCases = false; int nrOfFailedTestCases = 0; - std::string tag = "Addition failed: "; + ReportTestSuiteHeader(test_suite, reportTestCases); #if MANUAL_TESTING // generate individual testcases to hand trace/debug @@ -107,80 +116,89 @@ try { //nrOfFailedTestCases += ReportTestResult(VerifySqrt<8, 4>("Manual Testing", true), "posit<8,4>", "sqrt"); + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; #else - std::cout << "Posit square root validation\n"; - - nrOfFailedTestCases += ReportTestResult(VerifySqrt<2, 0>(bReportIndividualTestCases), "posit<2,0>", "sqrt"); - - nrOfFailedTestCases += ReportTestResult(VerifySqrt<3, 0>(bReportIndividualTestCases), "posit<3,0>", "sqrt"); -// nrOfFailedTestCases += ReportTestResult(VerifySqrt<3, 1>(bReportIndividualTestCases), "posit<3,1>", "sqrt"); // TODO: these configs where nbits < es+sign+regime don't work - - nrOfFailedTestCases += ReportTestResult(VerifySqrt<4, 0>(bReportIndividualTestCases), "posit<4,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<4, 1>(bReportIndividualTestCases), "posit<4,1>", "sqrt"); - - nrOfFailedTestCases += ReportTestResult(VerifySqrt<5, 0>(bReportIndividualTestCases), "posit<5,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<5, 1>(bReportIndividualTestCases), "posit<5,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<5, 2>(bReportIndividualTestCases), "posit<5,2>", "sqrt"); - - nrOfFailedTestCases += ReportTestResult(VerifySqrt<6, 0>(bReportIndividualTestCases), "posit<6,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<6, 1>(bReportIndividualTestCases), "posit<6,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<6, 2>(bReportIndividualTestCases), "posit<6,2>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<6, 3>(bReportIndividualTestCases), "posit<6,3>", "sqrt"); - - nrOfFailedTestCases += ReportTestResult(VerifySqrt<7, 0>(bReportIndividualTestCases), "posit<7,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<7, 1>(bReportIndividualTestCases), "posit<7,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<7, 2>(bReportIndividualTestCases), "posit<7,2>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<7, 3>(bReportIndividualTestCases), "posit<7,3>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<7, 4>(bReportIndividualTestCases), "posit<7,4>", "sqrt"); - - nrOfFailedTestCases += ReportTestResult(VerifySqrt<8, 0>(bReportIndividualTestCases), "posit<8,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<8, 1>(bReportIndividualTestCases), "posit<8,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<8, 2>(bReportIndividualTestCases), "posit<8,2>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<8, 3>(bReportIndividualTestCases), "posit<8,3>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<8, 4>(bReportIndividualTestCases), "posit<8,4>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<8, 5>(bReportIndividualTestCases), "posit<8,5>", "sqrt"); - - nrOfFailedTestCases += ReportTestResult(VerifySqrt<9, 0>(bReportIndividualTestCases), "posit<9,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<9, 1>(bReportIndividualTestCases), "posit<9,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<9, 2>(bReportIndividualTestCases), "posit<9,2>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<9, 3>(bReportIndividualTestCases), "posit<9,3>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<9, 4>(bReportIndividualTestCases), "posit<9,4>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<9, 5>(bReportIndividualTestCases), "posit<9,5>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<9, 6>(bReportIndividualTestCases), "posit<9,6>", "sqrt"); +#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<10, 0>(bReportIndividualTestCases), "posit<10,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<10, 1>(bReportIndividualTestCases), "posit<10,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<10, 2>(bReportIndividualTestCases), "posit<10,2>", "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"); // fails due to regime representation not being able to be represented by double - // nrOfFailedTestCases += ReportTestResult(VerifySqrt<10, 7>(bReportIndividualTestCases), "posit<10,7>", "sqrt"); + // nrOfFailedTestCases += ReportTestResult(VerifySqrt<10, 7>(reportTestCases), "posit<10,7>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<12, 0>(bReportIndividualTestCases), "posit<12,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<12, 1>(bReportIndividualTestCases), "posit<12,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<12, 2>(bReportIndividualTestCases), "posit<12,2>", "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<16, 0>(bReportIndividualTestCases), "posit<16,0>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<16, 1>(bReportIndividualTestCases), "posit<16,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<16, 2>(bReportIndividualTestCases), "posit<16,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"); +#endif +#if REGRESSION_LEVEL_2 -#if STRESS_TESTING - // nbits=64 requires long double compiler support - nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(bReportIndividualTestCases, OPCODE_SQRT, 1000), "posit<64,2>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 3>(bReportIndividualTestCases, OPCODE_SQRT, 1000), "posit<64,3>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 4>(bReportIndividualTestCases, OPCODE_SQRT, 1000), "posit<64,4>", "sqrt"); +#endif +#if REGRESSION_LEVEL_3 - nrOfFailedTestCases += ReportTestResult(VerifySqrt<10, 1>(bReportIndividualTestCases), "posit<10,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<12, 1>(bReportIndividualTestCases), "posit<12,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<14, 1>(bReportIndividualTestCases), "posit<14,1>", "sqrt"); - nrOfFailedTestCases += ReportTestResult(VerifySqrt<16, 1>(bReportIndividualTestCases), "posit<16,1>", "sqrt"); - -#endif // STRESS_TESTING +#endif + +#if REGRESSION_LEVEL_4 + // nbits=64 requires long double compiler support + nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(reportTestCases, OPCODE_SQRT, 1000), "posit<64,2>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 3>(reportTestCases, OPCODE_SQRT, 1000), "posit<64,3>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 4>(reportTestCases, OPCODE_SQRT, 1000), "posit<64,4>", "sqrt"); -#endif // MANUAL_TESTING + nrOfFailedTestCases += ReportTestResult(VerifySqrt<10, 1>(reportTestCases), "posit<10,1>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt<12, 1>(reportTestCases), "posit<12,1>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt<14, 1>(reportTestCases), "posit<14,1>", "sqrt"); + nrOfFailedTestCases += ReportTestResult(VerifySqrt<16, 1>(reportTestCases), "posit<16,1>", "sqrt"); +#endif // REGRESSION_LEVEL_4 + + 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/tests/posit/arithmetic/subtraction.cpp b/tests/posit/arithmetic/subtraction.cpp index ccf832332..3bf06c78c 100644 --- a/tests/posit/arithmetic/subtraction.cpp +++ b/tests/posit/arithmetic/subtraction.cpp @@ -1,9 +1,9 @@ -// arithmetic_subtract.cpp: test suite runner for posit subtraction +// subtraction.cpp: test suite runner for posit subtraction // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 // Configure the posit template environment // first: enable general or specialized posit configurations //#define POSIT_FAST_SPECIALIZATION @@ -13,14 +13,8 @@ // when you define POSIT_VERBOSE_OUTPUT executing an SUB the code will print intermediate results //#define POSIT_VERBOSE_OUTPUT #define POSIT_TRACE_SUB - -// minimum set of include files to reflect source code dependencies -#include -#include -#include -#include -#include -//#include +#include +#include #include #include @@ -58,15 +52,16 @@ void GenerateTestCase(Ty a, Ty b) { #define REGRESSION_LEVEL_4 1 #endif -int main(int argc, char** argv) +int main() try { using namespace sw::universal; - std::cout << "Posit subtraction validation\n"; - bool bReportIndividualTestCases = false; + std::string test_suite = "posit subtraction validation"; + std::string test_tag = "subtraction"; + bool reportTestCases = false; int nrOfFailedTestCases = 0; - std::string tag = "Subtraction failed: "; + ReportTestSuiteHeader(test_suite, reportTestCases); #if MANUAL_TESTING @@ -95,82 +90,84 @@ try { std::cout << ba << '\n'; //nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<48, 2>(tag, true, OPCODE_SUB, 1000), "posit<48,2>", "subtraction"); - + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; #else #if REGRESSION_LEVEL_1 - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<2, 0>(bReportIndividualTestCases), "posit< 2,0>", "subtraction"); - - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<3, 0>(bReportIndividualTestCases), "posit< 3,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<3, 1>(bReportIndividualTestCases), "posit< 3,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<3, 2>(bReportIndividualTestCases), "posit< 3,2>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<3, 3>(bReportIndividualTestCases), "posit< 3,3>", "subtraction"); - - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 0>(bReportIndividualTestCases), "posit< 4,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 1>(bReportIndividualTestCases), "posit< 4,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<4, 2>(bReportIndividualTestCases), "posit< 4,2>", "subtraction"); - - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<5, 0>(bReportIndividualTestCases), "posit< 5,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<5, 1>(bReportIndividualTestCases), "posit< 5,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<5, 2>(bReportIndividualTestCases), "posit< 5,2>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<5, 3>(bReportIndividualTestCases), "posit< 5,3>", "subtraction"); - - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<6, 0>(bReportIndividualTestCases), "posit< 6,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<6, 1>(bReportIndividualTestCases), "posit< 6,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<6, 2>(bReportIndividualTestCases), "posit< 6,2>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<6, 3>(bReportIndividualTestCases), "posit< 6,3>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<6, 4>(bReportIndividualTestCases), "posit< 6,4>", "subtraction"); - - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<7, 0>(bReportIndividualTestCases), "posit< 7,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<7, 1>(bReportIndividualTestCases), "posit< 7,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<7, 2>(bReportIndividualTestCases), "posit< 7,2>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<7, 3>(bReportIndividualTestCases), "posit< 7,3>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<7, 4>(bReportIndividualTestCases), "posit< 7,4>", "subtraction"); - - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<8, 0>(bReportIndividualTestCases), "posit< 8,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<8, 1>(bReportIndividualTestCases), "posit< 8,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<8, 2>(bReportIndividualTestCases), "posit< 8,2>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<8, 3>(bReportIndividualTestCases), "posit< 8,3>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<8, 4>(bReportIndividualTestCases), "posit< 8,4>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<8, 5>(bReportIndividualTestCases), "posit< 8,5>", "subtraction"); + 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"); #endif #if REGRESSION_LEVEL_2 - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<10, 0>(bReportIndividualTestCases), "posit<10,0>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<10, 1>(bReportIndividualTestCases), "posit<10,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<10, 2>(bReportIndividualTestCases), "posit<10,2>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<10, 3>(bReportIndividualTestCases), "posit<10,3>", "subtraction"); + 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(VerifyBinaryOperatorThroughRandoms<16, 2>(bReportIndividualTestCases, OPCODE_SUB, 1000), "posit<16,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<24, 2>(bReportIndividualTestCases, OPCODE_SUB, 1000), "posit<24,1>", "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"); #endif #if REGRESSION_LEVEL_3 - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 1>(bReportIndividualTestCases, OPCODE_SUB, 1000), "posit<32,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 2>(bReportIndividualTestCases, OPCODE_SUB, 1000), "posit<32,2>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 3>(bReportIndividualTestCases, OPCODE_SUB, 1000), "posit<32,3>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 1>(reportTestCases, OPCODE_SUB, 1000), "posit<32,1>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 2>(reportTestCases, OPCODE_SUB, 1000), "posit<32,2>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<32, 3>(reportTestCases, OPCODE_SUB, 1000), "posit<32,3>", "subtraction"); #endif #if REGRESSION_LEVEL_4 // nbits=48 is showing failures - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<48, 2>(bReportIndividualTestCases, OPCODE_SUB, 1000), "posit<48,2>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<48, 2>(reportTestCases, OPCODE_SUB, 1000), "posit<48,2>", "subtraction"); // nbits=64 requires long double compiler support - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 2>(bReportIndividualTestCases, OPCODE_SUB, 1000), "posit<64,2>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 3>(bReportIndividualTestCases, OPCODE_SUB, 1000), "posit<64,3>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(bReportIndividualTestCases, OPCODE_SUB, 1000), "posit<64,4>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 2>(reportTestCases, OPCODE_SUB, 1000), "posit<64,2>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 3>(reportTestCases, OPCODE_SUB, 1000), "posit<64,3>", "subtraction"); + nrOfFailedTestCases += ReportTestResult(VerifyBinaryOperatorThroughRandoms<64, 4>(reportTestCases, OPCODE_SUB, 1000), "posit<64,4>", "subtraction"); #ifdef HARDWARE_ACCELERATION - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<12, 1>(bReportIndividualTestCases), "posit<12,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<14, 1>(bReportIndividualTestCases), "posit<14,1>", "subtraction"); - nrOfFailedTestCases += ReportTestResult(VerifySubtraction<16, 1>(bReportIndividualTestCases), "posit<16,1>", "subtraction"); + 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"); #endif // HARDWARE_ACCELERATION #endif // REGRESSION_LEVEL_4 -#endif // MANUAL_TESTING - + 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/tests/posit/conversion/README.md b/tests/posit/conversion/README.md new file mode 100644 index 000000000..0b9874ea4 --- /dev/null +++ b/tests/posit/conversion/README.md @@ -0,0 +1,9 @@ +July 19, 2022 ETLO + +conversion_algorithm_development.cpp_ contains code experiments to develop and test the conversion functions for posits. +Testing these functions based on first principles turned out to be a bust, but there is interesting notes in this +file that I wanted to preserve. I have given it the .cpp_ extension to have it ignored in the cmake process, but still +carry the information that this was a regression test file for the posit number. + +I tried to clean up the warnings yesterday, but was not entirely successful, and introduced a segfault for gcc. As this +is not a working regression test, I removed it from the testing set. \ No newline at end of file diff --git a/tests/posit/conversion/assignment.cpp b/tests/posit/conversion/assignment.cpp new file mode 100644 index 000000000..cbdb21405 --- /dev/null +++ b/tests/posit/conversion/assignment.cpp @@ -0,0 +1,159 @@ +// assignment.cpp : test suite runner for native type literal assignments for posits +// +// Copyright (C) 2017-2021 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 { + + template + int ValidateAssignment(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 + sw::universal::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; + // TODO: how to make this work for integers: std::cout << p << " " << value << " " << assigned << std::endl; + if (p != assigned) { + nrOfFailedTestCases++; + if (reportTestCases) ReportAssignmentError("FAIL", "=", p, assigned, value); + } + else { + //if (reportTestCases) ReportAssignmentSuccess("PASS", "=", p, assigned, value); + } + } + return nrOfFailedTestCases; + } + +} } // namespace sw::universal + +template +Ty GenerateValue(const sw::universal::posit& p) { + Ty value = 0; + if (std::numeric_limits::is_exact) { + if (std::numeric_limits::is_signed) { + value = (long long)(p); + } + else { + value = (unsigned long long)(p); + } + } + else { + value = (long double)(p); + } + return value; +} + +// 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; + + std::string test_suite = "posit assignment validation"; + std::string test_tag = "assignment"; + bool reportTestCases = false; + int nrOfFailedTestCases = 0; + + ReportTestSuiteHeader(test_suite, reportTestCases); + +#if MANUAL_TESTING + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; +#else + +#if REGRESSION_LEVEL_1 + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<3, 0, float>(reportTestCases), test_tag, "posit<3,0>"); + + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<4, 0, float>(reportTestCases), test_tag, "posit<4,0>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<4, 1, float>(reportTestCases), test_tag, "posit<4,1>"); + + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<5, 0, float>(reportTestCases), test_tag, "posit<5,0>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<5, 1, float>(reportTestCases), test_tag, "posit<5,1>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<5, 2, float>(reportTestCases), test_tag, "posit<5,2>"); + + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<6, 0, float>(reportTestCases), test_tag, "posit<6,0>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<6, 1, float>(reportTestCases), test_tag, "posit<6,1>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<6, 2, float>(reportTestCases), test_tag, "posit<6,2>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<6, 3, float>(reportTestCases), test_tag, "posit<6,3>"); + + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<7, 0, float>(reportTestCases), test_tag, "posit<7,0>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<7, 1, float>(reportTestCases), test_tag, "posit<7,1>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<7, 2, float>(reportTestCases), test_tag, "posit<7,2>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<7, 3, float>(reportTestCases), test_tag, "posit<7,3>"); + + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<8, 0, float>(reportTestCases), test_tag, "posit<8,0>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<8, 1, float>(reportTestCases), test_tag, "posit<8,1>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<8, 2, float>(reportTestCases), test_tag, "posit<8,2>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<8, 3, float>(reportTestCases), test_tag, "posit<8,3>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<8, 4, float>(reportTestCases), test_tag, "posit<8,4>"); + + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<9, 0, float>(reportTestCases), test_tag, "posit<9,0>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<9, 1, float>(reportTestCases), test_tag, "posit<9,1>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<9, 2, float>(reportTestCases), test_tag, "posit<9,2>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<9, 3, float>(reportTestCases), test_tag, "posit<9,3>"); + nrOfFailedTestCases = ReportTestResult(ValidateAssignment<9, 4, float>(reportTestCases), test_tag, "posit<9,4>"); +#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; + return EXIT_FAILURE; +} +catch (const sw::universal::posit_arithmetic_exception& err) { + std::cerr << "Uncaught posit arithmetic exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (const sw::universal::posit_internal_exception& err) { + std::cerr << "Uncaught posit internal exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (const std::runtime_error& err) { + std::cerr << "Uncaught runtime exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} + + + diff --git a/tests/posit/conversion/conversion.cpp b/tests/posit/conversion/conversion.cpp index 03cfc9b95..465853333 100644 --- a/tests/posit/conversion/conversion.cpp +++ b/tests/posit/conversion/conversion.cpp @@ -1,17 +1,16 @@ // conversion.cpp : test suite runner for conversion operators to posit numbers // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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 // if you want to trace the posit intermediate results // #define POSIT_VERBOSE_OUTPUT #define POSIT_TRACE_CONVERT // enable the ability to use literals in binary logic and arithmetic operators #define POSIT_ENABLE_LITERALS 1 -// minimum set of include files to reflect source code dependencies -#include -#include +#include +#include #include template @@ -175,17 +174,32 @@ void GenerateTestCase(double input, double reference, const sw::universal::posit std::cout << std::endl; } +// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 0 -#define STRESS_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(int argc, char** argv) +int main() try { using namespace sw::universal; - bool bReportIndividualTestCases = false; + std::string test_suite = "posit conversion validation"; + std::string test_tag = "conversion"; + bool reportTestCases = false; int nrOfFailedTestCases = 0; - std::string tag = "Conversion test"; + ReportTestSuiteHeader(test_suite, reportTestCases); #if MANUAL_TESTING // generate individual testcases to hand trace/debug @@ -207,92 +221,99 @@ try { cout << "----------------\n"; #endif - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<3, 0>(true), "posit<3,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<4, 0>(true), "posit<4,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<5, 0>(true), "posit<5,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<6, 0>(true), "posit<6,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<7, 0>(true), "posit<7,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<8, 0>(true), "posit<8,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<9, 0>(true), "posit<9,0>", "conversion"); - - nrOfFailedTestCases += ReportTestResult(VerifyConversion<3, 0>(true), "posit<3,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<4, 1>(true), "posit<4,1>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<5, 2>(true), "posit<5,2>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<6, 3>(true), "posit<6,3>", "conversion"); - - nrOfFailedTestCases += ReportTestResult(VerifyConversion<4, 0>(true), "posit<4,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<4, 1>(true), "posit<4,1>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<5, 0>(true), "posit<5,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<5, 1>(true), "posit<5,1>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<5, 2>(true), "posit<5,2>", "conversion"); - + 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(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<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); + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; #else - std::cout << "Posit conversion validation\n"; - - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<3, 0>(bReportIndividualTestCases), "posit<3,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<4, 0>(bReportIndividualTestCases), "posit<4,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<5, 0>(bReportIndividualTestCases), "posit<5,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<6, 0>(bReportIndividualTestCases), "posit<6,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<7, 0>(bReportIndividualTestCases), "posit<7,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<8, 0>(bReportIndividualTestCases), "posit<8,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyIntegerConversion<9, 0>(bReportIndividualTestCases), "posit<9,0>", "conversion"); - - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 3, 0>(bReportIndividualTestCases), "posit<3,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 4, 0>(bReportIndividualTestCases), "posit<4,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 5, 0>(bReportIndividualTestCases), "posit<5,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 6, 0>(bReportIndividualTestCases), "posit<6,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 7, 0>(bReportIndividualTestCases), "posit<7,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 0>(bReportIndividualTestCases), "posit<8,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 0>(bReportIndividualTestCases), "posit<9,0>", "conversion"); - - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 4, 1>(bReportIndividualTestCases), "posit<4,1>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 5, 1>(bReportIndividualTestCases), "posit<5,1>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 6, 1>(bReportIndividualTestCases), "posit<6,1>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 7, 1>(bReportIndividualTestCases), "posit<7,1>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 1>(bReportIndividualTestCases), "posit<8,1>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 1>(bReportIndividualTestCases), "posit<9,1>", "conversion"); - - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 5, 2>(bReportIndividualTestCases), "posit<5,2>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 6, 2>(bReportIndividualTestCases), "posit<6,2>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 7, 2>(bReportIndividualTestCases), "posit<7,2>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 2>(bReportIndividualTestCases), "posit<8,2>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 2>(bReportIndividualTestCases), "posit<9,2>", "conversion"); - - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 6, 3>(bReportIndividualTestCases), "posit<6,3>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 7, 3>(bReportIndividualTestCases), "posit<7,3>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 8, 3>(bReportIndividualTestCases), "posit<8,3>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion< 9, 3>(bReportIndividualTestCases), "posit<9,3>", "conversion"); - - -#if STRESS_TESTING - - nrOfFailedTestCases += ReportTestResult(VerifyConversion<10, 0>(bReportIndividualTestCases), "posit<10,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<10, 1>(bReportIndividualTestCases), "posit<10,1>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<10, 2>(bReportIndividualTestCases), "posit<10,2>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<10, 3>(bReportIndividualTestCases), "posit<10,3>", "conversion"); - - nrOfFailedTestCases += ReportTestResult(VerifyConversion<12, 0>(bReportIndividualTestCases), "posit<12,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<12, 1>(bReportIndividualTestCases), "posit<12,1>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<12, 2>(bReportIndividualTestCases), "posit<12,2>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<12, 3>(bReportIndividualTestCases), "posit<12,3>", "conversion"); - - nrOfFailedTestCases += ReportTestResult(VerifyConversion<14, 0>(bReportIndividualTestCases), "posit<14,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<14, 1>(bReportIndividualTestCases), "posit<14,1>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<14, 2>(bReportIndividualTestCases), "posit<14,2>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<14, 3>(bReportIndividualTestCases), "posit<14,3>", "conversion"); +#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(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< 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< 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< 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); +#endif - nrOfFailedTestCases += ReportTestResult(VerifyConversion<16, 0>(true), "posit<16,0>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<16, 1>(bReportIndividualTestCases), "posit<16,1>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<16, 2>(bReportIndividualTestCases), "posit<16,2>", "conversion"); - nrOfFailedTestCases += ReportTestResult(VerifyConversion<16, 3>(bReportIndividualTestCases), "posit<16,3>", "conversion"); +#if REGRESSION_LEVEL_2 -#endif // STRESS_TESTING +#endif +#if REGRESSION_LEVEL_3 -#endif // MANUAL_TESTING +#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<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<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<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); +#endif // REGRESSION_LEVEL_4 + + 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/tests/posit/conversion/conversion_functions.cpp b/tests/posit/conversion/conversion_algorithm_development.cpp_ similarity index 93% rename from tests/posit/conversion/conversion_functions.cpp rename to tests/posit/conversion/conversion_algorithm_development.cpp_ index 57d85798f..af3271a3c 100644 --- a/tests/posit/conversion/conversion_functions.cpp +++ b/tests/posit/conversion/conversion_algorithm_development.cpp_ @@ -1,12 +1,11 @@ // conversion_functions.cpp : api experiments for conversion algorithms // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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. - -// minimum set of include files -#include "universal/number/posit/posit_impl.hpp" -#include "universal/number/posit/manipulators.hpp" +#include +#include +#include template void GenerateLogicPattern(double input, const sw::universal::posit& presult, const sw::universal::posit& pnext) { @@ -196,7 +195,7 @@ bool increment_bitblock(sw::universal::bitblock& number) { for (size_t i = 0; i < nbits; i++) { bool _a = number[i]; number[i] = _a ^ carry; - carry = carry & (_a ^ false); + carry = carry && (_a ^ false); } return carry; } @@ -208,7 +207,7 @@ bool decrement_bitblock(sw::universal::bitblock& number) { for (size_t i = 0; i < nbits; i++) { bool _a = number[i]; number[i] = _a ^ borrow; - borrow = (!(!_a ^ true) & borrow); + borrow = (!(!_a ^ true) && borrow); } return borrow; } @@ -296,17 +295,21 @@ void convert_to_posit(float x, bool bPrintIntermediateSteps = false) { #else float e = std::floor(std::log2(y)); #endif + + if (bPrintIntermediateSteps) std::cout << "e = " << e << '\n'; float f = y / float(pow(2.0, scale)) - 1.0f; if (bPrintIntermediateSteps) std::cout << "f = " << f << '\n'; if (bPrintIntermediateSteps) std::cout << "bits = " << bits << '\n'; - int run = (int)std::abs(std::floor(e / pow(2, es))) + r; + unsigned run = static_cast(std::abs(std::floor(e / pow(2, es)))) + r; if (bPrintIntermediateSteps) std::cout << "run = " << run << '\n'; - unsigned _run = (r ? 1 + (scale >> es) : -(scale >> es)); + + unsigned _run = static_cast(r ? 1 + (scale >> es) : -(scale >> es)); if (bPrintIntermediateSteps) std::cout << "_run = " << _run << '\n'; + // reg = BitOr[BitShiftLeft[r * (2^run - 1), 1], BitXor[1, r]]; regime.set(0, 1 ^ r); - for (int i = 1; i <= run; i++) regime.set(i, r); + for (size_t i = 1; i <= run; ++i) regime.set(i, r); if (bPrintIntermediateSteps) std::cout << "reg = " << LowerSegment(regime,run) << '\n'; sw::universal::regime _reg; _reg.assign(scale); if (bPrintIntermediateSteps) std::cout << "_reg = " << _reg << '\n'; @@ -318,9 +321,9 @@ void convert_to_posit(float x, bool bPrintIntermediateSteps = false) { // copy the most significant nf fraction bits into fraction for (int i = 0; i < (int)nf; i++) fraction[i] = bits[nrfbits - nf + i]; if (bPrintIntermediateSteps) std::cout << "fraction = " << fraction << '\n'; - float fv = (float)std::floor((double)(f * (unsigned(1) << nf))); + float fv = std::floor(f * float(unsigned(1) << nf)); if (bPrintIntermediateSteps) std::cout << "fv = " << fv << '\n'; - bool sb = ((f * (unsigned(1) << nf)) > fv); + bool sb = ((f * float(unsigned(1) << nf)) > fv); if (bPrintIntermediateSteps) std::cout << "sb = " << (sb ? "1" : "0") << '\n'; // construct the bigger posit @@ -368,6 +371,7 @@ void convert_to_posit(float x, bool bPrintIntermediateSteps = false) { posit p; p.setbits(ptt_t.to_ullong()); std::cout << "p = " << components(p) << '\n'; + } template @@ -621,17 +625,32 @@ void GenerateTestSample(int quadrant, bool bPrintIntermediateSteps = false) { std::cout << components_to_string(p3) << '\n'; } +// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 1 -#define STRESS_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; - //bool bReportIndividualTestCases = false; + std::string test_suite = "posit conversion validation"; + std::string test_tag = test_tag; + bool reportTestCases = false; int nrOfFailedTestCases = 0; - std::string tag = "Conversion failed: "; + ReportTestSuiteHeader(test_suite, reportTestCases); #if MANUAL_TESTING const size_t nbits = 5; @@ -650,20 +669,33 @@ try { convert_to_posit(f2, true); convert_to_posit(f3, true); + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; #else + +#if REGRESSION_LEVEL_1 ReportPositScales(); GenerateLogicPatternsForDebug<5, 0>(); GenerateLogicPatternsForDebug<5, 1>(); GenerateLogicPatternsForDebug<5, 2>(); +#endif -#if STRESS_TESTING +#if REGRESSION_LEVEL_2 -#endif // STRESS_TESTING +#endif -#endif // MANUAL_TESTING +#if REGRESSION_LEVEL_3 +#endif + +#if REGRESSION_LEVEL_4 +#endif // REGRESSION_LEVEL_4 + + 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/tests/posit/logic/logic.cpp b/tests/posit/logic/logic.cpp index 2f9ede0f0..149b048fe 100644 --- a/tests/posit/logic/logic.cpp +++ b/tests/posit/logic/logic.cpp @@ -1,27 +1,42 @@ // logic.cpp :test suite runner for logic operators between posits // -// Copyright (C) 2017-2021 Stillwater Supercomputing, Inc. +// 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. - -// minimum set of include files to reflect source code dependencies +#include // enable literals to simplify the testing codes #define POSIT_ENABLE_LITERALS 1 -#include -#include -#include -#include // as we are catching quire exceptions +#include +#include #include +// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override #define MANUAL_TESTING 0 -#define STRESS_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; + std::string test_suite = "posit logic operator validation"; + std::string test_tag = "comparisons"; + bool reportTestCases = false; int nrOfFailedTestCases = 0; + ReportTestSuiteHeader(test_suite, reportTestCases); + #if MANUAL_TESTING { @@ -54,10 +69,12 @@ try { nrOfFailedTestCases += ReportTestResult(VerifyPositLogicGreaterOrEqualThan<3, 0>(), "posit<3,0>", ">="); } - + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return EXIT_SUCCESS; #else posit<16, 1> p; +#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>", "=="); @@ -324,21 +341,29 @@ try { else { ReportTestResult(0, "posit<16,1> >= 0.0", ">= long double literal"); } +#endif + +#if REGRESSION_LEVEL_2 + +#endif -#if STRESS_TESTING +#if REGRESSION_LEVEL_3 +#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>", ">="); +#endif // REGRESSION_LEVEL_4 -#endif // STRESS_TESTING - -#endif // MANUAL_TESTING - + 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/tests/posit/math/exponent.cpp b/tests/posit/math/exponent.cpp index 25915c548..e2ae86b32 100644 --- a/tests/posit/math/exponent.cpp +++ b/tests/posit/math/exponent.cpp @@ -14,7 +14,7 @@ #include #include -// generate specific test case that you can trace with the trace conditions in posit.h +// 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 template void GenerateTestCase(Ty a) { diff --git a/tests/posit/math/hyperbolic.cpp b/tests/posit/math/hyperbolic.cpp index e41f28b57..da4735422 100644 --- a/tests/posit/math/hyperbolic.cpp +++ b/tests/posit/math/hyperbolic.cpp @@ -13,7 +13,7 @@ #include #include -// generate specific test case that you can trace with the trace conditions in posit.h +// 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 template void GenerateTestCaseSinh(Ty a) { diff --git a/tests/posit/math/hypotenuse.cpp b/tests/posit/math/hypotenuse.cpp new file mode 100644 index 000000000..c852558ff --- /dev/null +++ b/tests/posit/math/hypotenuse.cpp @@ -0,0 +1,114 @@ +// hypotenuse.cpp: test suite runner for the hypotenuse functions (hypot, hypotf, hypotl) +// +// 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 +// when you define POSIT_VERBOSE_OUTPUT the code will print intermediate results for selected arithmetic operations +//#define POSIT_VERBOSE_OUTPUT +#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 +template +void GenerateTestCase(Ty _a, Ty _b) { + sw::universal::posit a, b, pref, result; + a = _a; + b = _b; + Ty ref = std::hypot(_a, _b); + pref = ref; + result = sw::universal::hypot(a, b); + std::cout << std::setprecision(nbits - 2); + std::cout << " hypot(" << _a << ", " << _b << ") = " << ref << '\n'; + std::cout << " hypot(" << a << ", " << b << ") = " << result << " : " << to_binary(result) << " (reference: " << to_binary(pref) << ") "; + std::cout << (pref == result ? "PASS" : "FAIL") << "\n\n"; + std::cout << std::setprecision(5); +} + + +// 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 0 +#define REGRESSION_LEVEL_4 0 +#endif + + +int main() +try { + using namespace sw::universal; + + std::string test_suite = "posit hypotenuse validation"; + std::string test_tag = "hypotenuse"; + bool reportTestCases = false; + int nrOfFailedTestCases = 0; + + ReportTestSuiteHeader(test_suite, reportTestCases); + +#if MANUAL_TESTING + // generate individual testcases to hand trace/debug + 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"); + + 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"); + +#endif + +#if REGRESSION_LEVEL_2 + +#endif + +#if REGRESSION_LEVEL_3 + +#endif + +#if REGRESSION_LEVEL_4 + // nbits=64 requires long double compiler support + nrOfFailedTestCases += ReportTestResult(VerifyThroughRandoms<64, 2>(reportTestCases, OPCODE_SQRT, 1000), "posit<64,2>", "hypot"); +#endif + + ReportTestSuiteResults(test_suite, nrOfFailedTestCases); + return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); + +#endif // MANUAL_TESTING +} +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 (const std::runtime_error& err) { + std::cerr << "Caught runtime exception: " << err.what() << std::endl; + return EXIT_FAILURE; +} +catch (...) { + std::cerr << "Caught unknown exception" << std::endl; + return EXIT_FAILURE; +} diff --git a/tests/posit/math/logarithm.cpp b/tests/posit/math/logarithm.cpp index 26307a157..2ee8e67a8 100644 --- a/tests/posit/math/logarithm.cpp +++ b/tests/posit/math/logarithm.cpp @@ -1,4 +1,4 @@ -// function_logarithm.cpp: test suite runner for the logarithm functions (log2, log10, ln) +// logarithm.cpp: test suite runner for the logarithm functions (log2, log10, ln) // // Copyright (C) 2017-2022 Stillwater Supercomputing, Inc. // @@ -13,7 +13,7 @@ #include #include -// generate specific test case that you can trace with the trace conditions in posit.h +// 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 template void GenerateTestCase(Ty a) { diff --git a/tests/posit/math/pow.cpp b/tests/posit/math/pow.cpp index 1dae8cf4b..8a0841af4 100644 --- a/tests/posit/math/pow.cpp +++ b/tests/posit/math/pow.cpp @@ -14,7 +14,7 @@ #include #include // for ipow -// generate specific test case that you can trace with the trace conditions in posit.h +// 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 template void GenerateTestCase(Ty a, Ty b) { diff --git a/tests/posit/math/trigonometry.cpp b/tests/posit/math/trigonometry.cpp index 7b2e82f74..53c6fa67d 100644 --- a/tests/posit/math/trigonometry.cpp +++ b/tests/posit/math/trigonometry.cpp @@ -4,12 +4,9 @@ // // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include - // when you define POSIT_VERBOSE_OUTPUT the code will print intermediate results for selected arithmetic operations //#define POSIT_VERBOSE_OUTPUT #define POSIT_TRACE_SQRT - -// use default number system library configuration #include #include @@ -164,7 +161,7 @@ double haversine(double lat1, double lon1, double lat2, double lon2, double radi return radius * c; } -// generate specific test case that you can trace with the trace conditions in posit.h +// 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 template void GenerateTestCase(Ty a) { diff --git a/tests/posit/math/truncate.cpp b/tests/posit/math/truncate.cpp index 7a1a7e8c3..f34b0edb8 100644 --- a/tests/posit/math/truncate.cpp +++ b/tests/posit/math/truncate.cpp @@ -25,28 +25,98 @@ #endif namespace sw { namespace universal { -template -int VerifyFloor(bool bReportIndividualTestCases) { - using namespace sw::universal; - constexpr size_t NR_VALUES = (1 << nbits); - int nrOfFailedTestCases = 0; - posit p; - for (size_t i = 0; i < NR_VALUES; ++i) { - p.setbits(i); - long l1 = long(sw::universal::floor(p)); - // generate the reference - float f = float(p); - long l2 = long(std::floor(f)); - if (l1 != l2) { - ++nrOfFailedTestCases; - if (bReportIndividualTestCases) - ReportOneInputFunctionError("floor", "floor", - p, posit(l1), posit(l2)); + template + int VerifyFloor(bool reportTestCases) { + using namespace sw::universal; + constexpr size_t NR_VALUES = (1 << nbits); + int nrOfFailedTestCases = 0; + + posit p; + for (size_t i = 0; i < NR_VALUES; ++i) { + p.setbits(i); + long l1 = long(sw::universal::floor(p)); + // generate the reference + float f = float(p); + long l2 = long(std::floor(f)); + if (l1 != l2) { + ++nrOfFailedTestCases; + if (reportTestCases) + ReportOneInputFunctionError("floor", "floor", + p, posit(l1), posit(l2)); + } } + return nrOfFailedTestCases; + } + + template + int VerifyCeil(bool reportTestCases) { + using namespace sw::universal; + constexpr size_t NR_VALUES = (1 << nbits); + int nrOfFailedTestCases = 0; + + posit p; + for (size_t i = 0; i < NR_VALUES; ++i) { + p.setbits(i); + long l1 = long(sw::universal::ceil(p)); + // generate the reference + float f = float(p); + long l2 = long(std::ceil(f)); + if (l1 != l2) { + ++nrOfFailedTestCases; + if (reportTestCases) + ReportOneInputFunctionError("ceil", "ceil", + p, posit(l1), posit(l2)); + } + } + return nrOfFailedTestCases; + } + + template + int VerifyTrunc(bool reportTestCases) { + using namespace sw::universal; + constexpr size_t NR_VALUES = (1 << nbits); + int nrOfFailedTestCases = 0; + + posit p; + for (size_t i = 0; i < NR_VALUES; ++i) { + p.setbits(i); + long l1 = long(sw::universal::trunc(p)); + // generate the reference + float f = float(p); + long l2 = long(std::trunc(f)); + if (l1 != l2) { + ++nrOfFailedTestCases; + if (reportTestCases) + ReportOneInputFunctionError("trunc", "trunc", + p, posit(l1), posit(l2)); + } + } + return nrOfFailedTestCases; + } + + template + int VerifyRound(bool reportTestCases) { + using namespace sw::universal; + constexpr size_t NR_VALUES = (1 << nbits); + int nrOfFailedTestCases = 0; + + posit p; + for (size_t i = 0; i < NR_VALUES; ++i) { + p.setbits(i); + long l1 = long(sw::universal::round(p)); + // generate the reference + float f = float(p); + long l2 = long(std::round(f)); + if (l1 != l2) { + ++nrOfFailedTestCases; + if (reportTestCases) + ReportOneInputFunctionError("round", "round", + p, posit(l1), posit(l2)); + } + } + return nrOfFailedTestCases; } - return nrOfFailedTestCases; -} } } // namespace sw::universal @@ -55,9 +125,9 @@ int main() try { using namespace sw::universal; - std::string test_suite = "posit trancate function validation"; - std::string test_tag = "truncate failed: "; - bool reportTestCases = false; + std::string test_suite = "posit truncate function validation"; + std::string test_tag = "truncate failed: "; + bool reportTestCases = false; int nrOfFailedTestCases = 0; ReportTestSuiteHeader(test_suite, reportTestCases); @@ -65,13 +135,21 @@ try { #if MANUAL_TESTING // generate individual testcases to hand trace/debug - nrOfFailedTestCases = ReportTestResult(VerifyFloor<6, 0>(bReportIndividualTestCases), "floor", "floor<4,0>()"); + nrOfFailedTestCases = ReportTestResult(VerifyTrunc<4, 0>(reportTestCases), "trunc", "posit<4,0>()"); + nrOfFailedTestCases = ReportTestResult(VerifyRound<4, 0>(reportTestCases), "round", "posit<4,0>()"); + nrOfFailedTestCases = ReportTestResult(VerifyFloor<4, 0>(reportTestCases), "floor", "posit<4,0>()"); + nrOfFailedTestCases = ReportTestResult(VerifyCeil<4, 0>(reportTestCases), "ceil", "posit<4,0>()"); ReportTestSuiteResults(test_suite, nrOfFailedTestCases); return EXIT_SUCCESS; // ignore errors #else #if REGRESSION_LEVEL_1 + nrOfFailedTestCases = ReportTestResult(VerifyTrunc<6, 2>(reportTestCases), "trunc", "posit<6,2>()"); + nrOfFailedTestCases = ReportTestResult(VerifyRound<6, 2>(reportTestCases), "round", "posit<6,2>()"); + nrOfFailedTestCases = ReportTestResult(VerifyFloor<6, 2>(reportTestCases), "floor", "posit<6,2>()"); + nrOfFailedTestCases = ReportTestResult(VerifyCeil<6, 2>(reportTestCases), "ceil", "posit<6,2>()"); + #endif diff --git a/tools/cmd/lns.cpp b/tools/cmd/lns.cpp index fdbf2d2e7..612dd59c0 100644 --- a/tools/cmd/lns.cpp +++ b/tools/cmd/lns.cpp @@ -5,26 +5,28 @@ // This file is part of the universal numbers project, which is released under an MIT Open Source license. #include -namespace sw::universal { +namespace sw { + namespace universal { - // return in triple form (sign, scale, fraction) - template - inline std::string to_triple(const lns& number) { - std::stringstream ss; + // return in triple form (sign, scale, fraction) + template + inline std::string to_triple(const lns& number) { + std::stringstream ss; - // print sign bit - ss << '(' << "tbd" << ','; + // print sign bit + ss << '(' << "tbd" << ','; - // scale - ss << "tbd" << ','; + // scale + ss << "tbd" << ','; - // print fraction bits - ss << "tbd"; + // print fraction bits + ss << "tbd"; - ss << ')'; - return ss.str(); + ss << ')'; + return ss.str(); + } } -} +} // namespace sw::universal // receive a float and print its components @@ -44,7 +46,7 @@ try { return EXIT_SUCCESS; // signal successful completion for ctest } std::string arg = argv[1]; - lns<32, 8, std::uint32_t> v; + lns<32, 8, Saturating, std::uint32_t> v; constexpr size_t columnWidth = 50; std::cout << std::setw(columnWidth) << std::left << typeid(v).name() << ": " << std::setprecision(max_digits10) << std::right << v << " " << to_triple(v) << '\n';