FLINT3.7.0-dev

decmag_struct, decmag_t

Synopsis#include <flint/decimal.h>
decmag_struct
decmag_t

A nonnegative number m \cdot 10^{k} with the mantissa m stored in a single word, 1 \le m < 10^{R} where R = DECMAG_MAX_PREC (9 on a 64-bit machine, 4 on a 32-bit machine), and an fmpz exponent k measured in digits, or the special values zero (m = 0) and +\infty (m = UWORD_MAX). The radius precision rad_prec is a context setting between 1 and R digits. The results of all operations are normalized, with exactly rad_prec digits (10^{\mathrm{rad\_prec}-1} \le m < 10^{\mathrm{rad\_prec}}, tested by the macro DECMAG_IS_NORMALIZED(x, ctx)), so that products of mantissas fit in a word and all operations reduce to a few word operations plus a small exponent adjustment.

Operands may have any number of digits (up to R): they are first rounded to rad_prec digits in the direction preserving the bound being computed, which costs two comparisons per operand in the common case where nothing needs to be done. Comparisons are comparisons of values, independently of the number of digits.

The _decmag functions compute upper bounds unless their name ends in _lower. Upper bounds are tight: the result is the exact value rounded up to rad_prec digits, except where noted.

Guides#

Cite this page

The FLINT team, “decmag_struct, decmag_t (decimal.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/decimal/decmag_struct.html (generated 2026-10-20).