...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
As a general rule, all conversions between unrelated types are performed using basic arithmetic operations, therefore conversions are either exact, or follow the same rounding rules as arithmetic for the type in question.
The following table summarises the situation for conversions from native types:
Backend |
Rounding Rules |
---|---|
Conversions from integer types are exact if the target has sufficient precision, otherwise they truncate to the first 2^MaxBits bits (modulo arithmetic). Conversions from floating-point types are truncating to the nearest integer. |
|
Conversions are performed by the GMP library except for conversion
from |
|
Conversions from floating-point types are truncating, all others are performed by libtommath and are exact. |
|
Conversions are performed by the GMP library except for conversion
from |
|
All conversions are performed by the underlying MPFR library. |
|
All conversions are performed using basic arithmetic operations and are truncating. |
|
See gmp_int |
|
See cpp_int |
|
See tom_int |