llvm/libc/docs
Tue Ly d883a4ad02 [libc] Implement sinf function that is correctly rounded to all rounding modes.
Implement sinf function that is correctly rounded to all rounding modes.

- We use a simple range reduction for `pi/16 < |x|` :
    Let `k = round(x / pi)` and `y = (x/pi) - k`.
    So `k` is an integer and `-0.5 <= y <= 0.5`.
Then
```
sin(x) = sin(y*pi + k*pi)
          = (-1)^(k & 1) * sin(y*pi)
          ~ (-1)^(k & 1) * y * P(y^2)
```
    where `y*P(y^2)` is a degree-15 minimax polynomial generated by Sollya with:
```
> P = fpminimax(sin(x*pi)/x, [|0, 2, 4, 6, 8, 10, 12, 14|], [|D...|], [0, 0.5]);
```

- Performance benchmark using perf tool from CORE-MATH project
(https://gitlab.inria.fr/core-math/core-math/-/tree/master) on Ryzen 1700:
Before this patch (not correctly rounded):
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh sinf
CORE-MATH reciprocal throughput   : 17.892
System LIBC reciprocal throughput : 25.559
LIBC reciprocal throughput        : 29.381
```
After this patch (correctly rounded):
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh sinf
CORE-MATH reciprocal throughput   : 17.896
System LIBC reciprocal throughput : 25.740

LIBC reciprocal throughput        : 27.872
LIBC reciprocal throughput        : 20.012     (with `-msse4.2` flag)
LIBC reciprocal throughput        : 14.244     (with `-mfma` flag)
```

Reviewed By: zimmermann6

Differential Revision: https://reviews.llvm.org/D123154
2022-07-22 10:07:31 -04:00
..
api_test.rst
build_system.rst
clang_tidy_checks.rst
CMakeLists.txt
conf.py
entrypoints.rst
fuzzing.rst
ground_truth_specification.rst
header_gen_scheme.svg
header_generation.rst
implementation_standard.rst
index.rst [libc] Add a status page for math functions. 2022-06-16 17:41:46 -04:00
layering.rst
math.rst [libc] Implement sinf function that is correctly rounded to all rounding modes. 2022-07-22 10:07:31 -04:00
mechanics_of_public_api.rst
README.txt
redirectors.rst
redirectors_schematic.svg
runtimes_build.rst
source_layout.rst
stdio.rst
strings.rst

libc Documentation
==================

The libc documentation is written using the Sphinx documentation generator. It is
currently tested with Sphinx 1.1.3.

To build the documents into html configure libc with the following cmake options:

  * -DLLVM_ENABLE_SPHINX=ON
  * -DLIBC_INCLUDE_DOCS=ON

After configuring libc with these options the make rule `docs-libc-html`
should be available.