Content-Length: 17649 | pFad | http://johnmcfarlane.github.io/fixed_point/
fixed_point (deprecated)
rev.2
Binary Fixed-Point Arithmetic Library in C++
|
The fixed_point library is deprecated. Please consider using CNL instead.
The fixed_point library provides a header-only C++11 API for approximating real numbers using binary fixed-point arithmetic. It forms the reference implementation for a standard library proposal presented in paper, P0037 and is developed as part of study groups, SG14 and SG6. Installation instructions are provided on the project page.
Header, sg14/fixed_point, defines class template, fixed_point, with:
Header, sg14/num_traits, contains additions (such as set_digits) that support widening of arithmetic types in order to deal with precision loss.
Auxiliary modules:
The following examples can be found in the test suite.
The fixed_point type extends the behavior of integer types in a natural way. It represents a real number using an integer type, scaled by a power of two.
Specializations of fixed_point behave a lot like native C/C++ numeric types. Operators are designed to behave in an way which is both predictable and efficient.
But one size does not fit all. Different applications of the same operation might call for different trade-offs between storage, precision, safety and speed. Named functions - such as multiply - provide fine-tuned control over arithmetic results.
Because one size does not fit all, fixed_point is designed to make it easy to tailor new arithmetic types. The elastic_fixed_point type illustrates this. As each calculation requires more digits, so the results of elastic_fixed_point operations allocate more storage.
Fetched URL: http://johnmcfarlane.github.io/fixed_point/
Alternative Proxies: