...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
The formal requirements for a backend to class number
are given in the reference, but to help speed and simplify the process there
is a header skeleton_backend.hpp
where all the methods needed to be written are declared but nothing is implemented.
The process of writing a new backend then simplifies to:
skeleton_backend
to the name of the new backend type.
inline
,
constexpr
and noexcept
as required.
number
that will use the new backend.
To test the new backend, start with a basic arithmetic test, this is a test
case under libs/math/test
that looks something like:
#include <boost/multiprecision/my_new_number_type.hpp> #include "test_arithmetic.hpp" int main() { test<boost::multiprecision::my_new_number_type>(); return boost::report_errors(); }
This will basically "instantiate everything", and perform a few runtime sanity checks; it is a very good test that you have written legal code!
You should also create a "header include test" that verifies that the new header includes everything it should, see mpfr_include_test.cpp for an example.
For integer types, you should add the new type to at least the following tests as well:
For floating point types, you should add the new type to at least the following tests as well: