├── .clang-tidy
├── .gcov
└── make
│ ├── make_gcov_01_generic.gmk
│ ├── make_gcov_02_files.gmk
│ └── make_gcov_03_flags.gmk
├── .github
├── toolchains
│ └── gcc.cmake
└── workflows
│ ├── CodeQL.yml
│ ├── wide_decimal.yml
│ ├── wide_decimal_codecov.yml
│ └── wide_decimal_sonar.yml
├── .gitignore
├── .props
└── Directory.Build.props
├── .tidy
└── make
│ ├── make_tidy_01_generic.gmk
│ ├── make_tidy_02_files.gmk
│ └── make_tidy_03_flags.gmk
├── CMakeLists.txt
├── LICENSE_1_0.txt
├── README.md
├── boost
└── math
│ └── bindings
│ └── decwide_t.hpp
├── codecov.yml
├── examples
├── CMakeLists.txt
├── example000_multiply_nines.cpp
├── example000a_multiply_pi_squared.cpp
├── example001_roots_sqrt.cpp
├── example001a_roots_seventh.cpp
├── example001b_roots_almost_integer.cpp
├── example001c_roots_sqrt_limb08.cpp
├── example001d_pow2_from_list.cpp
├── example001e_algebra_and_constexpr.cpp
├── example002_pi.cpp
├── example002a_pi_small_limb.cpp
├── example002b_pi_100k.cpp
├── example002c_pi_quintic.cpp
├── example002d_pi_limb08.cpp
├── example003_zeta.cpp
├── example004_bessel_recur.cpp
├── example005_polylog_series.cpp
├── example006_logarithm.cpp
├── example007_catalan_series.cpp
├── example008_bernoulli_tgamma.cpp
├── example009_boost_math_standalone.cpp
├── example009a_boost_math_standalone.cpp
├── example009b_boost_math_standalone.cpp
├── example010_hypergeometric_2f1.cpp
├── example010a_hypergeometric_1f1.cpp
├── example011_trig_trapezoid_integral.cpp
├── example012_rational_floor_ceil.cpp
├── example013_embeddable_sqrt.cpp
├── example013a_embeddable_agm.cpp
└── example_decwide_t.h
├── math
├── constants
│ └── constants_pi_control_for_decwide_t.h
└── wide_decimal
│ ├── decwide_t.h
│ ├── decwide_t_detail.h
│ ├── decwide_t_detail_fft.h
│ ├── decwide_t_detail_namespace.h
│ └── decwide_t_detail_ops.h
├── mcal_lcd
├── mcal_lcd_base.h
├── mcal_lcd_console.h
└── mcal_lcd_generic_st7066.h
├── sonar-project.properties
├── target
├── build
│ └── test_examples_emulator.gdb
└── micros
│ └── stm32f429
│ └── make
│ ├── single
│ └── crt.cpp
│ └── stm32f429.ld
├── test
├── CMakeLists.txt
├── coverity.c
├── independent_algebra_test_decwide_t.h
├── independent_algebra_test_decwide_t_base.h
├── independent_algebra_test_decwide_t_boost_cpp.h
├── independent_algebra_test_decwide_t_constants.h
├── independent_algebra_test_decwide_t_wide_decimal.h
├── parallel_for.h
├── stopwatch.h
├── test.cpp
├── test_decwide_t_algebra.cpp
├── test_decwide_t_algebra.h
├── test_decwide_t_algebra_edge.cpp
├── test_decwide_t_examples.cpp
├── test_decwide_t_examples.h
├── test_high_precision_exp.cpp
├── test_high_precision_log.cpp
└── test_mixed_wide_decimal_wide_integer_b2n.cpp
├── util
├── memory
│ └── util_n_slot_array_allocator.h
├── stdcpp
│ └── stdcpp_patch.cpp
└── utility
│ ├── util_baselexical_cast.h
│ ├── util_dynamic_array.h
│ ├── util_noncopyable.h
│ └── util_pseudorandom_time_point_seed.h
├── wide_decimal.sln
├── wide_decimal.vcxproj
├── wide_decimal.vcxproj.filters
├── wide_decimal_vs2022.sln
├── wide_decimal_vs2022.vcxproj
└── wide_decimal_vs2022.vcxproj.filters
/.gcov/make/make_gcov_01_generic.gmk:
--------------------------------------------------------------------------------
1 | # ------------------------------------------------------------------------------
2 | # Copyright Christopher Kormanyos 2022 - 2024.
3 | # Distributed under the Boost Software License,
4 | # Version 1.0. (See accompanying file LICENSE_1_0.txt
5 | # or copy at http://www.boost.org/LICENSE_1_0.txt)
6 | # ------------------------------------------------------------------------------
7 |
8 | PATH_MAKE = $(CURDIR)
9 | PATH_PRJ = $(PATH_MAKE)/../..
10 | PATH_SRC = $(PATH_PRJ)
11 | PATH_BIN = $(PATH_MAKE)/bin
12 | PATH_ERR = $(PATH_MAKE)/err
13 | PATH_OBJ = $(PATH_MAKE)/obj
14 |
15 | CAT = cat
16 | GNUECHO = echo
17 | LS = ls
18 | MKDIR = mkdir
19 | GCOV = gcov
20 | LCOV = lcov
21 | GENHTML = genhtml
22 | RM = rm
23 | SED = sed
24 |
25 | include make_gcov_02_files.gmk
26 | include make_gcov_03_flags.gmk
27 |
28 | FILES_ALL = $(FILES_PRJ)
29 | FILES_O = $(addprefix $(PATH_OBJ)/, $(notdir $(addsuffix .o, $(FILES_ALL))))
30 | FILES_GCOV = $(addprefix $(PATH_OBJ)/, $(notdir $(addsuffix .gcov, $(FILES_ALL))))
31 |
32 | # ------------------------------------------------------------------------------
33 | # VPATH definition: VPATH is required for make to find the source files.
34 | # ------------------------------------------------------------------------------
35 | VPATH := $(sort $(dir $(FILES_ALL)))
36 |
37 |
38 | # ------------------------------------------------------------------------------
39 | # Executable file:
40 | # ------------------------------------------------------------------------------
41 |
42 | .PHONY: $(PATH_BIN)/wide_decimal.exe
43 | $(PATH_BIN)/wide_decimal.exe: $(FILES_O)
44 | # Link coverage-instrumented executable
45 | @$(GNUECHO) +++ link object files to $(PATH_BIN)/wide_decimal.exe
46 | @$(CC) -x none $(CXXFLAGS) $(FILES_O) -o $(PATH_BIN)/wide_decimal.exe
47 | @$(GNUECHO)
48 |
49 |
50 | # ------------------------------------------------------------------------------
51 | # Main dependency:
52 | # Compile all files and link them.
53 | # Run gcov and get results.
54 | # (See also https://github.com/codecov/example-cpp11-cmake)
55 | # ------------------------------------------------------------------------------
56 |
57 | .PHONY: gcov
58 | gcov: $(PATH_BIN)/wide_decimal.exe
59 | # Obtain results
60 | @$(GNUECHO) +++ execute $(PATH_BIN)/wide_decimal.exe
61 | @$(PATH_BIN)/wide_decimal.exe
62 | @$(GNUECHO)
63 | @$(GNUECHO) +++ running gcov
64 | @$(GCOV) $(GCOV_FLAGS) $(addsuffix .cpp,$(FILES_PRJ))
65 | @$(GNUECHO)
66 | @$(GNUECHO) +++ running lcov
67 | @$(LCOV) $(LCOV_BRANCH) -c --directory obj --output-file coverage_unfiltered.info
68 | @$(LCOV) $(LCOV_BRANCH) --ignore-errors unused --remove coverage_unfiltered.info $(LCOV_REMOVES) --output-file coverage.info
69 | @$(GNUECHO)
70 | @$(GNUECHO) +++ running genhtml
71 | @$(GENHTML) coverage.info $(LCOV_BRANCH) --demangle-cpp --output-directory $(PATH_BIN)/report
72 | @$(GNUECHO)
73 |
74 | # ------------------------------------------------------------------------------
75 | # Clean temporary files.
76 | # ------------------------------------------------------------------------------
77 |
78 | .PHONY: clean
79 | clean:
80 | # creating output directories
81 | @$(GNUECHO) +++ cleaning output directories
82 | @-$(RM) -rf $(PATH_BIN)* || uname -r
83 | @-$(RM) -rf $(PATH_ERR)* || uname -r
84 | @-$(RM) -rf $(PATH_OBJ)* || uname -r
85 | @-$(RM) -f *.gcov || uname -r
86 | @-$(RM) -f coverage* || uname -r
87 | @$(GNUECHO)
88 |
89 |
90 | # ------------------------------------------------------------------------------
91 | # Prepare the gcov build.
92 | # ------------------------------------------------------------------------------
93 |
94 | .PHONY: prepare
95 | prepare: clean
96 | @$(GNUECHO) +++ creating output directories
97 | @-$(MKDIR) -p $(PATH_BIN)
98 | @-$(MKDIR) -p $(PATH_ERR)
99 | @-$(MKDIR) -p $(PATH_OBJ)
100 | @$(GNUECHO)
101 | @$(GNUECHO) +++ print gcov version
102 | @$(GCOV) --version
103 | @$(GNUECHO)
104 | @$(GNUECHO) +++ print include paths
105 | @$(GNUECHO) $(C_INCLUDES)
106 | @$(GNUECHO)
107 |
108 | # ------------------------------------------------------------------------------
109 | # pattern rule for compilation of cpp-files
110 | # ------------------------------------------------------------------------------
111 | $(PATH_OBJ)/%.o : %.cpp
112 | @-$(GNUECHO) +++ compiling: $(notdir $<) to $(notdir $(PATH_OBJ)/$(basename $(@F)).o)
113 | @-$(CC) $(CXXFLAGS) -x c++ -c $(C_INCLUDES) $(C_DEFINES) $< -o $(PATH_OBJ)/$(basename $(@F)).o 2> $(PATH_ERR)/$(basename $(@F)).err
114 | @-$(SED) -e 's|.h:\([0-9]*\),|.h(\1) :|' -e 's|:\([0-9]*\):|(\1) :|' $(PATH_ERR)/$(basename $(@F)).err
115 |
--------------------------------------------------------------------------------
/.gcov/make/make_gcov_02_files.gmk:
--------------------------------------------------------------------------------
1 | # ------------------------------------------------------------------------------
2 | # Copyright Christopher Kormanyos 2022.
3 | # Distributed under the Boost Software License,
4 | # Version 1.0. (See accompanying file LICENSE_1_0.txt
5 | # or copy at http://www.boost.org/LICENSE_1_0.txt)
6 | # ------------------------------------------------------------------------------
7 |
8 | FILES_PRJ = $(PATH_SRC)/test/test \
9 | $(PATH_SRC)/test/test_decwide_t_algebra \
10 | $(PATH_SRC)/test/test_decwide_t_algebra_edge \
11 | $(PATH_SRC)/test/test_decwide_t_examples \
12 | $(PATH_SRC)/examples/example000a_multiply_pi_squared \
13 | $(PATH_SRC)/examples/example000_multiply_nines \
14 | $(PATH_SRC)/examples/example001_roots_sqrt \
15 | $(PATH_SRC)/examples/example001a_roots_seventh \
16 | $(PATH_SRC)/examples/example001b_roots_almost_integer \
17 | $(PATH_SRC)/examples/example001c_roots_sqrt_limb08 \
18 | $(PATH_SRC)/examples/example001d_pow2_from_list \
19 | $(PATH_SRC)/examples/example001e_algebra_and_constexpr \
20 | $(PATH_SRC)/examples/example002b_pi_100k \
21 | $(PATH_SRC)/examples/example003_zeta \
22 | $(PATH_SRC)/examples/example004_bessel_recur \
23 | $(PATH_SRC)/examples/example005_polylog_series \
24 | $(PATH_SRC)/examples/example009_boost_math_standalone \
25 | $(PATH_SRC)/examples/example009a_boost_math_standalone \
26 | $(PATH_SRC)/examples/example009b_boost_math_standalone \
27 | $(PATH_SRC)/examples/example010_hypergeometric_2f1 \
28 | $(PATH_SRC)/examples/example010a_hypergeometric_1f1 \
29 | $(PATH_SRC)/examples/example011_trig_trapezoid_integral \
30 | $(PATH_SRC)/examples/example012_rational_floor_ceil \
31 | $(PATH_SRC)/examples/example013_embeddable_sqrt \
32 | $(PATH_SRC)/examples/example013a_embeddable_agm
33 |
--------------------------------------------------------------------------------
/.gcov/make/make_gcov_03_flags.gmk:
--------------------------------------------------------------------------------
1 | # ------------------------------------------------------------------------------
2 | # Copyright Christopher Kormanyos 2022 - 2025.
3 | # Distributed under the Boost Software License,
4 | # Version 1.0. (See accompanying file LICENSE_1_0.txt
5 | # or copy at http://www.boost.org/LICENSE_1_0.txt)
6 | # ------------------------------------------------------------------------------
7 |
8 | BOOST_ROOT_FOR_GCOV = /mnt/c/boost/boost_1_82_0
9 | CC = g++
10 | STD = c++20
11 | ALL_COV = 0
12 |
13 | ifneq ($(MY_BOOST_ROOT),)
14 | BOOST_ROOT_FOR_GCOV := $(MY_BOOST_ROOT)
15 | endif
16 |
17 | ifneq ($(MY_CC),)
18 | CC := $(MY_CC)
19 | endif
20 |
21 | ifneq ($(MY_STD),)
22 | STD := $(MY_STD)
23 | endif
24 |
25 | ifneq ($(MY_STD),)
26 | STD := $(MY_STD)
27 | endif
28 |
29 | ifneq ($(MY_ALL_COV),)
30 | ALL_COV := $(MY_ALL_COV)
31 | endif
32 |
33 | CXXFLAGS = -march=native \
34 | -mtune=native \
35 | -O2 \
36 | -Wall \
37 | -Wextra \
38 | -Wconversion \
39 | -Wsign-conversion \
40 | -std=$(STD) \
41 | -pthread \
42 | -lpthread \
43 | -fno-inline-functions \
44 | -fprofile-arcs \
45 | -ftest-coverage
46 |
47 | C_DEFINES = WIDE_DECIMAL_HAS_COVERAGE
48 |
49 | C_INCLUDES = $(PATH_SRC) \
50 | $(BOOST_ROOT_FOR_GCOV)
51 |
52 | C_DEFINES :=$(addprefix -D,$(C_DEFINES))
53 | C_INCLUDES :=$(addprefix -I,$(C_INCLUDES))
54 |
55 | GCOV_FLAGS = --object-directory obj \
56 | --demangled-names
57 |
58 |
59 | # ------------------------------------------------------------------------------
60 | # All gcov flags: The GCOV_FLAGS below are equivalent to -abcfu
61 | # ------------------------------------------------------------------------------
62 |
63 | ifneq ($(ALL_COV),0)
64 | GCOV_FLAGS := $(GCOV_FLAGS) \
65 | --all-blocks \
66 | --branch-counts \
67 | --branch-probabilities \
68 | --function-summaries \
69 | --unconditional-branches
70 | endif
71 |
72 | LCOV_BRANCH =
73 |
74 | ifneq ($(ALL_COV),0)
75 | LCOV_BRANCH := --rc lcov_branch_coverage=1
76 | endif
77 |
78 | LCOV_REMOVES = '/usr/*' \
79 | '*boost/*' \
80 | '*mcal_lcd/*' \
81 | '*util/*'
82 |
--------------------------------------------------------------------------------
/.github/toolchains/gcc.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_CXX_FLAGS_INIT "-Wall -Wextra -Wconversion -Wsign-conversion -Wshadow -Wno-psabi -Werror")
2 |
--------------------------------------------------------------------------------
/.github/workflows/CodeQL.yml:
--------------------------------------------------------------------------------
1 | # ------------------------------------------------------------------------------
2 | # Copyright Christopher Kormanyos 2022 - 2025.
3 | # Distributed under the Boost Software License,
4 | # Version 1.0. (See accompanying file LICENSE_1_0.txt
5 | # or copy at http://www.boost.org/LICENSE_1_0.txt)
6 | # ------------------------------------------------------------------------------
7 |
8 | name: CodeQL
9 | on:
10 | push:
11 | branches:
12 | - '**'
13 | pull_request:
14 | types: [opened, synchronize, reopened]
15 | jobs:
16 | analyze:
17 | name: Analyze
18 | runs-on: ubuntu-latest
19 | permissions:
20 | actions: read
21 | contents: read
22 | security-events: write
23 | strategy:
24 | fail-fast: false
25 | matrix:
26 | language: [ cpp ]
27 |
28 | steps:
29 | - name: Checkout
30 | uses: actions/checkout@v4
31 |
32 | - name: clone-submods-bootstrap-headers-boost-develop
33 | run: |
34 | git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
35 | cd ../boost-root
36 | git submodule update --init tools
37 | git submodule update --init libs/config
38 | git submodule update --init libs/math
39 | git submodule update --init libs/multiprecision
40 | ./bootstrap.sh
41 | ./b2 headers
42 |
43 | - name: Configure (cpp)
44 | if: ${{ matrix.language == 'cpp' }}
45 | run: echo configure_command_empty
46 |
47 | - name: Initialize CodeQL
48 | uses: github/codeql-action/init@v3
49 | with:
50 | languages: ${{ matrix.language }}
51 | queries: +security-and-quality
52 |
53 | - name: Build cpp
54 | if: ${{ matrix.language == 'cpp' }}
55 | run: |
56 | echo 'build application on the command line'
57 | g++ -fno-exceptions -fno-rtti -finline-functions -m64 -O3 -Werror -Wall -Wextra -Wconversion -Wsign-conversion -Wshadow -Wunused-parameter -Wuninitialized -Wunreachable-code -Winit-self -Wzero-as-null-pointer-constant -std=c++20 -I. -I../boost-root -pthread -lpthread test/test.cpp test/test_decwide_t_algebra.cpp test/test_decwide_t_algebra_edge.cpp test/test_decwide_t_examples.cpp examples/example000a_multiply_pi_squared.cpp examples/example000_multiply_nines.cpp examples/example001_roots_sqrt.cpp examples/example001a_roots_seventh.cpp examples/example001b_roots_almost_integer.cpp examples/example001c_roots_sqrt_limb08.cpp examples/example001d_pow2_from_list.cpp examples/example001e_algebra_and_constexpr.cpp examples/example002_pi.cpp examples/example002a_pi_small_limb.cpp examples/example002b_pi_100k.cpp examples/example002c_pi_quintic.cpp examples/example002d_pi_limb08.cpp examples/example003_zeta.cpp examples/example004_bessel_recur.cpp examples/example005_polylog_series.cpp examples/example006_logarithm.cpp examples/example007_catalan_series.cpp examples/example008_bernoulli_tgamma.cpp examples/example009_boost_math_standalone.cpp examples/example009a_boost_math_standalone.cpp examples/example009b_boost_math_standalone.cpp examples/example010_hypergeometric_2f1.cpp examples/example010a_hypergeometric_1f1.cpp examples/example011_trig_trapezoid_integral.cpp examples/example012_rational_floor_ceil.cpp examples/example013_embeddable_sqrt.cpp examples/example013a_embeddable_agm.cpp -o wide_decimal.exe
58 | - name: Perform CodeQL Analysis
59 | uses: github/codeql-action/analyze@v3
60 | with:
61 | category: "/language:${{ matrix.language }}"
62 |
--------------------------------------------------------------------------------
/.github/workflows/wide_decimal_codecov.yml:
--------------------------------------------------------------------------------
1 | # ------------------------------------------------------------------------------
2 | # Copyright Christopher Kormanyos 2022 - 2025.
3 | # Distributed under the Boost Software License,
4 | # Version 1.0. (See accompanying file LICENSE_1_0.txt
5 | # or copy at http://www.boost.org/LICENSE_1_0.txt)
6 | # ------------------------------------------------------------------------------
7 |
8 | name: wide_decimal_codecov
9 | on:
10 | push:
11 | branches:
12 | - main
13 | pull_request:
14 | types: [opened, synchronize, reopened]
15 | jobs:
16 | gnumake-gcc-gcov-native:
17 | runs-on: ubuntu-latest
18 | defaults:
19 | run:
20 | shell: bash
21 | strategy:
22 | fail-fast: false
23 | matrix:
24 | standard: [ c++20 ]
25 | compiler: [ g++ ]
26 | steps:
27 | - uses: actions/checkout@v4
28 | with:
29 | fetch-depth: '0'
30 | - name: update-tools
31 | run: sudo apt install lcov
32 | - name: clone-submods-bootstrap-headers-boost-develop
33 | run: |
34 | git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
35 | cd ../boost-root
36 | git submodule update --init tools
37 | git submodule update --init libs/config
38 | git submodule update --init libs/math
39 | git submodule update --init libs/multiprecision
40 | ./bootstrap.sh
41 | ./b2 headers
42 | - name: gnumake-gcc-gcov-native
43 | run: |
44 | grep BOOST_VERSION ../boost-root/boost/version.hpp
45 | cd .gcov/make
46 | echo "build and run gcov/lcov/genhtml"
47 | echo "make prepare -f make_gcov_01_generic.gmk MY_ALL_COV=0 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}"
48 | echo
49 | make prepare -f make_gcov_01_generic.gmk MY_ALL_COV=0 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}
50 | echo
51 | echo "make gcov -f make_gcov_01_generic.gmk --jobs=12 MY_ALL_COV=0 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}"
52 | echo
53 | make gcov -f make_gcov_01_generic.gmk --jobs=12 MY_ALL_COV=0 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}
54 | echo
55 | echo "return to wide-decimal root directory"
56 | cd ../..
57 | - name: upload-codecov
58 | uses: codecov/codecov-action@v4
59 | with:
60 | plugin: gcov
61 | file: ${{ runner.workspace }}/wide-decimal/.gcov/make/coverage.info
62 | token: ${{ secrets.CODECOV_TOKEN }}
63 | fail_ci_if_error: true
64 | verbose: false
65 |
--------------------------------------------------------------------------------
/.github/workflows/wide_decimal_sonar.yml:
--------------------------------------------------------------------------------
1 | # ------------------------------------------------------------------------------
2 | # Copyright Christopher Kormanyos 2022 - 2025.
3 | # Distributed under the Boost Software License,
4 | # Version 1.0. (See accompanying file LICENSE_1_0.txt
5 | # or copy at http://www.boost.org/LICENSE_1_0.txt)
6 | # ------------------------------------------------------------------------------
7 |
8 | name: wide_decimal_sonar
9 | on:
10 | push:
11 | branches:
12 | - main
13 | pull_request:
14 | types: [opened, synchronize, reopened]
15 | jobs:
16 | build:
17 | name: sonar-gcc-native
18 | runs-on: ubuntu-latest
19 | env:
20 | SONAR_SCANNER_VERSION: 5.0.1.3006
21 | SONAR_SERVER_URL: "https://sonarcloud.io"
22 | BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
23 | steps:
24 | - uses: actions/checkout@v4
25 | with:
26 | fetch-depth: 0
27 | - name: clone-submods-bootstrap-headers-boost-develop
28 | run: |
29 | git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
30 | cd ../boost-root
31 | git submodule update --init tools
32 | git submodule update --init libs/config
33 | git submodule update --init libs/math
34 | git submodule update --init libs/multiprecision
35 | ./bootstrap.sh
36 | ./b2 headers
37 | - name: Set up JDK 17
38 | uses: actions/setup-java@v4
39 | with:
40 | distribution: 'temurin'
41 | java-version: '17'
42 | overwrite-settings: true
43 | - name: Download and set up sonar-scanner
44 | env:
45 | SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
46 | run: |
47 | mkdir -p $HOME/.sonar
48 | curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
49 | unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
50 | echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
51 | - name: Download and set up build-wrapper
52 | env:
53 | BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-linux-x86.zip
54 | run: |
55 | curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
56 | unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
57 | echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
58 | - name: Run build-wrapper
59 | run: |
60 | java -version
61 | build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} g++ -finline-functions -finline-limit=32 -m64 -O3 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wno-cast-function-type -std=c++20 -DWIDE_DECIMAL_NAMESPACE=ckormanyos -I. -I../boost-root -pthread -lpthread test/test.cpp test/test_decwide_t_algebra.cpp test/test_decwide_t_algebra_edge.cpp test/test_decwide_t_examples.cpp examples/example000a_multiply_pi_squared.cpp examples/example000_multiply_nines.cpp examples/example001_roots_sqrt.cpp examples/example001a_roots_seventh.cpp examples/example001b_roots_almost_integer.cpp examples/example001c_roots_sqrt_limb08.cpp examples/example001d_pow2_from_list.cpp examples/example002_pi.cpp examples/example001e_algebra_and_constexpr.cpp examples/example002a_pi_small_limb.cpp examples/example002b_pi_100k.cpp examples/example002c_pi_quintic.cpp examples/example002d_pi_limb08.cpp examples/example003_zeta.cpp examples/example004_bessel_recur.cpp examples/example005_polylog_series.cpp examples/example006_logarithm.cpp examples/example007_catalan_series.cpp examples/example008_bernoulli_tgamma.cpp examples/example009_boost_math_standalone.cpp examples/example009a_boost_math_standalone.cpp examples/example009b_boost_math_standalone.cpp examples/example010_hypergeometric_2f1.cpp examples/example010a_hypergeometric_1f1.cpp examples/example011_trig_trapezoid_integral.cpp examples/example012_rational_floor_ceil.cpp examples/example013_embeddable_sqrt.cpp examples/example013a_embeddable_agm.cpp -o wide_decimal.exe
62 | - name: Run sonar-scanner
63 | env:
64 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
66 | run: |
67 | java -version
68 | sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
69 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | wide-decimal-release-x64/
2 | .vs/
3 | wide-decimal-debug-x64/
4 | wide_decimal.vcxproj.user
5 | wide-decimal-debug-x86/
6 | wide-decimal-release-x86/
7 | wide_decimal_vs2022.vcxproj.user
8 |
--------------------------------------------------------------------------------
/.props/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.tidy/make/make_tidy_01_generic.gmk:
--------------------------------------------------------------------------------
1 | # ------------------------------------------------------------------------------
2 | # Copyright Christopher Kormanyos 2022 - 2023.
3 | # Distributed under the Boost Software License,
4 | # Version 1.0. (See accompanying file LICENSE_1_0.txt
5 | # or copy at http://www.boost.org/LICENSE_1_0.txt)
6 | # ------------------------------------------------------------------------------
7 |
8 | PATH_MAKE = $(CURDIR)
9 | PATH_PRJ = $(PATH_MAKE)/../..
10 | PATH_SRC = $(PATH_PRJ)
11 | PATH_TMP = $(PATH_MAKE)/tmp
12 | PATH_ERR = $(PATH_MAKE)/err
13 |
14 | CAT = cat
15 | GNUECHO = echo
16 | LS = ls
17 | MKDIR = mkdir
18 | TIDY = clang-tidy
19 | RM = rm
20 | SED = sed
21 |
22 | include make_tidy_02_files.gmk
23 | include make_tidy_03_flags.gmk
24 |
25 | FILES_ALL = $(FILES_PRJ)
26 | FILES_TIDY_TXT = $(addprefix $(PATH_TMP)/, $(notdir $(addsuffix .tidy_txt, $(FILES_ALL))))
27 |
28 | # ------------------------------------------------------------------------------
29 | # VPATH definition: VPATH is required for make to find the source files.
30 | # ------------------------------------------------------------------------------
31 | VPATH := $(sort $(dir $(FILES_ALL)))
32 |
33 | # ------------------------------------------------------------------------------
34 | # Main dependency: Run clang-tidy on all files and tidy tidy results.
35 | # ------------------------------------------------------------------------------
36 |
37 | .PHONY: tidy
38 | tidy: $(FILES_TIDY_TXT)
39 | # Summarize tidy results
40 | @$(GNUECHO) +++ summarize clang-tidy results
41 | @$(GNUECHO) +++ concatenate $(PATH_TMP)/*.tidy_txt to $(PATH_TMP)/all.tidy_txt
42 | @$(CAT) $(PATH_TMP)/*.tidy_txt > $(PATH_TMP)/all.tidy_txt
43 | @$(GNUECHO)
44 | @$(GNUECHO) +++ verify existence of $(PATH_TMP)/all.tidy_txt
45 | @$(LS) -la $(PATH_TMP)/all.tidy_txt
46 | @$(GNUECHO)
47 | @$(GNUECHO) +++ print summary of tidy from $(PATH_TMP)/all.tidy_txt:
48 | @-$(SED) -n l $(PATH_TMP)/all.tidy_txt
49 | @$(GNUECHO)
50 |
51 |
52 | # ------------------------------------------------------------------------------
53 | # Clean temporary files.
54 | # ------------------------------------------------------------------------------
55 |
56 | .PHONY: prepare
57 | prepare:
58 | # creating output directories
59 | @$(GNUECHO) +++ creating output directories
60 | @-$(MKDIR) -p $(PATH_ERR)
61 | @-$(MKDIR) -p $(PATH_TMP)
62 | @$(GNUECHO)
63 | @$(GNUECHO) +++ cleaning output directories
64 | @-$(RM) -rf $(PATH_ERR)/*.tidy_err
65 | @-$(RM) -rf $(PATH_TMP)/*.tidy_txt
66 | @$(GNUECHO)
67 | @$(GNUECHO) +++ print clang-tidy version
68 | @$(TIDY) --version
69 | @$(GNUECHO)
70 | @$(GNUECHO) +++ print include paths
71 | @$(GNUECHO) $(C_INCLUDES)
72 | @$(GNUECHO)
73 |
74 | # ------------------------------------------------------------------------------
75 | # pattern rule for clang-tidy analysis of cpp-files
76 | # ------------------------------------------------------------------------------
77 | $(PATH_TMP)/%.tidy_txt : %.cpp
78 | @-$(GNUECHO) +++ tidying: $<
79 | @-$(TIDY) $(TIDY_FLAGS) $< -- $(CXX_FLAGS) $(C_INCLUDES) $(C_DEFINES) > $(PATH_TMP)/$(basename $(@F)).tidy_txt 2> $(PATH_ERR)/$(basename $(@F)).tidy_err
80 | @-$(GNUECHO)
81 | @-$(GNUECHO) +++ print $(PATH_ERR)/$(basename $(@F)).tidy_err
82 | @-$(SED) -n l $(PATH_ERR)/$(basename $(@F)).tidy_err
83 | @-$(GNUECHO)
84 |
--------------------------------------------------------------------------------
/.tidy/make/make_tidy_02_files.gmk:
--------------------------------------------------------------------------------
1 | # ------------------------------------------------------------------------------
2 | # Copyright Christopher Kormanyos 2022 - 2023.
3 | # Distributed under the Boost Software License,
4 | # Version 1.0. (See accompanying file LICENSE_1_0.txt
5 | # or copy at http://www.boost.org/LICENSE_1_0.txt)
6 | # ------------------------------------------------------------------------------
7 |
8 | FILES_PRJ = $(PATH_SRC)/test/test \
9 | $(PATH_SRC)/test/test_decwide_t_algebra \
10 | $(PATH_SRC)/test/test_decwide_t_algebra_edge \
11 | $(PATH_SRC)/test/test_decwide_t_examples \
12 | $(PATH_SRC)/examples/example000a_multiply_pi_squared \
13 | $(PATH_SRC)/examples/example000_multiply_nines \
14 | $(PATH_SRC)/examples/example001_roots_sqrt \
15 | $(PATH_SRC)/examples/example001a_roots_seventh \
16 | $(PATH_SRC)/examples/example001b_roots_almost_integer \
17 | $(PATH_SRC)/examples/example001c_roots_sqrt_limb08 \
18 | $(PATH_SRC)/examples/example001d_pow2_from_list \
19 | $(PATH_SRC)/examples/example001e_algebra_and_constexpr \
20 | $(PATH_SRC)/examples/example002_pi \
21 | $(PATH_SRC)/examples/example002a_pi_small_limb \
22 | $(PATH_SRC)/examples/example002b_pi_100k \
23 | $(PATH_SRC)/examples/example002c_pi_quintic \
24 | $(PATH_SRC)/examples/example002d_pi_limb08 \
25 | $(PATH_SRC)/examples/example003_zeta \
26 | $(PATH_SRC)/examples/example004_bessel_recur \
27 | $(PATH_SRC)/examples/example005_polylog_series \
28 | $(PATH_SRC)/examples/example006_logarithm \
29 | $(PATH_SRC)/examples/example007_catalan_series \
30 | $(PATH_SRC)/examples/example008_bernoulli_tgamma \
31 | $(PATH_SRC)/examples/example009_boost_math_standalone \
32 | $(PATH_SRC)/examples/example009a_boost_math_standalone \
33 | $(PATH_SRC)/examples/example009b_boost_math_standalone \
34 | $(PATH_SRC)/examples/example010_hypergeometric_2f1 \
35 | $(PATH_SRC)/examples/example010a_hypergeometric_1f1 \
36 | $(PATH_SRC)/examples/example011_trig_trapezoid_integral \
37 | $(PATH_SRC)/examples/example012_rational_floor_ceil \
38 | $(PATH_SRC)/examples/example013_embeddable_sqrt \
39 | $(PATH_SRC)/examples/example013a_embeddable_agm
40 |
--------------------------------------------------------------------------------
/.tidy/make/make_tidy_03_flags.gmk:
--------------------------------------------------------------------------------
1 | # ------------------------------------------------------------------------------
2 | # Copyright Christopher Kormanyos 2022 - 2025.
3 | # Distributed under the Boost Software License,
4 | # Version 1.0. (See accompanying file LICENSE_1_0.txt
5 | # or copy at http://www.boost.org/LICENSE_1_0.txt)
6 | # ------------------------------------------------------------------------------
7 |
8 | BOOST_ROOT_FOR_TIDY = /mnt/c/boost/boost_1_87_0
9 | CC = clang++
10 | STD = c++20
11 |
12 | ifneq ($(MY_BOOST_ROOT),)
13 | BOOST_ROOT_FOR_TIDY := $(MY_BOOST_ROOT)
14 | endif
15 |
16 | ifneq ($(MY_CC),)
17 | CC := $(MY_CC)
18 | endif
19 |
20 | ifneq ($(MY_STD),)
21 | STD := $(MY_STD)
22 | endif
23 |
24 | CXX_FLAGS = $(CC) \
25 | -march=native \
26 | -mtune=native \
27 | -O3 \
28 | -Wall \
29 | -Wextra \
30 | -Wconversion \
31 | -Wsign-conversion \
32 | -std=$(STD)
33 |
34 | C_DEFINES =
35 |
36 | C_INCLUDES = $(PATH_SRC) \
37 | $(BOOST_ROOT_FOR_TIDY)
38 |
39 | C_DEFINES :=$(addprefix -D,$(C_DEFINES))
40 | C_INCLUDES :=$(addprefix -I,$(C_INCLUDES))
41 |
42 |
43 | TIDY_CHECKS = "*, \
44 | -cert-dcl58-cpp, \
45 | -cppcoreguidelines-rvalue-reference-param-not-moved, \
46 | -cppcoreguidelines-avoid-do-while, \
47 | -modernize-type-traits, \
48 | -modernize-use-constraints, \
49 | -misc-header-include-cycle, \
50 | -misc-include-cleaner, \
51 | -misc-const-correctness, \
52 | -performance-avoid-endl, \
53 | -portability-simd-intrinsics, \
54 | -cppcoreguidelines-avoid-magic-numbers, \
55 | -readability-avoid-nested-conditional-operator, \
56 | -readability-identifier-length, \
57 | -readability-redundant-casting, \
58 | -readability-redundant-inline-specifier, \
59 | -altera-struct-pack-align, \
60 | -altera-unroll-loops, \
61 | -fuchsia-*, \
62 | -llvmlibc-*"
63 |
64 | TIDY_FLAGS = --extra-arg-before=--driver-mode=g++ \
65 | --header-filter=decwide_t \
66 | -warnings-as-errors=* \
67 | -checks=$(TIDY_CHECKS)
68 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(wide-decimal)
2 |
3 | cmake_minimum_required(VERSION 3.16.3)
4 |
5 | find_package(Boost)
6 | if (Boost_FOUND)
7 | include(CTest)
8 |
9 | add_subdirectory("examples")
10 | add_subdirectory("test")
11 | endif()
12 |
13 | add_library(WideDecimal INTERFACE)
14 | target_compile_features(WideDecimal INTERFACE cxx_std_14)
15 |
16 | target_include_directories(
17 | WideDecimal SYSTEM INTERFACE
18 | $
19 | $)
20 |
21 | install(TARGETS WideDecimal EXPORT WideDecimalTargets)
22 |
23 | install(
24 | FILES math/wide_decimal/decwide_t.h math/wide_decimal/decwide_t_detail.h
25 | math/wide_decimal/decwide_t_detail_fft.h math/wide_decimal/decwide_t_detail_namespace.h
26 | math/wide_decimal/decwide_t_detail_ops.h
27 | DESTINATION include/math/wide_decimal/)
28 |
29 | install(
30 | FILES math/constants/constants_pi_control_for_decwide_t.h
31 | DESTINATION include/math/constants/)
32 |
33 | install(
34 | FILES mcal_lcd/mcal_lcd_console.h mcal_lcd/mcal_lcd_base.h mcal_lcd/mcal_lcd_generic_st7066.h
35 | DESTINATION include/mcal_lcd/)
36 |
37 | install(
38 | FILES util/utility/util_baselexical_cast.h util/utility/util_dynamic_array.h
39 | util/utility/util_noncopyable.h
40 | DESTINATION include/util/utility/
41 | )
42 |
43 | install(
44 | FILES util/memory/util_n_slot_array_allocator.h
45 | DESTINATION include/util/memory/
46 | )
47 |
48 | install(
49 | FILES util/stdcpp/stdcpp_patch.cpp
50 | DESTINATION include/util/stdcpp/
51 | )
52 |
53 | install(
54 | FILES boost/math/bindings/decwide_t.hpp
55 | DESTINATION include/boost/math/bindings/
56 | )
57 |
58 | install(EXPORT WideDecimalTargets
59 | FILE WideDecimalConfig.cmake
60 | NAMESPACE WideDecimal::
61 | DESTINATION lib/cmake/wide-decimal)
62 |
--------------------------------------------------------------------------------
/LICENSE_1_0.txt:
--------------------------------------------------------------------------------
1 |
2 | Boost Software License - Version 1.0 - August 17th, 2003
3 |
4 | Permission is hereby granted, free of charge, to any person or organization
5 | obtaining a copy of the software and accompanying documentation covered by
6 | this license (the "Software") to use, reproduce, display, distribute,
7 | execute, and transmit the Software, and to prepare derivative works of the
8 | Software, and to permit third-parties to whom the Software is furnished to
9 | do so, all subject to the following:
10 |
11 | The copyright notices in the Software and this entire statement, including
12 | the above license grant, this restriction and the following disclaimer,
13 | must be included in all copies of the Software, in whole or in part, and
14 | all derivative works of the Software, unless such copies or derivative
15 | works are solely in the form of machine-executable object code generated by
16 | a source language processor.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 | DEALINGS IN THE SOFTWARE.
25 |
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 | codecov:
2 | require_ci_to_pass: yes
3 |
4 | coverage:
5 | precision: 1
6 | round: up
7 | range: '50...100'
8 | status:
9 | project:
10 | default: # This can be anything, but it needs to exist as the name
11 | # basic settings
12 | target: 90%
13 | threshold: 3%
14 | if_ci_failed: error #success, failure, error, ignore
15 | only_pulls: false
16 | patch:
17 | default:
18 | target: 75%
19 | threshold: 25%
20 |
21 | parsers:
22 | gcov:
23 | branch_detection:
24 | conditional: no
25 | loop: no
26 | method: no
27 | macro: no
28 |
29 | comment:
30 | layout: 'reach,diff,flags,files,footer'
31 | behavior: default
32 | require_changes: no
33 |
--------------------------------------------------------------------------------
/examples/example000_multiply_nines.cpp:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////
2 | // Copyright Christopher Kormanyos 2020 - 2022. //
3 | // Distributed under the Boost Software License, //
4 | // Version 1.0. (See accompanying file LICENSE_1_0.txt //
5 | // or copy at http://www.boost.org/LICENSE_1_0.txt) //
6 | ///////////////////////////////////////////////////////////////////
7 |
8 | #include
9 |
10 | #include
11 | #include