[libc][NFC] Move aligned access implementations to separate header
[llvm-project.git] / libc / docs / math / index.rst
blob86f7ae0fdb7a6c62bad29685b63d91bcc7b2d778
1 .. _math:
3 ==============
4 Math Functions
5 ==============
7 .. include:: ../check.rst
9 .. raw:: html
11     <style> .green {color:green} </style>
13 .. role:: green
15 .. toctree::
16   :hidden:
18   log.rst
21 .. contents:: Table of Contents
22   :depth: 4
23   :local:
25 Source Locations
26 ================
28 - The main source is located at: `libc/src/math <https://github.com/llvm/llvm-project/tree/main/libc/src/math>`_.
29 - The tests are located at: `libc/test/src/math <https://github.com/llvm/llvm-project/tree/main/libc/test/src/math>`_.
30 - The floating point utilities are located at: `libc/src/__support/FPUtil <https://github.com/llvm/llvm-project/tree/main/libc/src/__support/FPUtil>`_.
32 Implementation Requirements / Goals
33 ===================================
35 * The highest priority is to be as accurate as possible, according to the C and
36   IEEE 754 standards.  By default, we will aim to be correctly rounded for `all rounding modes <https://en.cppreference.com/w/c/numeric/fenv/FE_round>`_.
37   The current rounding mode of the floating point environment is used to perform
38   computations and produce the final results.
40   - To test for correctness, we compare the outputs with other correctly rounded
41     multiple-precision math libraries such as the `GNU MPFR library <https://www.mpfr.org/>`_
42     or the `CORE-MATH library <https://core-math.gitlabpages.inria.fr/>`_.
44 * Our next requirement is that the outputs are consistent across all platforms.
45   Notice that the consistency requirement will be satisfied automatically if the
46   implementation is correctly rounded.
48 * Our last requirement for the implementations is to have good and predicable
49   performance:
51   - The average performance should be comparable to other ``libc``
52     implementations.
53   - The worst case performance should be within 10X-20X of the average.
54   - Platform-specific implementations or instructions could be added whenever it
55     makes sense and provides significant performance boost.
57 * For other use cases that have strict requirements on the code size, memory
58   footprint, or latency, such as embedded systems, we will aim to be as accurate
59   as possible within the memory or latency budgets, and consistent across all
60   platforms.
63 Add a new math function to LLVM libc
64 ====================================
66 * To add a new math function, follow the steps at: `libc/src/math/docs/add_math_function.md <https://github.com/llvm/llvm-project/tree/main/libc/src/math/docs/add_math_function.md>`_.
68 Implementation Status
69 =====================
71 * To check math functions enabled for Linux:
73   - `linux-x86_64 <https://github.com/llvm/llvm-project/tree/main/libc/config/linux/x86_64/entrypoints.txt>`_
75   - `linux-aarch64 <https://github.com/llvm/llvm-project/tree/main/libc/config/linux/aarch64/entrypoints.txt>`_
77   - `linux-aarch32 <https://github.com/llvm/llvm-project/tree/main/libc/config/linux/arm/entrypoints.txt>`_
79   - `linux-riscv64 <https://github.com/llvm/llvm-project/tree/main/libc/config/linux/riscv64/entrypoints.txt>`_
81 * To check math functions enabled for Windows:
83   - `windows-x86_64 <https://github.com/llvm/llvm-project/tree/main/libc/config/windows/entrypoints.txt>`_ 
85   - windows-aarch64 - to be added
87 * To check math functions enabled for macOS:
89   - `darwin-x86_64 <https://github.com/llvm/llvm-project/tree/main/libc/config/darwin/x86_64/entrypoints.txt>`_
91   - `darwin-aarch64 <https://github.com/llvm/llvm-project/tree/main/libc/config/darwin/arm/entrypoints.txt>`_
93 * To check math functions enabled for GPU:
95   - `gpu-entrypoints <https://github.com/llvm/llvm-project/tree/main/libc/config/gpu/entrypoints.txt>`_ 
97 * To check math functions enabled for embedded system:
99   - `barebone-aarch32 <https://github.com/llvm/llvm-project/tree/main/libc/config/baremetal/arm/entrypoints.txt>`_ 
101   - barebone-riscv32 - to be added
103 Basic Operations
104 ----------------
106 +--------------+---------------------------------------+-------------------+-------------------+-------------------+-------------------+
107 | <Func>       |  Linux                                | Windows           | MacOS             | Embedded          | GPU               |
108 |              +---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
109 |              | x86_64  | aarch64 | aarch32 | riscv64 | x86_64  | aarch64 | x86_64  | aarch64 | aarch32 | riscv32 | AMD     | nVidia  |
110 +==============+=========+=========+=========+=========+=========+=========+=========+=========+=========+=========+=========+=========+
111 | ceil         | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
112 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
113 | ceilf        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
114 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
115 | ceill        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
116 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
117 | copysign     | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
118 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
119 | copysignf    | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
120 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
121 | copysignl    | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
122 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
123 | fabs         | |check| | |check| | |check| | |check| | |check| |         |         | |check| | |check| |         |         |         |
124 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
125 | fabsf        | |check| | |check| | |check| | |check| | |check| |         |         | |check| | |check| |         |         |         |
126 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
127 | fabsl        | |check| | |check| | |check| | |check| | |check| |         |         | |check| | |check| |         |         |         |
128 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
129 | fdim         | |check| | |check| | |check| | |check| | |check| |         |         | |check| | |check| |         |         |         |
130 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
131 | fdimf        | |check| | |check| | |check| | |check| | |check| |         |         | |check| | |check| |         |         |         |
132 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
133 | fdiml        | |check| | |check| | |check| | |check| | |check| |         |         | |check| | |check| |         |         |         |
134 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
135 | floor        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
136 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
137 | floorf       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
138 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
139 | floorl       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
140 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
141 | fmax         | |check| | |check| | |check| | |check| | |check| |         |         | |check| | |check| |         |         |         |
142 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
143 | fmaxf        | |check| | |check| | |check| | |check| | |check| |         |         | |check| | |check| |         |         |         |
144 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
145 | fmaxl        | |check| | |check| | |check| | |check| | |check| |         |         | |check| | |check| |         |         |         |
146 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
147 | fmin         | |check| | |check| | |check| | |check| | |check| |         |         | |check| | |check| |         |         |         |
148 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
149 | fminf        | |check| | |check| | |check| | |check| | |check| |         |         | |check| | |check| |         |         |         |
150 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
151 | fminl        | |check| | |check| | |check| | |check| | |check| |         |         | |check| | |check| |         |         |         |
152 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
153 | fmod         | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
154 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
155 | fmodf        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
156 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
157 | fmodl        |         |         |         |         |         |         |         |         |         |         |         |         |
158 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
159 | frexp        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
160 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
161 | frexpf       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
162 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
163 | frexpl       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
164 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
165 | ilogb        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
166 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
167 | ilogbf       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
168 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
169 | ilogbl       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
170 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
171 | ldexp        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
172 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
173 | ldexpf       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
174 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
175 | ldexpl       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
176 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
177 | llrint       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
178 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
179 | llrintf      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
180 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
181 | llrintl      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
182 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
183 | llround      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
184 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
185 | llroundf     | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
186 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
187 | llroundl     | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
188 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
189 | logb         | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
190 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
191 | logbf        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
192 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
193 | logbl        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
194 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
195 | lrint        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
196 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
197 | lrintf       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
198 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
199 | lrintl       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
200 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
201 | lround       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
202 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
203 | lroundf      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
204 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
205 | lroundl      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
206 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
207 | modf         | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
208 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
209 | modff        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
210 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
211 | modfl        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
212 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
213 | nan          |         |         |         |         |         |         |         |         |         |         |         |         |
214 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
215 | nanf         |         |         |         |         |         |         |         |         |         |         |         |         |
216 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
217 | nanl         |         |         |         |         |         |         |         |         |         |         |         |         |
218 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
219 | nearbyint    | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
220 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
221 | nearbyintf   | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
222 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
223 | nearbyintl   | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
224 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
225 | nextafter    | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
226 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
227 | nextafterf   | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
228 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
229 | nextafterl   | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
230 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
231 | nexttoward   |         |         |         |         |         |         |         |         |         |         |         |         |
232 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
233 | nexttowardf  |         |         |         |         |         |         |         |         |         |         |         |         |
234 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
235 | nexttowardl  |         |         |         |         |         |         |         |         |         |         |         |         |
236 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
237 | remainder    | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
238 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
239 | remainderf   | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
240 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
241 | remainderl   | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
242 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
243 | remquo       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
244 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
245 | remquof      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
246 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
247 | remquol      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
248 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
249 | rint         | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
250 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
251 | rintf        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
252 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
253 | rintl        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
254 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
255 | round        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
256 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
257 | roundf       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
258 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
259 | roundl       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
260 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
261 | scalbn       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
262 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
263 | scalbnf      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
264 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
265 | scalbnl      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
266 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
267 | trunc        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
268 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
269 | truncf       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
270 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
271 | truncl       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
272 +--------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
275 Higher Math Functions
276 ---------------------
278 +------------+---------------------------------------+-------------------+-------------------+-------------------+-------------------+
279 | <Func>     |  Linux                                | Windows           | MacOS             | Embedded          | GPU               |
280 |            +---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
281 |            | x86_64  | aarch64 | aarch32 | riscv64 | x86_64  | aarch64 | x86_64  | aarch64 | aarch32 | riscv32 | AMD     | nVidia  |
282 +============+=========+=========+=========+=========+=========+=========+=========+=========+=========+=========+=========+=========+
283 | acos       |         |         |         |         |         |         |         |         |         |         |         |         |
284 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
285 | acosf      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
286 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
287 | acosl      |         |         |         |         |         |         |         |         |         |         |         |         |
288 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
289 | acosh      |         |         |         |         |         |         |         |         |         |         |         |         |
290 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
291 | acoshf     | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
292 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
293 | acoshl     |         |         |         |         |         |         |         |         |         |         |         |         |
294 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
295 | asin       |         |         |         |         |         |         |         |         |         |         |         |         |
296 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
297 | asinf      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
298 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
299 | asinl      |         |         |         |         |         |         |         |         |         |         |         |         |
300 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
301 | asinh      |         |         |         |         |         |         |         |         |         |         |         |         |
302 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
303 | asinhf     | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
304 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
305 | asinhl     |         |         |         |         |         |         |         |         |         |         |         |         |
306 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
307 | atan       |         |         |         |         |         |         |         |         |         |         |         |         |
308 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
309 | atanf      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
310 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
311 | atanl      |         |         |         |         |         |         |         |         |         |         |         |         |
312 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
313 | atan2      |         |         |         |         |         |         |         |         |         |         |         |         |
314 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
315 | atan2f     |         |         |         |         |         |         |         |         |         |         |         |         |
316 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
317 | atan2l     |         |         |         |         |         |         |         |         |         |         |         |         |
318 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
319 | atanh      |         |         |         |         |         |         |         |         |         |         |         |         |
320 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
321 | atanhf     | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
322 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
323 | atanhl     |         |         |         |         |         |         |         |         |         |         |         |         |
324 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
325 | cbrt       |         |         |         |         |         |         |         |         |         |         |         |         |
326 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
327 | cbrtf      |         |         |         |         |         |         |         |         |         |         |         |         |
328 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
329 | cbrtl      |         |         |         |         |         |         |         |         |         |         |         |         |
330 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
331 | cos        | |check| |         |         |         | |check| |         |         |         |         |         |         |         |
332 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
333 | cosf       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
334 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
335 | cosl       |         |         |         |         |         |         |         |         |         |         |         |         |
336 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
337 | cosh       |         |         |         |         |         |         |         |         |         |         |         |         |
338 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
339 | coshf      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
340 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
341 | coshl      |         |         |         |         |         |         |         |         |         |         |         |         |
342 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
343 | erf        |         |         |         |         |         |         |         |         |         |         |         |         |
344 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
345 | erff       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
346 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
347 | erfl       |         |         |         |         |         |         |         |         |         |         |         |         |
348 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
349 | erfc       |         |         |         |         |         |         |         |         |         |         |         |         |
350 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
351 | erfcf      |         |         |         |         |         |         |         |         |         |         |         |         |
352 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
353 | erfcl      |         |         |         |         |         |         |         |         |         |         |         |         |
354 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
355 | exp        |         |         |         |         |         |         |         |         |         |         |         |         |
356 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
357 | expf       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
358 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
359 | expl       |         |         |         |         |         |         |         |         |         |         |         |         |
360 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
361 | exp10      |         |         |         |         |         |         |         |         |         |         |         |         |
362 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
363 | exp10f     | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
364 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
365 | exp10l     |         |         |         |         |         |         |         |         |         |         |         |         |
366 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
367 | exp2       |         |         |         |         |         |         |         |         |         |         |         |         |
368 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
369 | exp2f      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
370 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
371 | exp2l      |         |         |         |         |         |         |         |         |         |         |         |         |
372 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
373 | expm1      |         |         |         |         |         |         |         |         |         |         |         |         |
374 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
375 | expm1f     | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
376 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
377 | expm1l     |         |         |         |         |         |         |         |         |         |         |         |         |
378 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
379 | fma        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
380 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
381 | fmaf       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
382 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
383 | fmal       |         |         |         |         |         |         |         |         |         |         |         |         |
384 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
385 | hypot      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
386 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
387 | hypotf     | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
388 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
389 | hypotl     |         |         |         |         |         |         |         |         |         |         |         |         |
390 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
391 | lgamma     |         |         |         |         |         |         |         |         |         |         |         |         |
392 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
393 | lgammaf    |         |         |         |         |         |         |         |         |         |         |         |         |
394 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
395 | lgammal    |         |         |         |         |         |         |         |         |         |         |         |         |
396 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
397 | log        | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
398 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
399 | logf       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
400 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
401 | logl       |         |         |         |         |         |         |         |         |         |         |         |         |
402 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
403 | log10      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
404 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
405 | log10f     | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
406 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
407 | log10l     |         |         |         |         |         |         |         |         |         |         |         |         |
408 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
409 | log1p      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
410 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
411 | log1pf     | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
412 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
413 | log1pl     |         |         |         |         |         |         |         |         |         |         |         |         |
414 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
415 | log2       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
416 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
417 | log2f      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
418 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
419 | log2l      |         |         |         |         |         |         |         |         |         |         |         |         |
420 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
421 | pow        |         |         |         |         |         |         |         |         |         |         |         |         |
422 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
423 | powf       |         |         |         |         |         |         |         |         |         |         |         |         |
424 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
425 | powl       |         |         |         |         |         |         |         |         |         |         |         |         |
426 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
427 | sin        | |check| |         |         |         |         |         |         |         |         |         |         |         |
428 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
429 | sinf       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
430 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
431 | sinl       |         |         |         |         |         |         |         |         |         |         |         |         |
432 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
433 | sincos     |         |         |         |         |         |         |         |         |         |         |         |         |
434 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
435 | sincosf    | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
436 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
437 | sincosl    |         |         |         |         |         |         |         |         |         |         |         |         |
438 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
439 | sinh       |         |         |         |         |         |         |         |         |         |         |         |         |
440 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
441 | sinhf      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
442 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
443 | sinhl      |         |         |         |         |         |         |         |         |         |         |         |         |
444 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
445 | sqrt       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
446 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
447 | sqrtf      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
448 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
449 | sqrtl      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
450 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
451 | tan        | |check| |         |         |         |         |         |         |         |         |         |         |         |
452 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
453 | tanf       | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
454 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
455 | tanl       |         |         |         |         |         |         |         |         |         |         |         |         |
456 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
457 | tanh       |         |         |         |         |         |         |         |         |         |         |         |         |
458 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
459 | tanhf      | |check| | |check| |         | |check| | |check| |         |         | |check| |         |         |         |         |
460 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
461 | tanhl      |         |         |         |         |         |         |         |         |         |         |         |         |
462 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
463 | tgamma     |         |         |         |         |         |         |         |         |         |         |         |         |
464 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
465 | tgammaf    |         |         |         |         |         |         |         |         |         |         |         |         |
466 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
467 | tgammal    |         |         |         |         |         |         |         |         |         |         |         |         |
468 +------------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
471 Accuracy of Higher Math Functions
472 =================================
474 ============== ================ =============== ======================
475 <Func>         <Func_f> (float) <Func> (double) <Func_l> (long double)
476 ============== ================ =============== ======================
477 acos           |check|
478 acosh          |check|
479 asin           |check|
480 asinh          |check|
481 atan           |check|
482 atanh          |check|
483 cos            |check|          large
484 cosh           |check|
485 erf            |check|
486 exp            |check|
487 exp10          |check|
488 exp2           |check|
489 expm1          |check|
490 fma            |check|          |check|
491 hypot          |check|          |check|
492 log            |check|          |check|
493 log10          |check|          |check|
494 log1p          |check|          |check|
495 log2           |check|          |check|
496 sin            |check|          large
497 sincos         |check|          large
498 sinh           |check|
499 sqrt           |check|          |check|         |check|
500 tan            |check|
501 tanh           |check|
502 ============== ================ =============== ======================
505 Legends:
507 * |check| : correctly rounded for all 4 rounding modes.
508 * CR: correctly rounded for the default rounding mode (round-to-the-nearest,
509   tie-to-even).
510 * x ULPs: largest errors recorded.
513   TODO(lntue): Add a new page to discuss about the algorithms used in the
514   implementations and include the link here.
517 Performance
518 ===========
520 * Simple performance testings are located at: `libc/test/src/math/differential_testing <https://github.com/llvm/llvm-project/tree/main/libc/test/src/math/differential_testing>`_.
522 * We also use the *perf* tool from the `CORE-MATH <https://core-math.gitlabpages.inria.fr/>`_
523   project: `link <https://gitlab.inria.fr/core-math/core-math/-/tree/master>`_.
524   The performance results from the CORE-MATH's perf tool are reported in the
525   table below, using the system library as reference (such as the `GNU C library <https://www.gnu.org/software/libc/>`_
526   on Linux). Fmod performance results obtained with "differential_testing".
528 +--------------+-------------------------------+-------------------------------+-------------------------------------+----------------------------------------------------------------------+
529 | <Func>       | Reciprocal throughput (clk)   | Latency (clk)                 | Testing ranges                      | Testing configuration                                                |
530 |              +-----------+-------------------+-----------+-------------------+                                     +-------------+-------------------------+--------------+---------------+
531 |              | LLVM libc | Reference (glibc) | LLVM libc | Reference (glibc) |                                     | CPU         | OS                      | Compiler     | Special flags |
532 +==============+===========+===================+===========+===================+=====================================+=============+=========================+==============+===============+
533 | acosf        |        24 |                29 |        62 |                77 | :math:`[-1, 1]`                     | Ryzen 1700  | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA           |
534 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
535 | acoshf       |        18 |                26 |        73 |                74 | :math:`[1, 21]`                     | Ryzen 1700  | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA           |
536 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
537 | asinf        |        23 |                27 |        62 |                62 | :math:`[-1, 1]`                     | Ryzen 1700  | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA           |
538 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
539 | asinhf       |        21 |                39 |        77 |                91 | :math:`[-10, 10]`                   | Ryzen 1700  | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA           |
540 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
541 | atanf        |        27 |                29 |        79 |                68 | :math:`[-10, 10]`                   | Ryzen 1700  | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA           |
542 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
543 | atanhf       |        18 |                66 |        68 |               133 | :math:`[-1, 1]`                     | Ryzen 1700  | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA           |
544 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
545 | cosf         |        13 |                32 |        53 |                59 | :math:`[0, 2\pi]`                   | Ryzen 1700  | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA           |
546 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
547 | coshf        |        14 |                20 |        50 |                48 | :math:`[-10, 10]`                   | Ryzen 1700  | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA           |
548 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
549 | expf         |         9 |                 7 |        44 |                38 | :math:`[-10, 10]`                   | Ryzen 1700  | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA           |
550 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
551 | exp10f       |        10 |                 8 |        40 |                38 | :math:`[-10, 10]`                   | Ryzen 1700  | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA           |
552 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
553 | exp2f        |         9 |                 6 |        35 |                31 | :math:`[-10, 10]`                   | Ryzen 1700  | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA           |
554 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
555 | expm1f       |         9 |                44 |        42 |               121 | :math:`[-10, 10]`                   | Ryzen 1700  | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA           |
556 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
557 | fmodf        |        73 |               263 |        -  |                 - | [MIN_NORMAL, MAX_NORMAL]            | i5 mobile   | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 |               |
558 |              +-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
559 |              |         9 |                11 |        -  |                 - | [0, MAX_SUBNORMAL]                  | i5 mobile   | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 |               |
560 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
561 | fmod         |       595 |              3297 |        -  |                 - | [MIN_NORMAL, MAX_NORMAL]            | i5 mobile   | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 |               |
562 |              +-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
563 |              |        14 |                13 |        -  |                 - | [0, MAX_SUBNORMAL]                  | i5 mobile   | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 |               |
564 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
565 | hypotf       |        25 |                15 |        64 |                49 | :math:`[-10, 10] \times [-10, 10]`  | Ryzen 1700  | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 |               |
566 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
567 | logf         |        12 |                10 |        56 |                46 | :math:`[e^{-1}, e]`                 | Ryzen 1700  | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA           |
568 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
569 | log10f       |         9 |                17 |        35 |                48 | :math:`[e^{-1}, e]`                 | Ryzen 5900X | Ubuntu 22.04 LTS x86_64 | Clang 15.0.6 | FMA           |
570 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
571 | log1pf       |        16 |                33 |        61 |                97 | :math:`[e^{-0.5} - 1, e^{0.5} - 1]` | Ryzen 1700  | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA           |
572 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
573 | log2f        |        13 |                10 |        57 |                46 | :math:`[e^{-1}, e]`                 | Ryzen 1700  | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA           |
574 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
575 | sinf         |        12 |                25 |        51 |                57 | :math:`[-\pi, \pi]`                 | Ryzen 1700  | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA           |
576 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
577 | sincosf      |        19 |                30 |        57 |                68 | :math:`[-\pi, \pi]`                 | Ryzen 1700  | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA           |
578 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
579 | sinhf        |        13 |                63 |        48 |               137 | :math:`[-10, 10]`                   | Ryzen 1700  | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA           |
580 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
581 | tanf         |        16 |                50 |        61 |               107 | :math:`[-\pi, \pi]`                 | Ryzen 1700  | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA           |
582 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
583 | tanhf        |        13 |                55 |        57 |               123 | :math:`[-10, 10]`                   | Ryzen 1700  | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA           |
584 +--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+
586 Algorithms + Implementation Details
587 ===================================
589 * :doc:`log`
591 References
592 ==========
594 * `CRLIBM <https://hal-ens-lyon.archives-ouvertes.fr/ensl-01529804/file/crlibm.pdf>`_.
595 * `RLIBM <https://people.cs.rutgers.edu/~sn349/rlibm/>`_.
596 * `Sollya <https://www.sollya.org/>`_.
597 * `The CORE-MATH Project <https://core-math.gitlabpages.inria.fr/>`_.
598 * `The GNU C Library (glibc) <https://www.gnu.org/software/libc/>`_.
599 * `The GNU MPFR Library <https://www.mpfr.org/>`_.