FLINT3.7.0-dev

z_add_checked, z_mul_checked

Synopsis#include <flint/long_extras.h>
int z_add_checked(slong * a, slong b, slong c)source
int z_mul_checked(slong * a, slong b, slong c)source

Set *a to b + c or b c and return 0 if the result fits in an slong; otherwise return 1, and *a holds the exact result reduced modulo 2^{\mathtt{FLINT\_BITS}} (into the range of slong). With GCC and Clang they compile to the overflow-checking built-ins.

Cite this page

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