You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A comprehensive fixed-point math library written in C++23 and C++17, designed for high precision and efficiency.
6
6
7
7
## Major changes 12.08.2024
8
-
- master contains version 2.x rewritten in c++23 - under development
8
+
- master contains version 2.x rewritten in c++23
9
9
- branch 1.x contains stable c++17 which will be still maintained for compatibility and bugfixes
10
10
11
11
## Features
12
12
13
-
-**Modern C++ Standards**: Requires a minimum of C++17, leveraging modern language features for optimal performance and reliability.
13
+
-**Modern C++ Standards**: Requires a minimum of C++23, (branch 1.x c++17) leveraging modern language features for optimal performance and reliability.
14
14
-**Strongly Typed Fixed-Point Arithmetic**: Utilizes a 48.16 fixed-point arithmetic model, ensuring type safety with explicit conversions and operations. The `fixed_t` type is robust against unintentional type conversions, fostering code correctness.
15
15
-**Implicit Type Promotion**: Supports implicit promotion of all arithmetic types (excluding `double`) to `fixed_t` in basic arithmetic operations, enhancing ease of use without sacrificing precision.
16
16
-**Double Precision Compatibility**: Interactions between `fixed_t` and `double` types automatically yield a `double` result type. Arithmetic operations involving `double` are seamlessly elevated to double precision, ensuring accuracy for critical calculations.
17
-
-**Compile-Time Evaluation**: The entire codebase, including trigonometric functions, is `constexpr`, enabling compile-time evaluations where applicable. This feature significantly reduces runtime overhead and allows for constant expressions.\[1\]\[2\]
17
+
-**Compile-Time Evaluation**: The entire codebase, including trigonometric functions, is `constexpr`, enabling compile-time evaluations where applicable. This feature significantly reduces runtime overhead and allows for constant expressions.\[1\]
18
18
-**Header-Only Library**: As a fully header-only library with extensive use of `constexpr`, FixedMath simplifies integration into projects. Explore the API interface and implementation details: [API Reference](https://arturbac.github.io/fixed_math/) | [Implementation](https://github.com/arturbac/fixed_math/blob/master/fixed_lib/include/fixedmath/math.h).
19
19
-**Compile-Time Unit Testing**: Offers a robust suite of compile-time unit tests, streamlining test-driven development and ensuring library correctness. Dive into the unit tests: [Compile-Time Unit Tests](https://github.com/arturbac/fixed_math/tree/master/fixed_lib/include/fixedmath/unittests).
20
20
21
21
FixedMath is committed to delivering precision, efficiency, and ease of use, making it an ideal choice for projects requiring fixed-point arithmetic in a modern C++ environment.
22
22
23
-
\[1\] Starting with C++20, the `sqrt` function is always available as `constexpr`, utilizing the Abacus algorithm for constant evaluation, alongside the standard `std::sqrt` for runtime execution.
24
-
25
-
\[2\] In C++17, `std::sqrt` is used by default, leveraging the CPU's hardware support for square root calculations, which allows for inline optimizations. For compile-time evaluations, the Abacus algorithm can be enabled by defining `FIXEDMATH_ENABLE_SQRT_ABACUS_ALGO`. Note that while the Abacus algorithm supports `constexpr` usage, it is typically slower than the CPU-optimized implementation.
23
+
\[1\] The `sqrt` function is always available as `constexpr`, utilizing the Abacus algorithm for constant evaluation, alongside the standard `std::sqrt` for runtime execution. On windows msvc toolset (not clang-cl) still is not fully compatibile with c++23 and still has nonsense compiletime evaluation errors, [for example I had to split consteval function into constant](https://github.com/arturbac/fixed_math/blob/4f7b5f00b60dce007305d44ed4d2edb4ea98eb65/unit_tests/addition_ut.cc#L8) but this change does not has any sense.
26
24
27
25
### Performance Comparisons of Code Version 0.9.1
28
26
@@ -69,7 +67,7 @@ For projects utilizing CPM (CMake Package Manager) for dependency management, yo
69
67
CPMAddPackage(
70
68
NAME fixed_math
71
69
GITHUB_REPOSITORY arturbac/fixed_math
72
-
GIT_TAG v1.0.0
70
+
GIT_TAG v2.0.0
73
71
)
74
72
75
73
find_package(fixed_math REQUIRED)
@@ -84,28 +82,32 @@ The following compilers are confirmed to compile the project in branches
84
82
85
83
### version 2.x with C++23 standard, master development branch.
86
84
- Clang version 18.0.1 with llvm-libcxx on Gentoo x86-64
87
-
- Clang version 13.0.0 with gcc-libstdc++ 14.1.1 on Gentoo x86-64
88
-
- GCC 14.1.1_p20240720 p4
89
-
- MSVC - under develoment
85
+
- Clang version 18.0.1 with gcc-libstdc++ 14.1.1 on Gentoo x86-64
86
+
- Clang version 18 on ubuntu-24.04
87
+
- GCC 14.1.1_p20240720 p4 on Gentoo x86-64
88
+
- GCC 14.0.1 on ubuntu-24.04
89
+
- MSVC ClanCL-toolset 17.0.3 from MSVC 19.40.33813.0
90
+
- MSVC toolset 19.40.33813.0
90
91
91
92
92
93
### version 1.x with C++17 standard on stable 1.x branch
93
-
94
-
- Clang version 17.0.6 with llvm-libcxx on Gentoo x86-64
95
-
- Clang version 13.0.0 with llvm-libcxx on Gentoo x86-64
96
-
- Clang version 13.0.0 with gcc-libstdc++ 11.2.1 on Gentoo x86-64
97
-
- Clang version 12.0.1 with llvm-libcxx on FreeBSD 13 x86-64
98
-
- Clang version 11.0.1 with gcc-libstdc++ 10.2.0 on Gentoo Linux x86-64 and aarch64
99
-
- Clang version 11.0.1 with llvm-libcxx on x86-64
100
-
- Clang version 10.0.1 with llvm-libcxx on FreeBSD 13 x86-64
101
-
- GCC version 13.2.1_p20240210 p13 on Gentoo x86-64
102
-
- GCC version 12.3.1_p20240209 p2 on Gentoo x86-64
103
-
- GCC version 11.2.1 20211127 on Gentoo x86-64
94
+
- Clang 18.0.1 with llvm-libcxx on Gentoo x86-64
95
+
- Clang 17.0.6 with llvm-libcxx on Gentoo x86-64
96
+
- Clang 13.0.0 with llvm-libcxx on Gentoo x86-64
97
+
- Clang 13.0.0 with gcc-libstdc++ 11.2.1 on Gentoo x86-64
98
+
- Clang 12.0.1 with llvm-libcxx on FreeBSD 13 x86-64
99
+
- Clang 11.0.1 with gcc-libstdc++ 10.2.0 on Gentoo Linux x86-64 and aarch64
100
+
- Clang 11.0.1 with llvm-libcxx on x86-64
101
+
- Clang 10.0.1 with llvm-libcxx on FreeBSD 13 x86-64
102
+
- GCC 14.1.1_p20240720 p4 on Gentoo x86-64
103
+
- GCC 13.2.1_p20240210 p13 on Gentoo x86-64
104
+
- GCC 12.3.1_p20240209 p2 on Gentoo x86-64
105
+
- GCC 11.2.1 20211127 on Gentoo x86-64
104
106
- GCC 10.2.0 on x86-64 on Gentoo x86-64
105
107
- GCC 9.4.0 on Gentoo x86-64
106
108
- MSVC 19 (Visual Studio 2019) support
107
109
108
-
If you encounter any issues with a C++17 compatible compiler, please report it by submitting an issue. The standard template library (STL) compatibility is expected to be consistent across these compilers:
110
+
If you encounter any issues, please report it by submitting an issue.
0 commit comments