<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/libc/utils/MPFRWrapper/MPFRUtils.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[libc][math][c23] Add rsqrtf16() function  (#137545)</title>
<updated>2025-09-17T14:19:20+00:00</updated>
<author>
<name>Anton Shepelev</name>
<email>44649959+amemov@users.noreply.github.com</email>
</author>
<published>2025-09-17T14:19:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=80f9c72a1e045aa012b88c1b32cc6c5bb008a3db'/>
<id>80f9c72a1e045aa012b88c1b32cc6c5bb008a3db</id>
<content type='text'>
Addresses #132818 
Part of #95250</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Addresses #132818 
Part of #95250</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][math][c++23] Add sqrtbf16 math function (#156654)</title>
<updated>2025-09-06T09:06:02+00:00</updated>
<author>
<name>Krishna Pandey</name>
<email>kpandey81930@gmail.com</email>
</author>
<published>2025-09-06T09:06:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8dda18f83611803588c470be5e2c3c1203d3ae2b'/>
<id>8dda18f83611803588c470be5e2c3c1203d3ae2b</id>
<content type='text'>
This PR adds sqrtbf16 higher math function for BFloat16 type along with
the tests.

---------

Signed-off-by: Krishna Pandey &lt;kpandey81930@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR adds sqrtbf16 higher math function for BFloat16 type along with
the tests.

---------

Signed-off-by: Krishna Pandey &lt;kpandey81930@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][math][c23] Implement C23 math function atanpif16 (#150400)</title>
<updated>2025-09-02T19:50:50+00:00</updated>
<author>
<name>Mohamed Emad</name>
<email>hulxxv@gmail.com</email>
</author>
<published>2025-09-02T19:50:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c1d1e0e32fcd8f457a1644a5859d23155ca666ac'/>
<id>c1d1e0e32fcd8f457a1644a5859d23155ca666ac</id>
<content type='text'>
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]
    &amp; 0.318309886183791x \\
    &amp; - 0.106103295394597x^3 \\
    &amp; + 0.0636619772367581x^5 \\
    &amp; - 0.0454728408833987x^7 \\
    &amp; + 0.0353677651315323x^9 \\
    &amp; - 0.0289372623803446x^{11} \\
    &amp; + 0.0244853758602916x^{13} \\
    &amp; - 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 &lt; |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| &gt; 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</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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]
    &amp; 0.318309886183791x \\
    &amp; - 0.106103295394597x^3 \\
    &amp; + 0.0636619772367581x^5 \\
    &amp; - 0.0454728408833987x^7 \\
    &amp; + 0.0353677651315323x^9 \\
    &amp; - 0.0289372623803446x^{11} \\
    &amp; + 0.0244853758602916x^{13} \\
    &amp; - 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 &lt; |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| &gt; 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</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][math][c++23] Add {nearbyint,rint,lrint,llrint,lround,llround}bf16 math functions (#153882)</title>
<updated>2025-08-24T15:21:02+00:00</updated>
<author>
<name>Krishna Pandey</name>
<email>kpandey81930@gmail.com</email>
</author>
<published>2025-08-24T15:21:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=60743358d15f19b89e3ef5daa1b28e7b1bef453e'/>
<id>60743358d15f19b89e3ef5daa1b28e7b1bef453e</id>
<content type='text'>
This PR adds the following basic math functions for BFloat16 type along
with the tests:
- nearbyintbf16
- rintbf16
- lrintbf16
- llrintbf16
- lroundbf16
- llroundbf16

---------

Signed-off-by: Krishna Pandey &lt;kpandey81930@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR adds the following basic math functions for BFloat16 type along
with the tests:
- nearbyintbf16
- rintbf16
- lrintbf16
- llrintbf16
- lroundbf16
- llroundbf16

---------

Signed-off-by: Krishna Pandey &lt;kpandey81930@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Reland "[libc][math][c23] Implement C23 math function asinpif16" (#152690)</title>
<updated>2025-08-17T21:04:47+00:00</updated>
<author>
<name>Mohamed Emad</name>
<email>hulxxv@gmail.com</email>
</author>
<published>2025-08-17T21:04:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=40833eea21ebe40f0e6321d70780207214908124'/>
<id>40833eea21ebe40f0e6321d70780207214908124</id>
<content type='text'>
#146226 with fixing asinpi MPFR number function and make it work when
mpfr &lt; `4.2.0`</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
#146226 with fixing asinpi MPFR number function and make it work when
mpfr &lt; `4.2.0`</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][math][c++23] Add bf16fma{,f,l,f128} math functions (#153231)</title>
<updated>2025-08-13T17:56:15+00:00</updated>
<author>
<name>Krishna Pandey</name>
<email>kpandey81930@gmail.com</email>
</author>
<published>2025-08-13T17:56:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=41c9510d7262fbdcb7b1332abbb088217fb12703'/>
<id>41c9510d7262fbdcb7b1332abbb088217fb12703</id>
<content type='text'>
This PR adds the following basic math functions for BFloat16 type along
with the tests:
- bf16fma
- bf16fmaf
- bf16fmal
- bf16fmaf128

---------

Signed-off-by: Krishna Pandey &lt;kpandey81930@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR adds the following basic math functions for BFloat16 type along
with the tests:
- bf16fma
- bf16fmaf
- bf16fmal
- bf16fmaf128

---------

Signed-off-by: Krishna Pandey &lt;kpandey81930@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][math][c++23] Add bf16{add,sub}{,f,l,f128} math functions (#152774)</title>
<updated>2025-08-08T19:20:24+00:00</updated>
<author>
<name>Krishna Pandey</name>
<email>kpandey81930@gmail.com</email>
</author>
<published>2025-08-08T19:20:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=1ffb99520d46c0577c9776291c31814f8d6eed03'/>
<id>1ffb99520d46c0577c9776291c31814f8d6eed03</id>
<content type='text'>
This PR adds implements following basic math functions for BFloat16 type
along with the tests:
- bf16add
- bf16addf
- bf16addl
- bf16addf128
- bf16sub
- bf16subf
- bf16subl
- bf16subf128

---------

Signed-off-by: Krishna Pandey &lt;kpandey81930@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR adds implements following basic math functions for BFloat16 type
along with the tests:
- bf16add
- bf16addf
- bf16addl
- bf16addf128
- bf16sub
- bf16subf
- bf16subl
- bf16subf128

---------

Signed-off-by: Krishna Pandey &lt;kpandey81930@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][math][c++23] Implement basic arithmetic operations for BFloat16 (#151228)</title>
<updated>2025-08-06T14:42:55+00:00</updated>
<author>
<name>Krishna Pandey</name>
<email>kpandey81930@gmail.com</email>
</author>
<published>2025-08-06T14:42:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a4ff76e819965b58083bab6c42c66acb6a2d1224'/>
<id>a4ff76e819965b58083bab6c42c66acb6a2d1224</id>
<content type='text'>
This PR implements addition, subtraction, multiplication and division
operations for BFloat16.

---------

Signed-off-by: krishna2803 &lt;kpandey81930@gmail.com&gt;
Signed-off-by: Krishna Pandey &lt;kpandey81930@gmail.com&gt;
Co-authored-by: OverMighty &lt;its.overmighty@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR implements addition, subtraction, multiplication and division
operations for BFloat16.

---------

Signed-off-by: krishna2803 &lt;kpandey81930@gmail.com&gt;
Signed-off-by: Krishna Pandey &lt;kpandey81930@gmail.com&gt;
Co-authored-by: OverMighty &lt;its.overmighty@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[libc][math][c23] Implement C23 math function asinpif16" (#150756)</title>
<updated>2025-07-26T12:39:43+00:00</updated>
<author>
<name>OverMighty</name>
<email>its.overmighty@gmail.com</email>
</author>
<published>2025-07-26T12:39:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=6a85f7cef384a8f4682e4091f34759602d715ed4'/>
<id>6a85f7cef384a8f4682e4091f34759602d715ed4</id>
<content type='text'>
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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.</pre>
</div>
</content>
</entry>
<entry>
<title>[libc][math][c23] Implement C23 math function asinpif16 (#146226)</title>
<updated>2025-07-26T11:02:18+00:00</updated>
<author>
<name>Mohamed Emad</name>
<email>hulxxv@gmail.com</email>
</author>
<published>2025-07-26T11:02:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=eed9b4e05810381d8655f40fe298abb2f90a95cf'/>
<id>eed9b4e05810381d8655f40fe298abb2f90a95cf</id>
<content type='text'>
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]
    &amp;  0.318309886183791x  \\
    &amp; + 0.0530516476972984x^3 \\
    &amp; + 0.0238732414637843x^5 \\
    &amp; + 0.0142102627760621x^7 \\
    &amp; + 0.00967087327815336x^9 \\
    &amp; + 0.00712127941391293x^{11} \\
    &amp; + 0.00552355646848375x^{13} \\
    &amp; + 0.00444514782463692x^{15} \\
    &amp; + 0.00367705242846804x^{17} \\
    &amp; + 0.00310721681820837x^{19} + O(x^{21})
\end{aligned}
$$

## Geogebra graph

![28-06-2025-1913-eDP-1](https://github.com/user-attachments/assets/f70818e1-1b34-406e-962a-a30fdc909f18)

Closes #132210</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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]
    &amp;  0.318309886183791x  \\
    &amp; + 0.0530516476972984x^3 \\
    &amp; + 0.0238732414637843x^5 \\
    &amp; + 0.0142102627760621x^7 \\
    &amp; + 0.00967087327815336x^9 \\
    &amp; + 0.00712127941391293x^{11} \\
    &amp; + 0.00552355646848375x^{13} \\
    &amp; + 0.00444514782463692x^{15} \\
    &amp; + 0.00367705242846804x^{17} \\
    &amp; + 0.00310721681820837x^{19} + O(x^{21})
\end{aligned}
$$

## Geogebra graph

![28-06-2025-1913-eDP-1](https://github.com/user-attachments/assets/f70818e1-1b34-406e-962a-a30fdc909f18)

Closes #132210</pre>
</div>
</content>
</entry>
</feed>
