| 312 | == 2. C++ arbitrary length fixed-point arithmetic (Nikhar Agrawal mentored by Paul Bristow) == |
| 313 | |
| 314 | === Background === |
| 315 | |
| 316 | A fixed-point number is a finite-precision approximation of a real number with a fixed number of digits before the radix point and a fixed number of digits after the radix point. One of the main applications of fixed-point arithmetic is its ability to represent fractional numbers on processors where there is no FPU, several embedded microcontrollers being a case in point. In such systems, fixed-point arithmetic provides a major performance boost providing near integer performance. |
| 317 | Despite all its use cases, there do not exist many open source fixed-point libraries in C++. Most of the libraries out there for C++ are merely wrappers around C implementations. And none that allow arbitrary length fixed-point arithmetic. This library aims to be the solution to lack of good fixed-point libraries that utilizes power of C++ features. It could potentially be a useful addition to Boost. |
| 318 | |
| 319 | === GSoC project proposal === |
| 320 | |
| 321 | * Define the namespace, the location in Boost, the interfaces, the inter-operability with built-in types and multiple-precision types, deduction of base-representation type based on template arguments thus allowing for arbitrary-length fixed-point numbers. |
| 322 | |
| 323 | * Implement, test and document all constructors and all basic arithmetic, compound assignment, logical, relational, increment/decrement etc. operations for at least signed and unsigned fractional fixed-point fract_fp and ufract_fp for unlimited range and resolution. Establish seamless interaction with Boost.Multiprecision where appropriate for high digit counts. |
| 324 | |
| 325 | * Implement, test and document rounding and remainder functions (ceil, floor, trunc, round etc), along with some of the remaining <cmath> functions such as nextafter, nexttoward (these two functions make particular sense in fixed-point numbers if we wish to find the next quantum and are good substitute for altering the behaviour of increment/decrement operators), abs, fmax, fmin, fdim etc for at least fract_fp and ufract_fp, and specialized power-functions (pow, sqrt). (Support for transcendental functions is not a core objective). |
| 326 | |
| 327 | * Optional: Try and get as much support for integer fixed-point int_fp, uint_fp as possible. |
| 328 | |
| 329 | * Optional: Prototype some transcendental functions of <cmath> for fract_fp, ufract_fp for some precision ranges, perhaps tie into Boost.Multiprecision for transcendental functions of high fixed-point digit counts. |
| 330 | |
| 331 | |
| 332 | |
| 333 | |
| 334 | |