Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
780d446
[fp] fp32mp2 exp to 46 bits, with gradual underflow
akolesov-nvidia Oct 29, 2026
768c92c
[fp] fp32mp2 exp2/exp10/log family to 45-48 bits
akolesov-nvidia Oct 29, 2026
4e6760c
[fp] fp32mp2 trig family to 45-46 bits
akolesov-nvidia Oct 29, 2026
6a8d944
[fp] fp32mp2 asin/acos/atan/atan2 to 46-48 bits; more accurate sqrt
akolesov-nvidia Oct 29, 2026
951d44b
[fp] fpmp2 sqrt/rsqrt: new forms for fp32mp2 only
akolesov-nvidia Oct 29, 2026
770adfa
[fp] fpmp2 exp: split the fp32mp2 kernel for reuse by pow
akolesov-nvidia Oct 30, 2026
4f15d72
[fp] fp32mp2 pow: more accurate exponent argument
akolesov-nvidia Oct 30, 2026
8aed553
[fp] fp32mp2 cbrt/rcbrt to 47 bits, native fp32mp2 hypot/rhypot
akolesov-nvidia Oct 30, 2026
d733a69
[fp] fp32mp2 sinh/tanh/atanh to 46 bits; overflow and domain fixes
akolesov-nvidia Oct 30, 2026
5b22aed
[fp] fp32mp2 fdim, remquo, lrint/lround/llrint/llround exact on the p…
akolesov-nvidia Nov 3, 2026
812b308
[fp] fpmp2 classification predicates look at both limbs
akolesov-nvidia Nov 3, 2026
8f2acb9
[fp] fp32mp2 erfc/boys_f0/normcdfinv to 45-46 bits; native erfcx, nor…
akolesov-nvidia Nov 3, 2026
3e30040
[fp] fp32mp2 normcdfinv: tests for p at the ends of (0, 1)
akolesov-nvidia Nov 4, 2026
22d3ed7
fpmp: fp32mp2 fmod exact on every pair; remainder and remquo exact in…
akolesov-nvidia Nov 13, 2026
1fad94f
[fp] fp32mp2 math kernels: pass scalars as scalars, double with * 2.0f
akolesov-nvidia Nov 10, 2026
62eb7ab
[fp] fp32mp2 math: IEEE special values for log/log2/log10, atan, the …
akolesov-nvidia Nov 12, 2026
2f4e054
[docs][fp] fpmp: sqrt and rsqrt take no branch for special arguments
akolesov-nvidia Nov 12, 2026
8262859
[fp] fpmp: unit test for the math special values
akolesov-nvidia Nov 12, 2026
b9b8100
[docs][fp] fpmp: the sign of zero is not tracked
akolesov-nvidia Nov 12, 2026
04645e0
[fp] fp32mp2 pow: take the triple-float implementation of PR #12548
akolesov-nvidia Nov 13, 2026
e748bb2
[fp] fp32mp2 rsqrt: keep the single-step form of main
akolesov-nvidia Nov 13, 2026
9e9823e
[fp] fp32mp2 trig reduction: take the fast-path accumulation of #12530
akolesov-nvidia Nov 13, 2026
c48460e
[fp] fpmp math: clang-format
akolesov-nvidia Nov 13, 2026
151aea0
Merge branch 'main' into dev/akolesov/fp32mp2_math_update
akolesov-nvidia Nov 13, 2026
878a2af
[fp] fp32mp2 math: special-value fixes from the review of #12641
akolesov-nvidia Nov 14, 2026
804f016
[fp] fpmp: the special-values test covers the review's gaps
akolesov-nvidia Nov 14, 2026
0abc63d
[docs][fp] fpmp: what the reduction, sqrt, the remainder family and t…
akolesov-nvidia Nov 14, 2026
8989bc7
[fp] fpmp: CI fixes: unused variable in sqrt, fast-math builds skip t…
akolesov-nvidia Nov 14, 2026
c330b4c
[fp] fpmp math: contraction-proof products in the refined division an…
akolesov-nvidia Nov 14, 2026
1a71773
[fpmp] CI override: run the cuda/fp unit tests on sm_75 and sm_90 [re…
rmlarsen Nov 7, 2026
07f38af
[fpmp] CI override: name CTK 12.X's compilers
rmlarsen Nov 12, 2026
bc4efdd
[fpmp] Keep GCC from contracting the products of div_refined and the …
rmlarsen Nov 14, 2026
5f9a1d2
[fpmp] Seed the host fp32mp2 cbrt and rcbrt with a refined polynomial
rmlarsen Nov 14, 2026
8cd5af7
[fpmp] fp32mp2 erfc: return exactly 0 or 2 beyond the underflow thres…
rmlarsen Nov 14, 2026
dc3026b
[fpmp] fp32mp2 sin, tan and sincos: return -0 for -0
rmlarsen Nov 14, 2026
e1e3b14
[fpmp] fp32mp2 asin, acos, atan and atan2: handle their special value…
rmlarsen Nov 14, 2026
6104e09
[fpmp] fp32mp2 exp2, expm1, log1p, sinh, tanh and atanh: fix special …
rmlarsen Nov 14, 2026
4a2e288
[fpmp] Evaluate the fp32mp2 erfc kernel with one reciprocal and a ref…
rmlarsen Nov 15, 2026
21169b5
[fpmp] Reduce and evaluate fp32mp2 sin, cos and tan in fewer operatio…
rmlarsen Nov 15, 2026
decbde0
[fpmp] Evaluate fp32mp2 asin, acos, atan and atan2 on one table-drive…
rmlarsen Nov 15, 2026
d9cffbd
[fpmp] Evaluate the fp32mp2 exp and log families on the tables of pow
rmlarsen Nov 15, 2026
038de85
[fpmp] Evaluate the fp32mp2 hyperbolic functions on the exp and log k…
rmlarsen Nov 15, 2026
7f2435f
[fpmp] fpmp2 norms, fmax, fmin and fdim: fix special operands
rmlarsen Nov 14, 2026
589756c
[fpmp] Give fpmp2 sqrt and rsqrt a second-order kernel at high accura…
rmlarsen Nov 15, 2026
80204a9
Merge branch 'main' into fpmp-cbrt-host-seed
rmlarsen Nov 15, 2026
0013716
Merge branch 'main' into fpmp-level-kernels
rmlarsen Nov 15, 2026
ff85322
Merge NVIDIA/cccl#12641 (c330b4cd14) into fpmp-cbrt-host-seed
rmlarsen Nov 15, 2026
dc07be9
[fpmp] fp32mp2 erfcinv: form the far-tail seed with explicit fmas
rmlarsen Nov 15, 2026
74c1c68
Merge branch 'fpmp-cbrt-host-seed' into fpmp-level-kernels
rmlarsen Nov 15, 2026
dc90ca8
[fpmp] fp32mp2 sinpi, cospi, erf and erfinv: fix the sign of zero res…
rmlarsen Nov 15, 2026
0d3de05
[fpmp] Evaluate fp32mp2 erfcx and normcdf on the one-reciprocal erfc …
rmlarsen Nov 15, 2026
ec68e67
[fpmp] fp32mp2 llrint, llround, erfcx, exp_scales and the zero-sign s…
rmlarsen Nov 15, 2026
02b1d83
Merge the review fixes of #12568 (ec68e67665) into fpmp-level-kernels
rmlarsen Nov 15, 2026
1ce07a9
[fpmp] fpmp2 zero-argument shortcuts: test both limbs
rmlarsen Nov 15, 2026
5a9b39b
Merge the zero-argument fix of #12568 (1ce07a92bc) into fpmp-level-ke…
rmlarsen Nov 15, 2026
ec0800b
[fpmp] fp32mp2 sinh: clamp the reciprocal's divisor; fmax, fmin: orde…
rmlarsen Nov 15, 2026
62496ed
Merge #12568 (ec0800be1a) into fpmp-level-kernels; leave the subnorma…
rmlarsen Nov 15, 2026
0441ab8
[fpmp] fp32mp2_low expm1, log1p, sinh, tanh, asinh, atanh: renormaliz…
rmlarsen Nov 15, 2026
0f5132d
[fpmp] fp32mp2 atanh, erfinv and atan2: loose pairs of low-accuracy a…
rmlarsen Nov 15, 2026
d6c3395
Merge #12568 (0f5132d95b) into fpmp-level-kernels: the low-accuracy p…
rmlarsen Nov 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ci/matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ workflows:
#
# IMPORTANT: Do NOT delete or remove the `override:` key below, even when it is empty.
override:
# fpmp changes: the cuda/fp unit tests on sm_75 and sm_90, and MSVC and arm64 compiles. Reset before merging.
# CTK 12.X needs its newest supported compilers named: the bare 'gcc', 'clang' and 'msvc' are CTK 13.X's.
- {jobs: ['run_gpu'], project: 'target', ctk: '12.X', cxx: ['gcc14', 'clang19'], gpu: 't4',
args: '--preset libcudacxx --lit-tests "cuda/fp/units"'}
Comment on lines +92 to +93

@coderabbitai coderabbitai Bot Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Functional Correctness · Quick win

important: Clear the temporary override before merging.

These entries replace the normal pull_request matrix. Lines 67-69 explicitly state that this mode makes branch-protection checks fail. Remove the temporary entries after targeted validation, but retain the override: key.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes: the override is there while this stack is in draft iteration and is reset to an empty override: before merging.

- {jobs: ['run_gpu'], project: 'target', ctk: '13.X', cxx: ['gcc', 'clang'], gpu: 't4',
args: '--preset libcudacxx --lit-tests "cuda/fp/units"'}
- {jobs: ['run_gpu'], project: 'target', ctk: '13.X', cxx: 'gcc', gpu: 'h100',
args: '--preset libcudacxx --lit-tests "cuda/fp/units"'}
- {jobs: ['run_cpu'], project: 'target', ctk: '12.X', cxx: 'msvc2022',
args: '--preset libcudacxx --lit-precompile-tests "cuda/fp/units"'}
- {jobs: ['run_cpu'], project: 'target', ctk: '13.X', cxx: 'msvc',
args: '--preset libcudacxx --lit-precompile-tests "cuda/fp/units"'}
- {jobs: ['run_cpu'], project: 'target', cpu: 'arm64', ctk: '13.X', cxx: 'gcc',
args: '--preset libcudacxx --lit-precompile-tests "cuda/fp/units"'}

pull_request_fork:
- {jobs: ['build'], project: ['libcudacxx', 'thrust', 'cudax'], std: 'max', cxx: ['gcc', 'clang', 'msvc']}
Expand Down
105 changes: 85 additions & 20 deletions docs/libcudacxx/extended_api/fp/fpmp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,42 @@ the product takes 6 instead of 8 at ``mid``, and its error stays below ``2u²``
with the converted ``c`` reaches ``3u²``; the quotient is the same value, one instruction cheaper. The :ref:`error bounds
<libcudacxx-extended-api-fp-fpmp-error-bounds>` page lists each case.

``sqrt`` and ``rsqrt`` are kept as short as the arithmetic itself and take no branch for special
arguments: they expect a positive, finite argument whose high limb is a normal number. ``sqrt(0)``
is ``0``, but ``rsqrt(0)`` is NaN rather than infinity, both return NaN for ``+inf``, for a negative
argument and for NaN, and on the device both return NaN for a subnormal argument. ``sqrt`` keeps
its accuracy down to a high limb of about ``2^-100``; below that its residual term is subnormal
and the error grows (11 u² at ``2^-108``). Code that can meet such arguments should test for them
before the call, and scale a subnormal or tiny argument by an even power of two (and the result
back by its square root) around it. In the ``high`` types (``fp32mp2_high``, ``fp64mp2_high``)
``sqrt`` and ``rsqrt`` are a different kernel, which adds the second-order term of its Newton step
(within ``0.5u²`` and ``2.7u²`` on the host, ``3.9u²`` for ``rsqrt`` on the device, against
``2.5u²`` and ``8u²``, ``13u²`` on the device, for ``fp32mp2``) and returns the IEEE 754 values:
``sqrt(±0)`` is ``±0`` and ``rsqrt(±0)`` is ``±inf``, ``sqrt(+inf)`` is ``+inf`` and
``rsqrt(+inf)`` is ``+0``, a negative argument or NaN gives NaN, and an argument too small for the
kernel is scaled by a power of four around it, on the host and on the device. It costs about half
the throughput of the short kernel on a GPU. The math functions below return the C99 Annex F
values for infinities, NaN and arguments outside their domain, except for the sign of a zero
result, covered next.

The sign of zero is not tracked, by the arithmetic or by most math functions. A pair is stored
renormalized, and the renormalization adds the two limbs, which turns a ``-0`` high limb into
``+0``: every zero result of ``+``, ``-``, ``*`` and ``fma`` is ``+0``, including ``(-0) + (-0)``,
``(-0) * 1`` and ``x * (-0)``, where IEEE 754 gives ``-0``. A zero from ``/`` or from a math
function carries whichever sign its evaluation happens to leave. The exceptions that do follow C99
are the operations that act on the sign bit itself (unary negation, ``fabs``, ``copysign``,
construction from a built-in ``-0.0``), ``sin``, ``tan`` and the sine of ``sincos``, ``sinpi`` and
the sine of ``sincospi``, ``expm1``, ``log1p``, ``sinh``, ``tanh``, ``asinh``, ``atanh``, ``erf``
and ``erfinv``, which return a zero argument unchanged, as does ``sqrt`` in the ``high`` types,
``asin``, ``atan`` and ``atan2``, which answer a zero argument on entry (``asin(-0)`` and
``atan(-0)`` are ``-0``, and ``atan2`` reads the sign bit of a zero ``y``), ``sinpi`` at a nonzero
integer, whose zero has the sign of the argument, ``cospi``, which is ``+0`` at every half-integer,
``fmax`` and ``fmin``, which order ``-0`` below ``+0``, and the rounding functions ``ceil``,
``floor``, ``trunc``, ``round``, ``rint``, ``nearbyint`` and the fraction of ``modf``, whose zero
result carries the sign of the argument on the host and the device alike. ``signbit`` reports the
high limb. Code that distinguishes ``-0`` from ``+0`` anywhere else has to take the sign from the
operands, before the arithmetic.

``renormalize(x)`` restores the non-overlap invariant, ``|lo| <= ulp(hi)/2``, which only ``low``
accuracy can leave broken; see :ref:`accuracy levels <libcudacxx-extended-api-fp-fpmp-accuracy>`
above. Converting up out of ``low`` applies it automatically, so the explicit call is for
Expand All @@ -375,34 +411,63 @@ float-float arithmetic for ``fp32mp2``, with no FP64 operation anywhere, which i
hardware where FP64 is rationed:

- **Exponentials and logarithms** — ``exp``, ``exp2``, ``exp10``, ``expm1``, ``log``, ``log2``,
``log10``, ``log1p``
``log10``, ``log1p`` (``expm1`` and ``log1p`` evaluate a Taylor series below ``2^-7`` in
``fp32mp2_high``, which keeps them within ``2.4u²`` and ``1.8u²`` there, against ``4.4u²`` and
``9.8u²`` at the other levels; the extra branch costs throughput on a GPU where a warp mixes
arguments on both sides of ``2^-7``)
- **Powers and roots** — ``pow``, ``cbrt``, ``rcbrt``, alongside the ``sqrt`` and ``rsqrt``
already named above
- **Distances and norms** — ``hypot``, ``rhypot``, ``norm3d``, ``norm4d``, ``rnorm3d``,
``rnorm4d``, for ``fp64mp2`` as well, where they carry both limbs (``fp32mp2_high`` computes
the four norms through ``double``, within ``0.6u²``, where the pair kernel of the other levels,
with no FP64 operation, errs by up to ``5.1u²``, and ``8.1u²`` for the reciprocals)
- **Trigonometric** — ``sin``, ``cos``, ``tan``, ``sincos``, ``asin``, ``acos``, ``atan``,
``atan2``, and the pi-scaled ``sinpi``, ``cospi``, ``sincospi``, which split the argument over
the limb pair rather than reducing it against a radian multiple of pi
- **Hyperbolic** — ``sinh``, ``cosh``, ``tanh``, ``asinh``, ``acosh``, ``atanh``
- **Error functions** — ``erf``, ``erfc``
``atan2``, and the pi-scaled ``sinpi``, ``cospi``, ``sincospi``, which split the argument over the
limb pair rather than reducing it against a radian multiple of pi. The radian reduction is exact
(Payne-Hanek) from ``|x| >= 2^20`` on; below that a four-piece ``pi/2`` leaves the reduced
argument an absolute error of about ``n * 2^-100`` for ``n = round(2x/pi)``, so the near-zero one
of ``sin`` and ``cos`` loses relative accuracy within ``n * 2^-54`` of a multiple of ``pi/2`` (a
few u² at ``2^-40`` from a multiple near ``10^5``, 300 u² at ``2^-53`` from ``161 pi/2``, up to
``10^6`` u² for the float pairs closest to a multiple near ``2^19``). ``sin``, ``cos``, ``tan``,
``sincos``, ``sinpi``, ``cospi`` and ``sincospi`` evaluate a longer kernel in ``fp32mp2_high``,
whose largest error for the sine and the cosine is about a quarter below that of the shorter
kernel of the other levels. ``asin``, ``acos``, ``atan`` and ``atan2`` have two kernels: a
table-driven one in ``fp32mp2_low`` and the default level, and polynomial ones in
``fp32mp2_high``, 1 to 1.5 bits more accurate for two to three times the instructions; the
special values are the same at every level
- **Hyperbolic** — ``sinh``, ``cosh``, ``tanh``, ``asinh``, ``acosh``, ``atanh`` (``sinh`` and
``cosh`` stay finite up to ``|x| = 89.416``, where ``exp`` alone overflows from ``88.723``;
``sinh``, ``tanh`` and ``atanh`` have a second ``fp32mp2`` kernel in ``fp32mp2_high``, with about
half the worst-case error of the faster one the other levels share)
- **Error functions** — ``erf``, ``erfc``, ``erfcx``, ``erfinv``, ``erfcinv`` (``erfc`` and
``erfcx`` have a more accurate and slower kernel in ``fp32mp2_high``, with about half the error
of the other levels for ``|x| >= 1/2``, and so does ``normcdf``)
- **Rounding, magnitude and scaling** — ``ceil``, ``floor``, ``trunc``, ``round``, ``fabs``,
``ldexp``, ``scalbn``
- **Minimum, maximum and remainder** — ``fmin``, ``fmax``, ``min``, ``max``, ``fmod``,
``remainder``
- **Probability** — ``normcdfinv``, and ``icdf`` for ``fp32mp2`` only, which turns a 32- or 64-bit
- **Minimum, maximum, difference and remainder** — ``fmin``, ``fmax``, ``min``, ``max``,
``fdim``, ``fmod``, ``remainder`` (``fmod``, ``remainder`` and ``remquo`` are exact on sparse
pairs, whose tail sits far below the head, in ``fp32mp2_high``, as long as the divisor's two limbs
span at most 126 bits, ``fmod(2^100 + 2^-120, 2^100)`` being past that; the other levels compute
on the pair rounded to 53 significant bits, as a ``double`` would. The ``fp64mp2`` ``remquo``,
``lrint``, ``lround``, ``llrint`` and ``llround`` are ``double`` fallbacks on the high limb, not
exact on the pair)
- **Probability** — ``normcdf``, ``normcdfinv``, and ``icdf`` for ``fp32mp2`` only, which turns a 32- or 64-bit
uniform integer into a Gaussian variate. Taking an integer rather than a pair, it is the one
function here that ADL cannot find, so it has to be written ``cuda::icdf(bits)``, and its
accuracy level is a defaulted template parameter rather than a deduced one
- **Special** — ``boys_f0``, the zeroth-order Boys function

The remaining names are present with the same signatures, but implemented generically rather than
through a dedicated float-float path: ``erfinv``, ``erfcinv``, ``erfcx``, ``normcdf``, ``tgamma``,
``lgamma``, the Bessel family ``j0``, ``j1``, ``jn``, ``y0``, ``y1``, ``yn``, ``cyl_bessel_i0``
and ``cyl_bessel_i1``, the distances ``hypot`` and ``rhypot``, the vector norms ``norm3d``,
``norm4d``, ``rnorm3d`` and ``rnorm4d``, ``rint``, ``nearbyint``, ``lrint``, ``lround``,
``llrint``, ``llround``, ``copysign``, ``scalbln``, ``frexp``, ``modf``, ``logb``, ``ilogb``,
``nextafter``, ``fdim``, ``remquo``, and the classification predicates. For the exact ones among
these — the rounding, sign and decomposition family — that costs nothing, since an exact operation
is exact however it is written; for the transcendentals it means evaluation through the backend
covered in the next section.
- **Special** — ``boys_f0``, the zeroth-order Boys function, for arguments ``a >= 0``. A negative
argument is outside the domain the kernels cover: they extrapolate there, with a relative error
of ``2e-13`` at ``-0.25`` that grows to ``4%`` at ``-8``, and return ``+inf`` below ``-94``

The exact operations — ``rint``, ``nearbyint``, ``lrint``, ``lround``, ``llrint``, ``llround``,
``copysign``, ``scalbln``, ``frexp``, ``modf``, ``logb``, ``ilogb``, ``remquo`` and the
classification predicates — are written directly on the two float limbs, with no FP64 anywhere:
an exact operation is exact however it is written, and the limb pair is the cheapest place to
write it. The remaining names are present with the same signatures, but implemented generically
rather than through a dedicated float-float path: ``tgamma``, ``lgamma``, the Bessel family ``j0``,
``j1``, ``jn``, ``y0``, ``y1``, ``yn``, ``cyl_bessel_i0`` and ``cyl_bessel_i1``, and ``nextafter``;
for the transcendentals among them that means evaluation through the backend covered in the next
section.

The predicates come in two spellings. ``fpmp_isfinite``, ``fpmp_isinf``, ``fpmp_isnan`` and
``fpmp_signbit`` are always available, while the standard names ``isfinite``, ``isinf``, ``isnan``
Expand Down
36 changes: 29 additions & 7 deletions docs/libcudacxx/extended_api/fp/fpmp_error_bounds.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ Conventions
``fp64mp2`` both reciprocals are correctly rounded, while the device's reciprocal square root
is close to correctly rounded and the host's ``1/sqrt(x)`` carries two roundings. One Newton
step leaves about ``(3/2)·ε²`` of a seed error ``ε``, which at double-word precision is
visible: a 1u seed leaves 1.5u², a 1.5u seed 3.4u², a 2u seed 6.5u². Where the sides differ,
the tables quote the device.
visible: a 1u seed leaves 1.5u², a 1.5u seed 3.4u², a 2u seed 6.5u². The ``fp32mp2`` ``sqrt``
corrects its seed once more before the low limb is formed and is the same on both sides; the
``fp64mp2`` one is not, and where the sides differ, the tables quote the device.

The bounds
----------
Expand Down Expand Up @@ -181,13 +182,21 @@ host against binary128 — whichever of the two is larger.
- 6.6

* - ``sqrt(x)``
- ``mid``
- ``low``, ``mid``
- —
- measured
- ``x > 0``
- 9.5
- 2.8
- 2.9 [#seed]_

* - ``sqrt(x)``
- ``high``
- —
- measured
- ``x ≥ 0``
- 0.5
- 1.9 [#high]_

.. [#host] Measured on the host against an exact reference, the error accumulated from
error-free transforms, over ``5·10⁷`` normalized operand pairs from random and structured
regimes plus a hill-climbing search for the worst case.
Expand All @@ -198,8 +207,17 @@ host against binary128 — whichever of the two is larger.
.. [#seed] Measured on the device against binary128 over 2\ :sup:`22` operands spanning 80
binades, with the host run on the same operands for comparison (5.8): the host's
two-rounding ``1/sqrt(x)`` seed costs it the difference, as the seed floor in *Conventions*
predicts. The specification's own ``fp64mp2`` table reports a smaller maximum for ``sqrt``
over its working range.
predicts. The ``fp32mp2`` ``sqrt`` takes its Newton step on the exact residual and refines
the reciprocal root once more before forming its low limb, so its seed no longer shows: 2.5
on both sides in the same run. The specification's own ``fp64mp2`` table reports a smaller
maximum for ``sqrt`` over its working range.
.. [#high] ``sqrt`` and ``rsqrt`` of a ``high`` type add the second-order term of their Newton
step, which removes the seed floor described in *Conventions*, and answer the IEEE 754
special values. Measured against MPFR over 2\ :sup:`20` (``fp32mp2``) and 2\ :sup:`18`
(``fp64mp2``) operands in each of six ranges that together span the type, subnormal operands
included, on the host and on the device. The ``fp64mp2`` figure is the device's, which takes
its reciprocal square root as the seed without refining it; the host stays within 0.5.
``rsqrt(x)`` stays within 2.7 on the host and 3.9 on the device at ``high``.

``low`` and ``mid`` addition, ``low`` and ``mid`` ``fma``, and ``low`` and ``mid``
multiplication by a one-limb scalar compute the *same value*; the normalizing level additionally normalizes it, which is exact, so they share a bound
Expand Down Expand Up @@ -378,7 +396,11 @@ The ``low`` level, and composing operations
Every bound assumes normalized operands. A ``low`` result is not normalized — its limbs may
overlap — and feeding it to a further operation weakens that operation's bound by roughly
the overlap: an input with ``|lo| ≤ k·u·|hi|`` instead of ``u·|hi|`` scales the ``u²``
constants of the next operation by about ``k``. Over a long ``low`` chain the overlap grows
constants of the next operation by about ``k``. The ``fp32mp2_low`` functions ``expm1``,
``log1p``, ``sinh``, ``tanh``, ``asinh`` and ``atanh`` renormalize an argument with
``|lo| > 2^-20·|hi|`` themselves, because their kernels take the size of the argument from the
high limb, which a cancellation can leave at zero: ``(2^24, 0.25) - 2^24`` is ``(0, 0.25)``.
Over a long ``low`` chain the overlap grows
with the chain, which is why ``renormalize()`` exists and why converting a ``low`` value to
``mid`` or ``high`` restores the invariant (:ref:`changing the accuracy level
<libcudacxx-extended-api-fp-fpmp-level-change>`). The
Expand Down
Loading
Loading