deccfloat_exp, deccfloat_expm1, deccfloat_log, deccfloat_log1p, deccfloat_sin, deccfloat_cos, deccfloat_tan, deccfloat_sinh, deccfloat_cosh, deccfloat_tanh, deccfloat_asin, deccfloat_acos, deccfloat_atan, deccfloat_asinh, deccfloat_acosh, deccfloat_atanh, deccfloat_sin_cos, deccfloat_sinh_cosh, deccfloat_pi
#include <flint/decimal.h>int deccfloat_exp(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_expm1(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_log(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_log1p(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_sin(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_cos(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_tan(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_sinh(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_cosh(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_tanh(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_asin(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_acos(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_atan(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_asinh(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_acosh(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_atanh(deccfloat_t res, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_sin_cos(deccfloat_t res1, deccfloat_t res2, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_sinh_cosh(deccfloat_t res1, deccfloat_t res2, const deccfloat_t x, gr_ctx_t ctx)sourceint deccfloat_pi(deccfloat_t res, gr_ctx_t ctx)sourceThe elementary functions of complex floating-point numbers, componentwise correctly rounded: the real and imaginary parts of the exact value are each rounded once, to the context precision in the respective rounding modes. The other special functions, including the complex-only ones (exp_pi_i, log_pi_i, polygamma, ...), are available through the generic gr methods.
Each function is evaluated by the first applicable of three methods.
- Real and imaginary arguments. For a real argument t the real
decfloatfunction is called, inheriting its exact cases and special-argument handling; if the value is not real, the standard reductions are applied: \log(-t) = \log t + \pi i, \operatorname{acos} t = \pm i\operatorname{acosh} t and \pi - i\operatorname{acosh}(-t) for t > 1 and t < -1, \operatorname{acosh} t = i\operatorname{acos} t for -1 \le t < 1 and \operatorname{acosh}(-t) + \pi i for t < -1, \exp(\pi i t) = \cos(\pi t) + i\sin(\pi t), and \sqrt{-t} = i\sqrt t. For an imaginary argument it the corresponding real function is used where one exists: \sin(it) = i\sinh t, \cos(it) = \cosh t, \tan(it) = i\tanh t, \cot(it) = -i\coth t, \operatorname{asin}(it) = i\operatorname{asinh} t, \operatorname{atan}(it) = i\operatorname{atanh} t for |t| < 1, \operatorname{erf}(it) = i\operatorname{erfi} t and so on, and \exp(it) = \cos t + i\sin t. So \sqrt{-4} = 2i, \log(-1) = \pi i, \Gamma(5) = 24 and \sin(10^{-10^9} i) = i\sinh(10^{-10^9}) are correctly rounded at negligible cost. - Tiny arguments. For \exp, \operatorname{expm1}, \log(1 + z), \log near 1, the trigonometric and hyperbolic functions and their inverses, \operatorname{sinc}, \Gamma, 1/\Gamma, \psi, \zeta near 1, W, \operatorname{Li}_2, \operatorname{Si}, \operatorname{Shi} and (through 1/z) the inverse cotangent, cosecant and their hyperbolic versions at large arguments, the leading part S (z, 1, \pm 1/z, z - 1 or 1/(z - 1)) is computed exactly and the sign of each component of f(z) - S from the first Taylor terms; a component whose remainder lies more than
prec+ 4e digits below S is S rounded with the remainder as a sticky bit. This works for arbitrarily unbalanced arguments: \sin(10^{-10^9} + 10^{-2 \cdot 10^9} i) rounded toward zero has both parts one ulp below 10^{-10^9} and 10^{-2 \cdot 10^9}. - Ziv's strategy through
acb. The argument is converted to anacbball and thegrmethod of theacbring is evaluated at increasing precision until the rounding of each remaining component is decided;GR_UNABLEis returned if this has not happened at 64 times the working precision.
The last method is the only one for the other special functions. It fails when a component is a representable number or extremely close to one and the case is not detected, for example the real part of \operatorname{erf}(300 + i), which is 1 - O(10^{-39000}), and for the functions without an acb method at non-real arguments (sec_pi, asin_pi, acos_pi, atan_pi, acot_pi, asec_pi, acsc_pi, erfinv, erfcinv).
The FLINT team, “deccfloat_exp, deccfloat_expm1, deccfloat_log, deccfloat_log1p, deccfloat_sin, deccfloat_cos, deccfloat_tan, deccfloat_sinh, deccfloat_cosh, deccfloat_tanh, deccfloat_asin, deccfloat_acos, deccfloat_atan, deccfloat_asinh, deccfloat_acosh, deccfloat_atanh, deccfloat_sin_cos, deccfloat_sinh_cosh, deccfloat_pi (decimal.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/decimal/deccfloat_exp.html (generated 2026-10-20).
@misc{flint-doc-decimal-deccfloat-exp,
author = {{The FLINT team}},
title = {{deccfloat\_exp, deccfloat\_expm1, deccfloat\_log, deccfloat\_log1p, deccfloat\_sin, deccfloat\_cos, deccfloat\_tan, deccfloat\_sinh, deccfloat\_cosh, deccfloat\_tanh, deccfloat\_asin, deccfloat\_acos, deccfloat\_atan, deccfloat\_asinh, deccfloat\_acosh, deccfloat\_atanh, deccfloat\_sin\_cos, deccfloat\_sinh\_cosh, deccfloat\_pi (decimal.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/decimal/deccfloat_exp.html},
note = {Generated 2026-10-20}
}