FLINT3.7.0-dev

mp_real_add, mp_real_sub

Synopsis#include <flint/mp_real.h>
void mp_real_add(mp_real_t res, const mp_real_t a, const mp_real_t b, slong n)source
void mp_real_sub(mp_real_t res, const mp_real_t a, const mp_real_t b, slong n)source

Set res to a + b resp. a - b.

The sum is formed in the destination without a temporary. A sum taken in place, x := x + y with y inside the window of x, costs the limb addition of y plus a constant, independently of the length of x. A y reaching below the last limb of an inexact x is cut there, its tail entering the radius. Only a y below an exact x (the contiguous mantissa must move) or an x longer than the precision asks for (a truncation) cost a pass over x.

Guides#

Cite this page

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