| Age | Commit message (Collapse) | Author |
|
Addresses #132818
Part of #95250
|
|
This PR implements `atanpif16(x)` which computes
$\frac{\arctan(x)}{\pi}$ for half-precision floating-point numbers using
polynomial approximation with domain reduction.
## Mathematical Implementation
The implementation uses a 15th-degree Taylor polynomial expansion of
$\frac{\arctan(x)}{\pi}$ that's computed using
[`python-sympy`](https://www.sympy.org/en/index.html) and it's accurate
in $|x| \in [0, 0.5)$:
$$
g(x) = \frac{\arctan(x)}{\pi} \approx
\begin{aligned}[t]
& 0.318309886183791x \\
& - 0.106103295394597x^3 \\
& + 0.0636619772367581x^5 \\
& - 0.0454728408833987x^7 \\
& + 0.0353677651315323x^9 \\
& - 0.0289372623803446x^{11} \\
& + 0.0244853758602916x^{13} \\
& - 0.0212206590789194x^{15} + O(x^{17})
\end{aligned}
$$
---
To ensure accuracy across all real inputs, the domain is divided into
three cases with appropriate transformations:
**Case 1: $|x| \leq 0.5$**
Direct polynomial evaluation:
$$\text{atanpi}(x) = \text{sign}(x) \cdot g(|x|)$$
**Case 2: $0.5 < |x| \leq 1$**
Double-angle reduction using:
$$\arctan(x) = 2\arctan\left(\frac{x}{1 + \sqrt{1 + x^2}}\right)$$
$$\text{atanpi}(x) = \text{sign}(x) \cdot 2g\left(\frac{|x|}{1 + \sqrt{1
+ x^2}}\right)$$
**Case 3: $|x| > 1$**
Reciprocal transformation using
$$\arctan(x) = \frac{\pi}{2} - \arctan\left(\frac{1}{x}\right) \
\text{for} \ x \gt 0$$
$$\text{atanpi}(x) = \text{sign}(x) \cdot \left(\frac{1}{2} -
g\left(\frac{1}{|x|}\right)\right)$$
Closes #132212
|
|
#146226 with fixing asinpi MPFR number function and make it work when
mpfr < `4.2.0`
|
|
Reverts llvm/llvm-project#146226
The MPFR test uses `mpfr_asinpi` which requires MPFR 4.2.0 or later, but
the Buildbots are running an older version of MPFR.
See https://lab.llvm.org/buildbot/#/builders/104/builds/27743 for
example.
I said I was going to revert the PR until we have a workaround for older
versions of MPFR, but then I forgot and I just disabled the entrypoints
which doesn't fix the Buildbot builds.
|
|
The function is implemented using the following Taylor series that's
generated using [python-sympy](https://www.sympy.org/en/index.html), and
it is very accurate for |x| $$\in [0, 0.5]$$ and has been verified using
Geogebra. The range reduction is used for the rest range (0.5, 1].
$$
\frac{\arcsin(x)}{\pi} \approx
\begin{aligned}[t]
& 0.318309886183791x \\
& + 0.0530516476972984x^3 \\
& + 0.0238732414637843x^5 \\
& + 0.0142102627760621x^7 \\
& + 0.00967087327815336x^9 \\
& + 0.00712127941391293x^{11} \\
& + 0.00552355646848375x^{13} \\
& + 0.00444514782463692x^{15} \\
& + 0.00367705242846804x^{17} \\
& + 0.00310721681820837x^{19} + O(x^{21})
\end{aligned}
$$
## Geogebra graph

Closes #132210
|
|
This PR enables support for BFloat16 type in LLVM libc along with
support for testing BFloat16 functions via MPFR.
---------
Signed-off-by: krishna2803 <kpandey81930@gmail.com>
Signed-off-by: Krishna Pandey <kpandey81930@gmail.com>
Co-authored-by: OverMighty <its.overmighty@gmail.com>
|
|
Instead of manually calculating the major and minor version numbers, we
can directly use `MPFR_VERSION_NUM` to simplify this.
|
|
Addresses #132211 #132754
Part of #95250
|
|
|
|
This PR aims to add the groundwork to test the precision of libc complex
functions against MPC. I took `cargf` as a test to verify that the infra
works fine.
|