nfloat_hypot
#include <flint/nfloat.h>int nfloat_hypot(nfloat_ptr res, nfloat_srcptr x, nfloat_srcptr y, gr_ctx_t ctx)sourceSets res to , correctly rounded in every mode (truncated by default), without intermediate overflow or underflow. This also implements nfloat_complex_abs.
With and the difference of the exponents, the result is with ( the precision) when exceeds about half the precision. Otherwise for an integer of at most words (the squares of the mantissas, aligned exactly), whose truncated square root with an inexactness flag gives the result. At one word on 64-bit machines, is formed in registers and the truncated root is computed from the integer square root of its top two words, since the discarded low bits of do not change the floor of the square root. At two words, is formed in registers (the smaller square truncated to the four words of the larger) and its root is approximated with a guard word, which certifies the truncation in all but rare cases. From 12 words (or from 5 words when the exponents differ by at least of the precision), the exact squares are replaced by high squarings (flint_mpn_sqrhigh), whose sum is a lower bound within about units of its last word, and the square root with a guard word certifies the truncation likewise, with the exact computation as the fallback.
Guides#
The FLINT team, “nfloat_hypot (nfloat.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/nfloat/nfloat_hypot.html (generated 2026-11-02).
@misc{flint-doc-nfloat-nfloat-hypot,
author = {{The FLINT team}},
title = {{nfloat\_hypot (nfloat.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/nfloat/nfloat_hypot.html},
note = {Generated 2026-11-02}
}