diff options
| author | Michael Kruse <llvm-project@meinersbur.de> | 2025-01-03 10:22:51 +0100 |
|---|---|---|
| committer | Michael Kruse <llvm-project@meinersbur.de> | 2025-01-03 10:22:51 +0100 |
| commit | 38500d63e14ce340236840f60d356cdefb56a52c (patch) | |
| tree | 17edbec446ce9b50d2f215a483b83afb293a635d /libc/docs/headers | |
| parent | 1a3d5daaef7a6a63448a497da3eff7fc9e23df26 (diff) | |
| parent | 27f30029741ecf023baece7b3dde1ff9011ffefc (diff) | |
Merge branch 'main' into users/meinersbur/flang_runtime_split-headersusers/meinersbur/flang_runtime_split-headers
Diffstat (limited to 'libc/docs/headers')
27 files changed, 4447 insertions, 0 deletions
diff --git a/libc/docs/headers/arpa/inet.rst b/libc/docs/headers/arpa/inet.rst new file mode 100644 index 000000000000..c82ca5427fbb --- /dev/null +++ b/libc/docs/headers/arpa/inet.rst @@ -0,0 +1,50 @@ +.. include:: ../../check.rst + +=========== +arpa/inet.h +=========== + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX.1-2024 Standard Section + * - htonl + - |check| + - + - + * - htons + - |check| + - + - + * - inet_addr + - + - + - + * - inet_ntoa + - + - + - + * - inet_ntop + - + - + - + * - inet_pton + - + - + - + * - ntohl + - |check| + - + - + * - ntohs + - |check| + - + - diff --git a/libc/docs/headers/assert.rst b/libc/docs/headers/assert.rst new file mode 100644 index 000000000000..682170755ba4 --- /dev/null +++ b/libc/docs/headers/assert.rst @@ -0,0 +1,27 @@ +.. include:: ../check.rst + +======== +assert.h +======== + +Macros +====== + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Macro + - Implemented + - C23 Standard Section + - POSIX Docs + * - __STDC_VERSION_ASSERT_H__ + - |check| + - 7.2.1 + - + * - assert + - + - 7.2.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/assert.h.html>`__ + diff --git a/libc/docs/headers/complex.rst b/libc/docs/headers/complex.rst new file mode 100644 index 000000000000..272cf00c883b --- /dev/null +++ b/libc/docs/headers/complex.rst @@ -0,0 +1,65 @@ +.. include:: ../check.rst + +========= +complex.h +========= + +Macros +====== + ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| <Func> | <Func_f> (float) | <Func> (double) | <Func_l> (long double) | <Func_f16> (float16) | <Func_f128> (float128) | C23 Definition Section | C23 Error Handling Section | ++===========+==================+=================+========================+======================+========================+========================+============================+ +| CMPLX | | | | | | 7.3.9.3 | N/A | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ + +Functions +========= + ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| <Func> | <Func_f> (float) | <Func> (double) | <Func_l> (long double) | <Func_f16> (float16) | <Func_f128> (float128) | C23 Definition Section | C23 Error Handling Section | ++===========+==================+=================+========================+======================+========================+========================+============================+ +| cacos | | | | | | 7.3.5.1 | G.6.2.1 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| casin | | | | | | 7.3.5.2 | N/A | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| catan | | | | | | 7.3.5.3 | N/A | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| ccos | | | | | | 7.3.5.4 | N/A | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| csin | | | | | | 7.3.5.5 | N/A | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| ctan | | | | | | 7.3.5.6 | N/A | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| cacosh | | | | | | 7.3.6.1 | G.6.3.1 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| casinh | | | | | | 7.3.6.2 | G.6.3.2 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| catanh | | | | | | 7.3.6.3 | G.6.3.3 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| ccosh | | | | | | 7.3.6.4 | G.6.3.4 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| csinh | | | | | | 7.3.6.5 | G.6.3.5 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| ctanh | | | | | | 7.3.6.6 | G.6.3.6 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| cexp | | | | | | 7.3.7.1 | G.6.4.1 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| clog | | | | | | 7.3.7.2 | G.6.4.2 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| cabs | | | | | | 7.3.8.1 | N/A | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| cpow | | | | | | 7.3.8.2 | G.6.5.1 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| csqrt | | | | | | 7.3.8.3 | G.6.5.2 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| carg | | | | | | 7.3.9.1 | N/A | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| cimag | |check| | |check| | |check| | |check| | |check| | 7.3.9.2 | N/A | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| conj | |check| | |check| | |check| | |check| | |check| | 7.3.9.4 | N/A | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| cproj | |check| | |check| | |check| | |check| | |check| | 7.3.9.5 | N/A | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| creal | |check| | |check| | |check| | |check| | |check| | 7.3.9.6 | N/A | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ diff --git a/libc/docs/headers/ctype.rst b/libc/docs/headers/ctype.rst new file mode 100644 index 000000000000..9b5b1574fd27 --- /dev/null +++ b/libc/docs/headers/ctype.rst @@ -0,0 +1,130 @@ +.. include:: ../check.rst + +======= +ctype.h +======= + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX Docs + * - isalnum + - |check| + - 7.4.1.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isalnum.html>`__ + * - isalnum_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isalnum_l.html>`__ + * - isalpha + - |check| + - 7.4.1.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isalpha.html>`__ + * - isalpha_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isalpha_l.html>`__ + * - isblank + - |check| + - 7.4.1.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isblank.html>`__ + * - isblank_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isblank_l.html>`__ + * - iscntrl + - |check| + - 7.4.1.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/iscntrl.html>`__ + * - iscntrl_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/iscntrl_l.html>`__ + * - isdigit + - |check| + - 7.4.1.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isdigit.html>`__ + * - isdigit_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isdigit_l.html>`__ + * - isgraph + - |check| + - 7.4.1.6 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isgraph.html>`__ + * - isgraph_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isgraph_l.html>`__ + * - islower + - |check| + - 7.4.1.7 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/islower.html>`__ + * - islower_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/islower_l.html>`__ + * - isprint + - |check| + - 7.4.1.8 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isprint.html>`__ + * - isprint_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isprint_l.html>`__ + * - ispunct + - |check| + - 7.4.1.9 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ispunct.html>`__ + * - ispunct_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ispunct_l.html>`__ + * - isspace + - |check| + - 7.4.1.10 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isspace.html>`__ + * - isspace_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isspace_l.html>`__ + * - isupper + - |check| + - 7.4.1.11 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isupper.html>`__ + * - isupper_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isupper_l.html>`__ + * - isxdigit + - |check| + - 7.4.1.12 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isxdigit.html>`__ + * - isxdigit_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isxdigit_l.html>`__ + * - tolower + - |check| + - 7.4.2.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/tolower.html>`__ + * - tolower_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/tolower_l.html>`__ + * - toupper + - |check| + - 7.4.2.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/toupper.html>`__ + * - toupper_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/toupper_l.html>`__ diff --git a/libc/docs/headers/errno.rst b/libc/docs/headers/errno.rst new file mode 100644 index 000000000000..b2b2e62728e1 --- /dev/null +++ b/libc/docs/headers/errno.rst @@ -0,0 +1,35 @@ +.. include:: ../check.rst + +======= +errno.h +======= + +Macros +====== + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Macro + - Implemented + - C23 Standard Section + - POSIX Docs + * - EDOM + - + - 7.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/errno.h.html>`__ + * - EILSEQ + - + - 7.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/errno.h.html>`__ + * - ERANGE + - + - 7.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/errno.h.html>`__ + * - errno + - + - 7.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/errno.h.html>`__ + diff --git a/libc/docs/headers/fenv.rst b/libc/docs/headers/fenv.rst new file mode 100644 index 000000000000..d0e3c5dda6d0 --- /dev/null +++ b/libc/docs/headers/fenv.rst @@ -0,0 +1,175 @@ +.. include:: ../check.rst + +====== +fenv.h +====== + +Macros +====== + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Macro + - Implemented + - C23 Standard Section + - POSIX Docs + * - FE_ALL_EXCEPT + - |check| + - 7.6.12 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fenv.h.html>`__ + * - FE_DEC_DOWNWARD + - + - 7.6.14 + - + * - FE_DEC_TONEAREST + - + - 7.6.14 + - + * - FE_DEC_TONEARESTFROMZERO + - + - 7.6.14 + - + * - FE_DEC_TOWARDZERO + - + - 7.6.14 + - + * - FE_DEC_UPWARD + - + - 7.6.14 + - + * - FE_DFL_ENV + - |check| + - 7.6.17 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fenv.h.html>`__ + * - FE_DFL_MODE + - + - 7.6.11 + - + * - FE_DIVBYZERO + - |check| + - 7.6.9 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fenv.h.html>`__ + * - FE_DOWNWARD + - |check| + - 7.6.13 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fenv.h.html>`__ + * - FE_INEXACT + - |check| + - 7.6.9 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fenv.h.html>`__ + * - FE_INVALID + - |check| + - 7.6.9 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fenv.h.html>`__ + * - FE_OVERFLOW + - |check| + - 7.6.9 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fenv.h.html>`__ + * - FE_TONEAREST + - |check| + - 7.6.13 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fenv.h.html>`__ + * - FE_TONEARESTFROMZERO + - + - 7.6.13 + - + * - FE_TOWARDZERO + - |check| + - 7.6.13 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fenv.h.html>`__ + * - FE_UNDERFLOW + - |check| + - 7.6.9 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fenv.h.html>`__ + * - FE_UPWARD + - |check| + - 7.6.13 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fenv.h.html>`__ + * - __STDC_VERSION_FENV_H__ + - + - 7.6.5 + - + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX Docs + * - fe_dec_getround + - + - 7.6.5.3 + - + * - fe_dec_setround + - + - 7.6.5.6 + - + * - feclearexcept + - |check| + - 7.6.4.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/feclearexcept.html>`__ + * - fegetenv + - |check| + - 7.6.6.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fegetenv.html>`__ + * - fegetexceptflag + - |check| + - 7.6.4.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fegetexceptflag.html>`__ + * - fegetmode + - + - 7.6.5.1 + - + * - fegetround + - |check| + - 7.6.5.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fegetround.html>`__ + * - feholdexcept + - |check| + - 7.6.6.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/feholdexcept.html>`__ + * - feraiseexcept + - |check| + - 7.6.4.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/feraiseexcept.html>`__ + * - fesetenv + - |check| + - 7.6.6.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fesetenv.html>`__ + * - fesetexcept + - |check| + - 7.6.4.4 + - + * - fesetexceptflag + - |check| + - 7.6.4.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fesetexceptflag.html>`__ + * - fesetmode + - + - 7.6.5.4 + - + * - fesetround + - |check| + - 7.6.5.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fesetround.html>`__ + * - fetestexcept + - |check| + - 7.6.4.7 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fetestexcept.html>`__ + * - fetestexceptflag + - |check| + - 7.6.4.6 + - + * - feupdateenv + - |check| + - 7.6.6.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/feupdateenv.html>`__ diff --git a/libc/docs/headers/float.rst b/libc/docs/headers/float.rst new file mode 100644 index 000000000000..8ef0f3a05020 --- /dev/null +++ b/libc/docs/headers/float.rst @@ -0,0 +1,227 @@ +.. include:: ../check.rst + +======= +float.h +======= + +Macros +====== + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Macro + - Implemented + - C23 Standard Section + - POSIX Docs + * - DBL_DECIMAL_DIG + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - DBL_DIG + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - DBL_EPSILON + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - DBL_HAS_SUBNORM + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - DBL_IS_IEC_60559 + - + - 5.3.5.3.3 + - + * - DBL_MANT_DIG + - |check| + - 5.3.5.3.3 + - + * - DBL_MAX + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - DBL_MAX_10_EXP + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - DBL_MAX_EXP + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - DBL_MIN + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - DBL_MIN_10_EXP + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - DBL_MIN_EXP + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - DBL_NORM_MAX + - + - 5.3.5.3.3 + - + * - DBL_SNAN + - + - 5.3.5.3.3 + - + * - DBL_TRUE_MIN + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - DECIMAL_DIG + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - FLT_DECIMAL_DIG + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - FLT_DIG + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - FLT_EPSILON + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - FLT_EVAL_METHOD + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - FLT_HAS_SUBNORM + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - FLT_IS_IEC_60559 + - + - 5.3.5.3.3 + - + * - FLT_MANT_DIG + - |check| + - 5.3.5.3.3 + - + * - FLT_MAX + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - FLT_MAX_10_EXP + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - FLT_MAX_EXP + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - FLT_MIN + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - FLT_MIN_10_EXP + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - FLT_MIN_EXP + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - FLT_NORM_MAX + - + - 5.3.5.3.3 + - + * - FLT_RADIX + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - FLT_ROUNDS + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - FLT_SNAN + - + - 5.3.5.3.3 + - + * - FLT_TRUE_MIN + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - INFINITY + - + - 5.3.5.3.3 + - + * - LDBL_DECIMAL_DIG + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - LDBL_DIG + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - LDBL_EPSILON + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - LDBL_HAS_SUBNORM + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - LDBL_IS_IEC_60559 + - + - 5.3.5.3.3 + - + * - LDBL_MANT_DIG + - |check| + - 5.3.5.3.3 + - + * - LDBL_MAX + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - LDBL_MAX_10_EXP + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - LDBL_MAX_EXP + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - LDBL_MIN + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - LDBL_MIN_10_EXP + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - LDBL_MIN_EXP + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - LDBL_NORM_MAX + - + - 5.3.5.3.3 + - + * - LDBL_SNAN + - + - 5.3.5.3.3 + - + * - LDBL_TRUE_MIN + - |check| + - 5.3.5.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/float.h.html>`__ + * - NAN + - + - 5.3.5.3.3 + - + * - __STDC_VERSION_FLOAT_H__ + - + - 7.7 + - + diff --git a/libc/docs/headers/index.rst b/libc/docs/headers/index.rst new file mode 100644 index 000000000000..07ab6dd9b267 --- /dev/null +++ b/libc/docs/headers/index.rst @@ -0,0 +1,30 @@ +Implementation Status +===================== + +.. toctree:: + :maxdepth: 1 + + arpa/inet + assert + complex + ctype + errno + fenv + float + inttypes + locale + math/index.rst + search + setjmp + signal + stdbit + stdio + stdlib + string + strings + sys/mman + threads + time + uchar + wchar + wctype diff --git a/libc/docs/headers/inttypes.rst b/libc/docs/headers/inttypes.rst new file mode 100644 index 000000000000..9269b40f242a --- /dev/null +++ b/libc/docs/headers/inttypes.rst @@ -0,0 +1,42 @@ +.. include:: ../check.rst + +========== +inttypes.h +========== + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX Docs + * - imaxabs + - |check| + - 7.8.2.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/imaxabs.html>`__ + * - imaxdiv + - |check| + - 7.8.2.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/imaxdiv.html>`__ + * - strtoimax + - |check| + - 7.8.2.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtoimax.html>`__ + * - strtoumax + - |check| + - 7.8.2.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtoumax.html>`__ + * - wcstoimax + - + - 7.8.2.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/wcstoimax.html>`__ + * - wcstoumax + - + - 7.8.2.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/wcstoumax.html>`__ diff --git a/libc/docs/headers/locale.rst b/libc/docs/headers/locale.rst new file mode 100644 index 000000000000..c97d1f63b1f0 --- /dev/null +++ b/libc/docs/headers/locale.rst @@ -0,0 +1,83 @@ +.. include:: ../check.rst + +======== +locale.h +======== + +Macros +====== + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Macro + - Implemented + - C23 Standard Section + - POSIX Docs + * - LC_ALL + - |check| + - 7.11 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/locale.h.html>`__ + * - LC_COLLATE + - |check| + - 7.11 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/locale.h.html>`__ + * - LC_CTYPE + - |check| + - 7.11 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/locale.h.html>`__ + * - LC_MONETARY + - |check| + - 7.11 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/locale.h.html>`__ + * - LC_NUMERIC + - |check| + - 7.11 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/locale.h.html>`__ + * - LC_TIME + - |check| + - 7.11 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/locale.h.html>`__ + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX Docs + * - duplocale + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/duplocale.html>`__ + * - freelocale + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/freelocale.html>`__ + * - getlocalename_l + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getlocalename_l.html>`__ + * - localeconv + - |check| + - 7.11.2.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/localeconv.html>`__ + * - newlocale + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/newlocale.html>`__ + * - setlocale + - |check| + - 7.11.1.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/setlocale.html>`__ + * - uselocale + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/uselocale.html>`__ diff --git a/libc/docs/headers/math/index.rst b/libc/docs/headers/math/index.rst new file mode 100644 index 000000000000..2808165ad539 --- /dev/null +++ b/libc/docs/headers/math/index.rst @@ -0,0 +1,459 @@ +.. _math: + +====== +math.h +====== + +.. include:: ../../check.rst + +.. raw:: html + + <style> .green {color:green} </style> + +.. role:: green + +.. toctree:: + :hidden: + + log.rst + stdfix.rst + + +.. contents:: Table of Contents + :depth: 4 + :local: + +Source Locations +================ + +- The main source is located at: `libc/src/math <https://github.com/llvm/llvm-project/tree/main/libc/src/math>`_. +- The tests are located at: `libc/test/src/math <https://github.com/llvm/llvm-project/tree/main/libc/test/src/math>`_. +- The floating point utilities are located at: `libc/src/__support/FPUtil <https://github.com/llvm/llvm-project/tree/main/libc/src/__support/FPUtil>`_. + +Implementation Requirements / Goals +=================================== + +* The highest priority is to be as accurate as possible, according to the C and + 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>`_. + The current rounding mode of the floating point environment is used to perform + computations and produce the final results. + + - To test for correctness, we compare the outputs with other correctly rounded + multiple-precision math libraries such as the `GNU MPFR library <https://www.mpfr.org/>`_ + or the `CORE-MATH library <https://core-math.gitlabpages.inria.fr/>`_. + +* Our next requirement is that the outputs are consistent across all platforms. + Notice that the consistency requirement will be satisfied automatically if the + implementation is correctly rounded. + +* Our last requirement for the implementations is to have good and predicable + performance: + + - The average performance should be comparable to other ``libc`` + implementations. + - The worst case performance should be within 10X-20X of the average. + - Platform-specific implementations or instructions could be added whenever it + makes sense and provides significant performance boost. + +* For other use cases that have strict requirements on the code size, memory + footprint, or latency, such as embedded systems, we will aim to be as accurate + as possible within the memory or latency budgets, and consistent across all + platforms. + + +Add a new math function to LLVM libc +==================================== + +* 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>`_. + +Implementation Status +===================== + +* To check math functions enabled for Linux: + + - `linux-x86_64 <https://github.com/llvm/llvm-project/tree/main/libc/config/linux/x86_64/entrypoints.txt>`_ + + - `linux-aarch64 <https://github.com/llvm/llvm-project/tree/main/libc/config/linux/aarch64/entrypoints.txt>`_ + + - `linux-aarch32 <https://github.com/llvm/llvm-project/tree/main/libc/config/linux/arm/entrypoints.txt>`_ + + - `linux-riscv and linux-riscv32 <https://github.com/llvm/llvm-project/tree/main/libc/config/linux/riscv/entrypoints.txt>`_ + +* To check math functions enabled for Windows: + + - `windows-x86_64 <https://github.com/llvm/llvm-project/tree/main/libc/config/windows/entrypoints.txt>`_ + + - windows-aarch64 - to be added + +* To check math functions enabled for macOS: + + - `darwin-x86_64 <https://github.com/llvm/llvm-project/tree/main/libc/config/darwin/x86_64/entrypoints.txt>`_ + + - `darwin-aarch64 <https://github.com/llvm/llvm-project/tree/main/libc/config/darwin/arm/entrypoints.txt>`_ + +* To check math functions enabled for GPU: + + - `gpu-entrypoints <https://github.com/llvm/llvm-project/tree/main/libc/config/gpu/entrypoints.txt>`_ + +* To check math functions enabled for embedded system: + + - `baremetal-aarch32 <https://github.com/llvm/llvm-project/tree/main/libc/config/baremetal/arm/entrypoints.txt>`_ + + - baremetal-riscv32 - to be added + + +Basic Operations +================ + ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| <Func> | <Func_f> (float) | <Func> (double) | <Func_l> (long double) | <Func_f16> (float16) | <Func_f128> (float128) | C23 Definition Section | C23 Error Handling Section | ++==================+==================+=================+========================+======================+========================+========================+============================+ +| ceil | |check| | |check| | |check| | |check| | |check| | 7.12.9.1 | F.10.6.1 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| canonicalize | |check| | |check| | |check| | |check| | |check| | 7.12.11.7 | F.10.8.7 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| copysign | |check| | |check| | |check| | |check| | |check| | 7.12.11.1 | F.10.8.1 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| dadd | N/A | N/A | |check| | N/A | |check|\* | 7.12.14.1 | F.10.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| ddiv | N/A | N/A | |check| | N/A | |check|\* | 7.12.14.4 | F.10.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| dfma | N/A | N/A | |check| | N/A | |check|\* | 7.12.14.5 | F.10.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| dmul | N/A | N/A | |check| | N/A | |check|\* | 7.12.14.3 | F.10.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| dsub | N/A | N/A | |check| | N/A | |check|\* | 7.12.14.2 | F.10.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| f16add | |check|\* | |check|\* | |check|\* | N/A | |check| | 7.12.14.1 | F.10.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| f16div | |check|\* | |check|\* | |check|\* | N/A | |check| | 7.12.14.4 | F.10.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| f16fma | |check|\* | |check|\* | |check|\* | N/A | |check| | 7.12.14.5 | F.10.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| f16mul | |check|\* | |check|\* | |check|\* | N/A | |check| | 7.12.14.5 | F.10.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| f16sub | |check|\* | |check|\* | |check|\* | N/A | |check| | 7.12.14.2 | F.10.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fabs | |check| | |check| | |check| | |check| | |check| | 7.12.7.3 | F.10.4.3 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fadd | N/A | |check| | |check| | N/A | |check| | 7.12.14.1 | F.10.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fdim | |check| | |check| | |check| | |check| | |check| | 7.12.12.1 | F.10.9.1 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fdiv | N/A | |check| | |check| | N/A | |check|\* | 7.12.14.4 | F.10.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| ffma | N/A | |check| | |check| | N/A | |check|\* | 7.12.14.5 | F.10.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| floor | |check| | |check| | |check| | |check| | |check| | 7.12.9.2 | F.10.6.2 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fmax | |check| | |check| | |check| | |check| | |check| | 7.12.12.2 | F.10.9.2 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fmaximum | |check| | |check| | |check| | |check| | |check| | 7.12.12.4 | F.10.9.4 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fmaximum_mag | |check| | |check| | |check| | |check| | |check| | 7.12.12.6 | F.10.9.4 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fmaximum_mag_num | |check| | |check| | |check| | |check| | |check| | 7.12.12.10 | F.10.9.5 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fmaximum_num | |check| | |check| | |check| | |check| | |check| | 7.12.12.8 | F.10.9.5 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fmin | |check| | |check| | |check| | |check| | |check| | 7.12.12.3 | F.10.9.3 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fminimum | |check| | |check| | |check| | |check| | |check| | 7.12.12.5 | F.10.9.4 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fminimum_mag | |check| | |check| | |check| | |check| | |check| | 7.12.12.7 | F.10.9.4 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fminimum_mag_num | |check| | |check| | |check| | |check| | |check| | 7.12.12.11 | F.10.9.5 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fminimum_num | |check| | |check| | |check| | |check| | |check| | 7.12.12.9 | F.10.9.5 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fmod | |check| | |check| | |check| | |check| | |check| | 7.12.10.1 | F.10.7.1 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fmul | N/A | |check| | |check| | N/A | |check|\* | 7.12.14.3 | F.10.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| frexp | |check| | |check| | |check| | |check| | |check| | 7.12.6.7 | F.10.3.7 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fromfp | |check| | |check| | |check| | |check| | |check| | 7.12.9.10 | F.10.6.10 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fromfpx | |check| | |check| | |check| | |check| | |check| | 7.12.9.11 | F.10.6.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fsub | N/A | |check| | |check| | N/A | |check|\* | 7.12.14.2 | F.10.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| getpayload | |check| | |check| | |check| | |check| | |check| | F.10.13.1 | N/A | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| ilogb | |check| | |check| | |check| | |check| | |check| | 7.12.6.8 | F.10.3.8 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| iscanonical | |check| | |check| | |check| | |check| | |check| | 7.12.3.2 | N/A | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| issignaling | |check| | |check| | |check| | |check| | |check| | 7.12.3.8 | N/A | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| ldexp | |check| | |check| | |check| | |check| | |check| | 7.12.6.9 | F.10.3.9 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| llogb | |check| | |check| | |check| | |check| | |check| | 7.12.6.10 | F.10.3.10 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| llrint | |check| | |check| | |check| | |check| | |check| | 7.12.9.5 | F.10.6.5 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| llround | |check| | |check| | |check| | |check| | |check| | 7.12.9.7 | F.10.6.7 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| logb | |check| | |check| | |check| | |check| | |check| | 7.12.6.17 | F.10.3.17 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| lrint | |check| | |check| | |check| | |check| | |check| | 7.12.9.5 | F.10.6.5 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| lround | |check| | |check| | |check| | |check| | |check| | 7.12.9.7 | F.10.6.7 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| modf | |check| | |check| | |check| | |check| | |check| | 7.12.6.18 | F.10.3.18 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| nan | |check| | |check| | |check| | |check| | |check| | 7.12.11.2 | F.10.8.2 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| nearbyint | |check| | |check| | |check| | |check| | |check| | 7.12.9.3 | F.10.6.3 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| nextafter | |check| | |check| | |check| | |check| | |check| | 7.12.11.3 | F.10.8.3 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| nextdown | |check| | |check| | |check| | |check| | |check| | 7.12.11.6 | F.10.8.6 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| nexttoward | |check| | |check| | |check| | |check| | N/A | 7.12.11.4 | F.10.8.4 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| nextup | |check| | |check| | |check| | |check| | |check| | 7.12.11.5 | F.10.8.5 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| remainder | |check| | |check| | |check| | |check| | |check| | 7.12.10.2 | F.10.7.2 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| remquo | |check| | |check| | |check| | |check| | |check| | 7.12.10.3 | F.10.7.3 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| rint | |check| | |check| | |check| | |check| | |check| | 7.12.9.4 | F.10.6.4 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| round | |check| | |check| | |check| | |check| | |check| | 7.12.9.6 | F.10.6.6 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| roundeven | |check| | |check| | |check| | |check| | |check| | 7.12.9.8 | F.10.6.8 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| scalbln | |check| | |check| | |check| | |check| | |check| | 7.12.6.19 | F.10.3.19 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| scalbn | |check| | |check| | |check| | |check| | |check| | 7.12.6.19 | F.10.3.19 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| setpayload | |check| | |check| | |check| | |check| | |check| | F.10.13.2 | N/A | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| setpayloadsig | |check| | |check| | |check| | |check| | |check| | F.10.13.3 | N/A | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| totalorder | |check| | |check| | |check| | |check| | |check| | F.10.12.1 | N/A | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| totalordermag | |check| | |check| | |check| | |check| | |check| | F.10.12.2 | N/A | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| trunc | |check| | |check| | |check| | |check| | |check| | 7.12.9.9 | F.10.6.9 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| ufromfp | |check| | |check| | |check| | |check| | |check| | 7.12.9.10 | F.10.6.10 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| ufromfpx | |check| | |check| | |check| | |check| | |check| | 7.12.9.11 | F.10.6.11 | ++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ + + +Higher Math Functions +===================== + ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| <Func> | <Func_f> (float) | <Func> (double) | <Func_l> (long double) | <Func_f16> (float16) | <Func_f128> (float128) | C23 Definition Section | C23 Error Handling Section | ++===========+==================+=================+========================+======================+========================+========================+============================+ +| acos | |check| | | | | | 7.12.4.1 | F.10.1.1 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| acosh | |check| | | | | | 7.12.5.1 | F.10.2.1 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| acospi | | | | | | 7.12.4.8 | F.10.1.8 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| asin | |check| | | | | | 7.12.4.2 | F.10.1.2 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| asinh | |check| | | | | | 7.12.5.2 | F.10.2.2 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| asinpi | | | | | | 7.12.4.9 | F.10.1.9 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| atan | |check| | | | | | 7.12.4.3 | F.10.1.3 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| atan2 | |check| | 1 ULP | | | | 7.12.4.4 | F.10.1.4 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| atan2pi | | | | | | 7.12.4.11 | F.10.1.11 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| atanh | |check| | | | | | 7.12.5.3 | F.10.2.3 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| atanpi | | | | | | 7.12.4.10 | F.10.1.10 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| cbrt | |check| | |check| | | | | 7.12.7.1 | F.10.4.1 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| compoundn | | | | | | 7.12.7.2 | F.10.4.2 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| cos | |check| | |check| | | |check| | | 7.12.4.5 | F.10.1.5 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| cosh | |check| | | | |check| | | 7.12.5.4 | F.10.2.4 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| cospi | |check| | | | |check| | | 7.12.4.12 | F.10.1.12 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| dsqrt | N/A | N/A | |check| | N/A | |check|\* | 7.12.14.6 | F.10.11 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| erf | |check| | | | | | 7.12.8.1 | F.10.5.1 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| erfc | | | | | | 7.12.8.2 | F.10.5.2 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| exp | |check| | |check| | | |check| | | 7.12.6.1 | F.10.3.1 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| exp10 | |check| | |check| | | |check| | | 7.12.6.2 | F.10.3.2 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| exp10m1 | |check| | | | |check| | | 7.12.6.3 | F.10.3.3 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| exp2 | |check| | |check| | | |check| | | 7.12.6.4 | F.10.3.4 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| exp2m1 | |check| | | | |check| | | 7.12.6.5 | F.10.3.5 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| expm1 | |check| | |check| | | |check| | | 7.12.6.6 | F.10.3.6 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fma | |check| | |check| | | | | 7.12.13.1 | F.10.10.1 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| f16sqrt | |check|\* | |check|\* | |check|\* | N/A | |check| | 7.12.14.6 | F.10.11 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| fsqrt | N/A | |check| | |check| | N/A | |check|\* | 7.12.14.6 | F.10.11 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| hypot | |check| | |check| | | | | 7.12.7.4 | F.10.4.4 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| lgamma | | | | | | 7.12.8.3 | F.10.5.3 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| log | |check| | |check| | | |check| | | 7.12.6.11 | F.10.3.11 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| log10 | |check| | |check| | | |check| | | 7.12.6.12 | F.10.3.12 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| log10p1 | | | | | | 7.12.6.13 | F.10.3.13 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| log1p | |check| | |check| | | | | 7.12.6.14 | F.10.3.14 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| log2 | |check| | |check| | | |check| | | 7.12.6.15 | F.10.3.15 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| log2p1 | | | | | | 7.12.6.16 | F.10.3.16 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| logp1 | | | | | | 7.12.6.14 | F.10.3.14 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| pow | |check| | 1 ULP | | | | 7.12.7.5 | F.10.4.5 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| powi\* | | | | | | | | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| pown | | | | | | 7.12.7.6 | F.10.4.6 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| powr | | | | | | 7.12.7.7 | F.10.4.7 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| rootn | | | | | | 7.12.7.8 | F.10.4.8 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| rsqrt | | | | | | 7.12.7.9 | F.10.4.9 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| sin | |check| | |check| | | |check| | | 7.12.4.6 | F.10.1.6 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| sincos | |check| | |check| | | | | | | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| sinh | |check| | | | |check| | | 7.12.5.5 | F.10.2.5 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| sinpi | |check| | | | |check| | | 7.12.4.13 | F.10.1.13 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| sqrt | |check| | |check| | |check| | |check| | |check| | 7.12.7.10 | F.10.4.10 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| tan | |check| | |check| | | | | 7.12.4.7 | F.10.1.7 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| tanh | |check| | | | |check| | | 7.12.5.6 | F.10.2.6 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| tanpi | | | | |check| | | 7.12.4.14 | F.10.1.14 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ +| tgamma | | | | | | 7.12.8.4 | F.10.5.4 | ++-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+ + +Legends: + +* |check| : correctly rounded for all 4 rounding modes. +* CR: correctly rounded for the default rounding mode (round-to-the-nearest, + tie-to-even). +* x ULPs: largest errors recorded. +* N/A: Not defined in the standard or will not be added. +* \*: LLVM libc extension. + +.. + TODO(lntue): Add a new page to discuss about the algorithms used in the + implementations and include the link here. + + +Performance +=========== + +* Simple performance testings are located at: `libc/test/src/math/performance_testing <https://github.com/llvm/llvm-project/tree/main/libc/test/src/math/performance_testing>`_. + +* We also use the *perf* tool from the `CORE-MATH <https://core-math.gitlabpages.inria.fr/>`_ + project: `link <https://gitlab.inria.fr/core-math/core-math/-/tree/master>`_. + The performance results from the CORE-MATH's perf tool are reported in the + table below, using the system library as reference (such as the `GNU C library <https://www.gnu.org/software/libc/>`_ + on Linux). Fmod performance results obtained with "performance_testing". + ++--------------+-------------------------------+-------------------------------+-------------------------------------+----------------------------------------------------------------------+ +| <Func> | Reciprocal throughput (clk) | Latency (clk) | Testing ranges | Testing configuration | +| +-----------+-------------------+-----------+-------------------+ +-------------+-------------------------+--------------+---------------+ +| | LLVM libc | Reference (glibc) | LLVM libc | Reference (glibc) | | CPU | OS | Compiler | Special flags | ++==============+===========+===================+===========+===================+=====================================+=============+=========================+==============+===============+ +| acosf | 24 | 29 | 62 | 77 | :math:`[-1, 1]` | Ryzen 1700 | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| acoshf | 18 | 26 | 73 | 74 | :math:`[1, 21]` | Ryzen 1700 | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| asinf | 23 | 27 | 62 | 62 | :math:`[-1, 1]` | Ryzen 1700 | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| asinhf | 21 | 39 | 77 | 91 | :math:`[-10, 10]` | Ryzen 1700 | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| atanf | 27 | 29 | 79 | 68 | :math:`[-10, 10]` | Ryzen 1700 | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| atanhf | 18 | 66 | 68 | 133 | :math:`[-1, 1]` | Ryzen 1700 | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| cosf | 13 | 32 | 53 | 59 | :math:`[0, 2\pi]` | Ryzen 1700 | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| coshf | 14 | 20 | 50 | 48 | :math:`[-10, 10]` | Ryzen 1700 | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| expf | 9 | 7 | 44 | 38 | :math:`[-10, 10]` | Ryzen 1700 | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| exp10f | 10 | 8 | 40 | 38 | :math:`[-10, 10]` | Ryzen 1700 | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| exp2f | 9 | 6 | 35 | 31 | :math:`[-10, 10]` | Ryzen 1700 | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| expm1f | 9 | 44 | 42 | 121 | :math:`[-10, 10]` | Ryzen 1700 | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| fmodf | 73 | 263 | - | - | [MIN_NORMAL, MAX_NORMAL] | i5 mobile | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | | +| +-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| | 9 | 11 | - | - | [0, MAX_SUBNORMAL] | i5 mobile | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| fmod | 595 | 3297 | - | - | [MIN_NORMAL, MAX_NORMAL] | i5 mobile | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | | +| +-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| | 14 | 13 | - | - | [0, MAX_SUBNORMAL] | i5 mobile | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| hypotf | 25 | 15 | 64 | 49 | :math:`[-10, 10] \times [-10, 10]` | Ryzen 1700 | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| logf | 12 | 10 | 56 | 46 | :math:`[e^{-1}, e]` | Ryzen 1700 | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| log10f | 9 | 17 | 35 | 48 | :math:`[e^{-1}, e]` | Ryzen 5900X | Ubuntu 22.04 LTS x86_64 | Clang 15.0.6 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| 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 | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| log2f | 13 | 10 | 57 | 46 | :math:`[e^{-1}, e]` | Ryzen 1700 | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| sinf | 12 | 25 | 51 | 57 | :math:`[-\pi, \pi]` | Ryzen 1700 | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| sincosf | 19 | 30 | 57 | 68 | :math:`[-\pi, \pi]` | Ryzen 1700 | Ubuntu 20.04 LTS x86_64 | Clang 12.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| sinhf | 13 | 63 | 48 | 137 | :math:`[-10, 10]` | Ryzen 1700 | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| tanf | 16 | 50 | 61 | 107 | :math:`[-\pi, \pi]` | Ryzen 1700 | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ +| tanhf | 13 | 55 | 57 | 123 | :math:`[-10, 10]` | Ryzen 1700 | Ubuntu 22.04 LTS x86_64 | Clang 14.0.0 | FMA | ++--------------+-----------+-------------------+-----------+-------------------+-------------------------------------+-------------+-------------------------+--------------+---------------+ + +Algorithms + Implementation Details +=================================== + +* :doc:`log` + +Fixed-point Arithmetics +======================= + +* :doc:`stdfix` + +References +========== + +* `CRLIBM <https://hal-ens-lyon.archives-ouvertes.fr/ensl-01529804/file/crlibm.pdf>`_. +* `RLIBM <https://people.cs.rutgers.edu/~sn349/rlibm/>`_. +* `Sollya <https://www.sollya.org/>`_. +* `The CORE-MATH Project <https://core-math.gitlabpages.inria.fr/>`_. +* `The GNU C Library (glibc) <https://www.gnu.org/software/libc/>`_. +* `The GNU MPFR Library <https://www.mpfr.org/>`_. diff --git a/libc/docs/headers/math/log.rst b/libc/docs/headers/math/log.rst new file mode 100644 index 000000000000..82d2e2be6fb5 --- /dev/null +++ b/libc/docs/headers/math/log.rst @@ -0,0 +1,557 @@ +.. _log_algorithm: + +======================== +Log/Log10/Log2 Algorithm +======================== + +.. default-role:: math + +In this short note, we will discuss in detail about the computation of +:math:`\log(x)` function, with double precision inputs, in particular, the range +reduction steps and error analysis. The algorithm is broken down into 2 main +phases as follow: + +1. Fast phase: + + a. Range reduction + b. Polynomial approximation + c. Ziv's test + +2. Accurate phase (if Ziv's test failed): + + a. Further range reduction + b. Polynomial approximation + + +Fast phase +========== + +Range reduction +--------------- + +Let `x = 2^{e_x} (1 + m_x)` be a normalized double precision number, in which +`-1074 \leq e_x \leq 1022` and `0 \leq m_x < 1` such that +`2^{52} m_x \in \mathbb{Z}`. + +Then from the properties of logarithm: + +.. math:: + \log(x) &= \log\left( 2^{e_x} (1 + m_x) \right) \\ + &= \log\left( 2^{e_x} \right) + \log(1 + m_x) \\ + &= e_x \log(2) + \log(1 + m_x) + +the computation of `\log(x)` can be reduced to: + +1. compute the product of `e_x` and `\log(2)`, +2. compute `\log(1 + m_x)` for `0 \leq m_x < 1`, +3. add step 1 and 2. + +To compute `\log(1 + m_x)` in step 2, we can reduce the range further by finding +`r > 0` such that: + +.. math:: + | r(1 + m_x) - 1 | < C \quad \quad \text{(R1)} + +for small `0 < C < 1`. Then if we let `u = r(1 + m_x) - 1`, `|u| < C`: + +.. math:: + \log(1 + m_x) &= \log \left( \frac{r (1 + m_x)}{r} \right) \\ + &= \log(r (1 + m_x) ) - \log(r) \\ + &= \log(1 + u) - \log(r) + +and step 2 can be computed with: + +a. extract `r` and `-\log(r)` from look-up tables, +b. compute the reduced argument `u = r(1 + m_x) - 1`, +c. compute `\log(1 + u)` by polynomial approximation or further range reduction, +d. add step a and step c results. + + +How to derive `r` +----------------- + +For an efficient implementation, we would like to use the first `M` significant +bits of `m_x` to look up for `r`. In particular, we would like to find a value +of `r` that works for all `m_x` satisfying: + +.. math:: + k 2^{-M} \leq m_x < (k + 1) 2^{-M} \quad \text{for some} \quad + k = 0..2^{M} - 1. \quad\quad \text{(M1)} + +Let `r = 1 + s`, then `u` can be expressed in terms of `s` as: + +.. math:: + u &= r(1 + m_x) - 1 \\ + &= (1 + s)(1 + m_x) - 1 \\ + &= s m_x + s + m_x &\quad\quad \text{(U1)} \\ + &= s (1 + m_x) + m_x \\ + &= m_x (1 + s) + s. + +From the condition `\text{(R1)}`, `s` is bounded by: + +.. math:: + \frac{-C - m_x}{1 + m_x} < s < \frac{C - m_x}{1 + m_x} \quad\quad \text{(S1)}. + +Since our reduction constant `s` must work for all `m_x` in the interval +`I = \{ v: k 2^{-M} \leq v < (k + 1) 2^{-M} \}`, `s` is bounded by: + +.. math:: + \sup_{v \in I} \frac{-C - v}{1 + v} < s < \inf_{v \in I} \frac{C - v}{1 + v} + +For a fixed constant `|c| < 1`, let `f(v) = \frac{c - v}{1 + v}`, then its +derivative is: + +.. math:: + f'(v) = \frac{(-1)(1 + v) - (1)(c - v)}{(1 + v)^2} = \frac{-1 - c}{(1 + v)^2}. + +Since `|c| < 1`, `f'(v) < 0` for all `v \neq -1`, so: + +.. math:: + \sup_{v \in I} f(v) &= f \left( \inf\{ v: v \in I \} \right) + = f \left( k 2^{-M} \right) \\ + \inf_{v \in I} f(v) &= f \left( \sup\{ v: v \in I \} \right) + = f \left( (k + 1) 2^{-M} \right) + +Hence we have the following bound on `s`: + +.. math:: + \frac{-C - k 2^{-M}}{1 + k 2^{-M}} < s \leq + \frac{C - (k + 1) 2^{-M}}{1 + (k + 1) 2^{-M}}. \quad\quad \text{(S2)} + +In order for `s` to exist, we need that: + +.. math:: + \frac{C - (k + 1) 2^{-M}}{1 + (k + 1) 2^{-M}} > + \frac{-C - k 2^{-M}}{1 + k 2^{-M}} + +which is equivalent to: + +.. math:: + \quad\quad 2C - 2^{-M} + (2k + 1) 2^{-M} C > 0 + \iff C > \frac{2^{-M - 1}}{1 + (2k + 1) 2^{-M - 1}} \quad\quad \text{(C1)}. + +Consider the case `C = 2^{-N}`. Since `0 \leq k \leq 2^M - 1,` the right hand +side of `\text{(C1)}` is bounded by: + +.. math:: + 2^{-M - 1} > \frac{2^{-M - 1}}{1 + (2k + 1) 2^{-M - 1}} \geq + \frac{2^{-M - 1}}{1 + (2^{M + 1} - 1) 2^{-M - 1}} > 2^{-M - 2}. + +Hence, from `\text{(C1)}`, being an exact power of 2, `C = 2^{-N}` is bounded below +by: + +.. math:: + C = 2^{-N} \geq 2^{-M - 1}. + +To make the range reduction efficient, we will want to minimize `C` (maximize +`N`) while keeping the required precision of `s`(`r`) as low as possible. And +for that, we will consider the following two cases: `N = M + 1` and `N = M`. + +Case 1 - `N = M + 1` +~~~~~~~~~~~~~~~~~~~~ + +When `N = M + 1`, `\text{(S2)}` becomes: + +.. math:: + \frac{-2^{-M - 1} - k 2^{-M}}{1 + k 2^{-M}} < s < + \frac{2^{-M - 1} - (k + 1) 2^{-M}}{1 + (k + 1) 2^{-M}}. + \quad\quad \text{(S2')} + +This is an interval of length: + +.. math:: + l &= \frac{2^{-M - 1} - (k + 1) 2^{-M}}{1 + (k + 1) 2^{-M}} - + \frac{-2^{-M - 1} - k 2^{-M}}{1 + k 2^{-M}} \\ + &= \frac{(2k + 1)2^{-2M - 1}}{(1 + k 2^{-M})(1 + (k + 1)2^{-M})} + \quad\quad \text{(L1)} + +As a function of `k`, the length `l` has its derivative with respect to `k`: + +.. math:: + \frac{dl}{dk} = + \frac{2^{2M + 1} - 2k(k + 1) - 1} + {2^{4M}(1 + k 2^{-M})^2 (1 + (k + 1) 2^{-M})^2} + +which is always positive for `0 \leq k \leq 2^M - 1`. So for all +`0 < k < 2^{-M}` (`k = 0` will be treated differently in edge cases), and for +`M > 2`, `l` is bounded below by: + +.. math:: + l > 2^{-2M}. + +It implies that we can always find `s` with `\operatorname{ulp}(s) = 2^{-2M}`. +And from `\text{(U1)}`, `u = s(1 + m_x) + m_x`, its `ulp` is: + +.. math:: + \operatorname{ulp}(u) &= \operatorname{ulp}(s) \cdot \operatorname{ulp}(m_x) \\ + &= 2^{-2M} \operatorname{ulp}(m_x). + +Since: + +.. math:: + |u| < C = 2^{-N} = 2^{-M - 1}, + +Its required precision is: + +.. math:: + \operatorname{prec}(u) &= \log_2(2^{-M-1} / \operatorname{ulp}(u)) \\ + &= \log_2(2^{M - 1} / \operatorname{ulp}(m_x)) \\ + &= M - 1 - \log_2(\operatorname{ulp}(m_x)). + +This means that in this case, we cannot restrict `u` to be exactly representable +in double precision for double precision input `x` with `M > 2`. Nonetheless, +for a reasonable value of `M`, we can have `u` exactly representable in double +precision for single precision input `x` (`\operatorname{ulp}(m_x) = 2^{-23}`) +such that `|u| < 2^{-M - 1}` using a look-up table of size `2^M`. + +A particular formula for `s` can be derived from `\text{(S2')}` by the midpoint +formula: + +.. math:: + s &= 2^{-2M} \operatorname{round}\left( 2^{2M} \cdot \operatorname{midpoint} + \left(-\frac{-2^{-M - 1} - k2^{-M}}{1 + k 2^{-M}}, + \frac{2^{-M-1} - (k + 1)2^{-M}}{1 + (k + 1) 2^{-M}}\right) \right) \\ + &= 2^{-2M} \operatorname{round}\left( 2^{2M} \cdot \frac{1}{2} \left( + \frac{-2^{-M - 1} - k2^{-M}}{1 + k 2^{-M}} + + \frac{2^{-M - 1} + (k + 1)2^{-M}}{1 + (k + 1) 2^{-M}} + \right) \right) \\ + &= 2^{-2M} \operatorname{round}\left( \frac{ + - \left(k + \frac{1}{2} \right) \left(2^M - k - \frac{1}{2} \right) } + {(1 + k 2^{-N})(1 + (k + 1) 2^{-N})} \right) \\ + &= - 2^{-2M} \operatorname{round}\left( \frac{ + \left(k + \frac{1}{2} \right) \left(2^M - k - \frac{1}{2} \right) } + {(1 + k 2^{-N})(1 + (k + 1) 2^{-N})} \right) \quad\quad \text{(S3)} + +The corresponding range and formula for `r = 1 + s` are: + +.. math:: + \frac{1 - 2^{-M - 1}}{1 + k 2^{-M}} < r \leq + \frac{1 + 2^{-M - 1}}{1 + (k + 1) 2^{-M}} + +.. math:: + r &= 2^{-2M} \operatorname{round}\left( 2^{2M} \cdot + \operatorname{midpoint}\left( \frac{1 - 2^{-M - 1}}{1 + k 2^{-M}}, + \frac{1 + 2^{-M - 1}}{1 + (k + 1) 2^{-M}}\right) \right) \\ + &= 2^{-2M} \operatorname{round}\left( 2^{2M} \cdot \frac{1}{2} \left( + \frac{1 + 2^{-M-1}}{1 + (k + 1) 2^{-M}} + \frac{1 - 2^{-M-1}}{1 + k 2^{-M}} + \right) \right) \\ + &= 2^{-2M} \operatorname{round}\left( 2^{2M} \cdot \frac{ + 1 + \left(k + \frac{1}{2} \right) 2^{-M} - 2^{-2M-2} }{(1 + k 2^{-M}) + (1 + (k + 1) 2^{-M})} \right) + +Case 1 - `N = M` +~~~~~~~~~~~~~~~~ + +When `N = M`, `\text{(S2)}` becomes: + +.. math:: + \frac{-(k + 1)2^{-M}}{1 + k 2^{-M}} < s < \frac{-k 2^{-M}}{1 + (k + 1) 2^{-M}} + \quad\quad \text{(S2")} + +This is an interval of length: + +.. math:: + l &= \frac{- k 2^{-M}}{1 + (k + 1) 2^{-M}} - + \frac{- (k + 1) 2^{-M}}{1 + k 2^{-M}} \\ + &= \frac{2^{-M} (1 + (2k + 1) 2^{-M})}{(1 + k 2^{-M})(1 + (k + 1)2^{-M})} + \quad\quad \text{(L1')} + +As a function of `k`, its derivative with respect to `k`: + +.. math:: + \frac{dl}{dk} = + -\frac{2^{-2M}(k(k + 1)2^{-M + 1} + 2^{-M} + 2k + 1)} + {(1 + k 2^{-M})^2 (1 + (k + 1) 2^{-M})^2} + +which is always negative for `0 \leq k \leq 2^M - 1`. So for `M > 1`, `l` is +bounded below by: + +.. math:: + l > \frac{2^{-M - 1} (3 - 2^{-M})}{2 - 2^{-M}} > 2^{-M - 1}. + +It implies that we can always find `s` with `\operatorname{ulp}(s) = 2^{-M-1}`. +And from `\text{(U1)}`, `u = s(1 + m_x) + m_x`, its `ulp` is: + +.. math:: + \operatorname{ulp}(u) &= \operatorname{ulp}(s) \cdot \operatorname{ulp}(m_x) \\ + &= 2^{-M - 1} \operatorname{ulp}(m_x). + +Since: + +.. math:: + |u| < C = 2^{-N} = 2^{-M}, + +Its required precision is: + +.. math:: + \operatorname{prec}(u) &= \log_2(2^{-M} / \operatorname{ulp}(u)) \\ + &= \log_2(2 / \operatorname{ulp}(m_x)) \\ + &= 1 - \log_2(\operatorname{ulp}(m_x)). + +Hence, for double precision `x`, `\operatorname{ulp}(m_x) = 2^{-52}`, and the +precision needed for `u` is `\operatorname{prec}(u) = 53`, i.e., `u` can be +exactly representable in double precision. And in this case, `s` can be +derived from `\text{(S2")}` by the midpoint formula: + +.. math:: + s &= 2^{-M - 1} \operatorname{round}\left( 2^{M + 1} \cdot + \operatorname{midpoint} \left(-\frac{-(k + 1)2^{-M}}{1 + k 2^{-M}}, + \frac{-k2^{-M}}{1 + (k + 1) 2^{-M}}\right) \right) \\ + &= 2^{-M - 1} \operatorname{round}\left( 2^{M + 1} \cdot \frac{1}{2} \left( + \frac{-(k + 1)2^{-M}}{1 + k 2^{-M}} + \frac{-k2^{-M}}{1 + (k + 1) 2^{-M}} + \right) \right) \\ + &= -2^{-M - 1} \operatorname{round}\left( \frac{ + (2k + 1) + (2k^2 + 2k + 1) 2^{-M} } + {(1 + k 2^{-N})(1 + (k + 1) 2^{-N})} \right) \quad\quad \text{(S3')} + +The corresponding range and formula for `r = 1 + s` are: + +.. math:: + \frac{1 - 2^{-M}}{1 + k 2^{-M}} < r \leq \frac{1 + 2^{-M}}{1 + (k + 1) 2^{-M}} + +.. math:: + r &= 2^{-M-1} \operatorname{round}\left( 2^{M + 1} \cdot + \operatorname{midpoint}\left( \frac{1 - 2^{-M}}{1 + k 2^{-M}}, + \frac{1 + 2^{-M}}{1 + (k + 1) 2^{-M}}\right) \right) \\ + &= 2^{-M-1} \operatorname{round}\left( 2^{M + 1} \cdot \frac{1}{2} \left( + \frac{1 + 2^{-M}}{1 + (k + 1) 2^{-M}} + \frac{1 - 2^{-M}}{1 + k 2^{-M}} + \right) \right) \\ + &= 2^{-M - 1} \operatorname{round}\left( 2^{M + 1} \cdot \frac{ + 1 + \left(k + \frac{1}{2} \right) 2^{-M} - 2^{-2M-1} }{(1 + k 2^{-M}) + (1 + (k + 1) 2^{-M})} \right) + +Edge cases +---------- + +1. When `k = 0`, notice that: + +.. math:: + 0 = k 2^{-N} \leq m_x < (k + 1) 2^{-N} = 2^{-N} = C, + +so we can simply choose `r = 1` so that `\log(r) = 0` is exact, then `u = m_x`. +This will help reduce the accumulated errors when `m_x` is close to 0 while +maintaining the range reduction output's requirements. + +2. When `k = 2^{N} - 1`, `\text{(S2)}` becomes: + +.. math:: + -\frac{1}{2} - \frac{C - 2^{-M-1}}{2 - 2^{-M}} <> s \leq + -\frac{1}{2} + \frac{C}{2}. + +so when `C > 2^{-M - 1}` is a power of 2, we can always choose: + +.. math:: + s = -\frac{1}{2}, \quad \text{i.e.} \quad r = \frac{1}{2}. + +This reduction works well to avoid catastrophic cancellation happening when +`e_x = -1`. + +This also works when `C = 2^{-M - 1}` if we relax the condition on `u` to +`|u| \leq C = 2^{-M-1}`. + +Intermediate precision, and Ziv's test +-------------------------------------- + +In the fast phase, we want extra precision while performant, so we use +double-double precision for most intermediate computation steps, and employ Ziv +test to see if the result is accurate or not. In our case, the Ziv's test can +be described as follow: + +1. Let `re = re.hi + re.lo` be the double-double output of the fast phase + computation. +2. Let `err` be an estimated upper bound of the errors of `re`. +3. If `\circ(re.hi + (re.lo - err)) == \circ(re.hi + (r.lo + err))` then the + result is correctly rounded to double precision for the current rounding mode + `\circ`. Otherwise, the accurate phase with extra precision is needed. + +For an easy and cheap estimation of the error bound `err`, since the range +reduction step described above is accurate, the errors of the result: + +.. math:: + \log(x) &= e_x \log(2) - \log(r) + \log(1 + u) \\ + &\approx e_x \log(2) - \log(r) + u P(u) + +come from 2 parts: + +1. the look-up part: `e_x \log(2) - \log(r)` +2. the polynomial approximation part: `u P(u)` + +The errors of the first part can be computed with a single `\operatorname{fma}` +operation: + +.. math:: + err_1 = \operatorname{fma}(e_x, err(\log(2)), err(\log(r))), + +and then combining with the errors of the second part for another +`\operatorname{fma}` operation: + +.. math:: + err = \operatorname{fma}(u, err(P), err_1) + + +Accurate phase +============== + +Extending range reduction +------------------------- + +Since the output `u = r(1 + m_x) - 1` of the fast phase's range reduction +is computed exactly, we can apply further range reduction steps by +using the following formula: + +.. math:: + u_{i + 1} = r_i(1 + u_i) - 1 = u_i \cdot r_i + (r_i - 1), + +where `|u_i| < 2^{-N_i}` and `u_0 = u` is representable in double precision. + +Let `s_i = r_i - 1`, then we can rewrite it as: + +.. math:: + u_{i + 1} &= (1 + s_i)(1 + u_i) - 1 \\ + &= s_i u_i + u_i + s_i \\ + &= u_i (1 + s_i) + s_i + &= s_i (1 + u_i) + u_i. + +Then the bound on `u_{i + 1}` is translated to `s_i` as: + +.. math:: + \frac{-2^{-N_{i + 1}} - u_i}{1 + u_i} < s_i < \frac{2^{-N_{i + 1}} - u_i}{1 + u_i}. + +Let say we divide the interval `[0, 2^-{N_i})` into `2^{M_i}` subintervals +evenly and use the index `k` such that: + +.. math:: + k 2^{-N_i - M_i} \leq u_i < (k + 1) 2^{-N_i - M_i}, + +to look-up for the reduction constant `s_{i, k}`. In other word, `k` is given +by the formula: + +.. math:: + k = \left\lfloor 2^{N_i + M_i} u_i \right\rfloor + +Notice that our reduction constant `s_{i, k}` must work for all `u_i` in the +interval `I = \{ v: k 2^{-N_i - M_i} \leq v < (k + 1) 2^{-N_i - M_i} \}`, +so it is bounded by: + +.. math:: + \sup_{v \in I} \frac{-2^{-N_{i + 1}} - v}{1 + v} < s_{i, k} < \inf_{v \in I} \frac{2^{-N_{i + 1}} - v}{1 + v} + +For a fixed constant `|C| < 1`, let `f(v) = \frac{C - v}{1 + v}`, then its derivative +is: + +.. math:: + f'(v) = \frac{(-1)(1 + v) - (1)(C - v)}{(1 + v)^2} = \frac{-1 - C}{(1 + v)^2}. + +Since `|C| < 1`, `f'(v) < 0` for all `v \neq -1`, so: + +.. math:: + \sup_{v \in I} f(v) &= f \left( \inf\{ v: v \in I \} \right) + = f \left( k 2^{-N_i - M_i} \right) \\ + \inf_{v \in I} f(v) &= f \left( \sup\{ v: v \in I \} \right) + = f \left( (k + 1) 2^{-N_i - M_i} \right) + +Hence we have the following bound on `s_{i, k}`: + +.. math:: + \frac{-2^{-N_{i + 1}} - k 2^{-N_i - M_i}}{1 + k 2^{-N_i - M_i}} < s_{i, k} + \leq \frac{2^{-N_{i + 1}} - (k + 1) 2^{-N_i - M_i}}{1 + (k + 1) 2^{-N_i - M_i}} + +This interval is of length: + +.. math:: + l &= \frac{2^{-N_{i + 1}} - (k + 1) 2^{-N_i - M_i}}{1 + (k + 1) 2^{-N_i - M_i}} - + \frac{-2^{-N_{i + 1}} - k 2^{-N_i - M_i}}{1 + k 2^{-N_i - M_i}} \\ + &= \frac{2^{-N_{i + 1} + 1} - 2^{-N_i - M_i} + (2k + 1) 2^{-N_{i + 1} - N_i - M_i}} + {(1 + k 2^{-N_i - M_i})(1 + (k + 1) 2^{-N_i -M_i})} + +So in order to be able to find `s_{i, k}`, we need that: + +.. math:: + 2^{-N_{i + 1} + 1} - 2^{-N_i - M_i} + (2k + 1) 2^{-N_{i + 1} - N_i - M_i} > 0 + +This give us the following bound on `N_{i + 1}`: + +.. math:: + N_{i + 1} \leq N_i + M_i + 1. + +To make the range reduction effective, we will want to maximize `N_{i + 1}`, so +let consider the two cases: `N_{i + 1} = N_i + M_i + 1` and +`N_{i + 1} = N_i + M_i`. + + + +The optimal choice to balance between maximizing `N_{i + 1}` and minimizing the +precision needed for `s_{i, k}` is: + +.. math:: + N_{i + 1} = N_i + M_i, + +and in this case, the optimal `\operatorname{ulp}(s_{i, k})` is: + +.. math:: + \operatorname{ulp}(s_{i, k}) = 2^{-N_i - M_i} + +and the corresponding `\operatorname{ulp}(u_{i + 1})` is: + +.. math:: + \operatorname{ulp}(u_{i + 1}) &= \operatorname{ulp}(u_i) \operatorname{ulp}(s_{i, k}) \\ + &= \operatorname{ulp}(u_i) \cdot 2^{-N_i - M_i} \\ + &= \operatorname{ulp}(u_0) \cdot 2^{-N_0 - M_0} \cdot 2^{-N_0 - M_0 - M_1} \cdots 2^{-N_0 - M_0 - M_1 - \cdots - M_i} \\ + &= 2^{-N_0 - 53} \cdot 2^{-N_0 - M_0} \cdot 2^{-N_0 - M_0 - M_1} \cdots 2^{-N_0 - M_0 - M_1 - \cdots - M_i} + +Since `|u_{i + 1}| < 2^{-N_{i + 1}} = 2^{-N_0 - M_1 - ... -M_i}`, the precision +of `u_{i + 1}` is: + +.. math:: + \operatorname{prec}(u_{i + 1}) &= (N_0 + 53) + (N_0 + M_0) + \cdots + + (N_0 + M_0 + \cdots + M_i) - (N_0 + M_0 + \cdots + M_i) \\ + &= (i + 1) N_0 + i M_0 + (i - 1) M_1 + \cdots + M_{i - 1} + 53 + +If we choose to have the same `M_0 = M_1 = \cdots = M_i = M`, this can be +simplified to: + +.. math:: + \operatorname{prec}(u_{i + 1}) = (i + 1) N_0 + \frac{i(i + 1)}{2} \cdot M + 53. + +We summarize the precision analysis for extending the range reduction in the +table below: + ++-------+-----+-----------+------------+--------------+-----------------+-------------------+ +| `N_0` | `M` | No. steps | Table size | Output bound | ulp(`s_{i, k}`) | prec(`u_{i + 1}`) | ++-------+-----+-----------+------------+--------------+-----------------+-------------------+ +| 7 | 4 | 1 | 32 | `2^{-11}` | `2^{-12}` | 60 | +| | +-----------+------------+--------------+-----------------+-------------------+ +| | | 2 | 64 | `2^{-15}` | `2^{-16}` | 71 | +| | +-----------+------------+--------------+-----------------+-------------------+ +| | | 3 | 96 | `2^{-19}` | `2^{-20}` | 86 | +| | +-----------+------------+--------------+-----------------+-------------------+ +| | | 4 | 128 | `2^{-23}` | `2^{-24}` | 105 | +| | +-----------+------------+--------------+-----------------+-------------------+ +| | | 5 | 160 | `2^{-27}` | `2^{-28}` | 128 | +| | +-----------+------------+--------------+-----------------+-------------------+ +| | | 6 | 192 | `2^{-31}` | `2^{-32}` | 155 | +| +-----+-----------+------------+--------------+-----------------+-------------------+ +| | 5 | 3 | 192 | `2^{-22}` | `2^{-23}` | 89 | +| | +-----------+------------+--------------+-----------------+-------------------+ +| | | 4 | 256 | `2^{-27}` | `2^{-28}` | 111 | +| | +-----------+------------+--------------+-----------------+-------------------+ +| | | 5 | 320 | `2^{-32}` | `2^{-33}` | 138 | +| | +-----------+------------+--------------+-----------------+-------------------+ +| | | 6 | 384 | `2^{-37}` | `2^{-38}` | 170 | +| +-----+-----------+------------+--------------+-----------------+-------------------+ +| | 6 | 3 | 384 | `2^{-25}` | `2^{-26}` | 92 | +| | +-----------+------------+--------------+-----------------+-------------------+ +| | | 4 | 512 | `2^{-31}` | `2^{-32}` | 117 | +| +-----+-----------+------------+--------------+-----------------+-------------------+ +| | 7 | 1 | 256 | `2^{-24}` | `2^{-15}` | 60 | +| | +-----------+------------+--------------+-----------------+-------------------+ +| | | 2 | 512 | `2^{-21}` | `2^{-22}` | 74 | ++-------+-----+-----------+------------+--------------+-----------------+-------------------+ + +where: + +- Number of steps = `i + 1` +- Table size = `(i + 1) 2^{M + 1}` +- Output bound = `2^{-N_{i + 1}} = 2^{-N_0 - (i + 1) M}` +- `\operatorname{ulp}(s_{i, k}) = 2^{-N_{i + 1} - 1}` +- `\operatorname{prec}(u_{i + 1}) = (i + 1) N_0 + \frac{i(i + 1)}{2} \cdot M + 53` diff --git a/libc/docs/headers/math/stdfix.rst b/libc/docs/headers/math/stdfix.rst new file mode 100644 index 000000000000..58052f000995 --- /dev/null +++ b/libc/docs/headers/math/stdfix.rst @@ -0,0 +1,149 @@ +================ +StdFix Functions +================ + +.. include:: ../../check.rst + +Standards and Goals +------------------- + +- stdfix.h is specified in the `ISO/IEC TR 18037:2008 <https://www.iso.org/standard/51126.html>`_, + C extensions to support embedded processors . + +- Its `specifications <https://standards.iso.org/ittf/PubliclyAvailableStandards/c051126_ISO_IEC_TR_18037_2008.zip>`_. + +- Our goal is to implement a complete set of math functions for fixed point + types, most of them are currently not included in the ISO/IEC TR + 18037:2008 standard. Our math functions for fixed point types are modeled + after the C99/C23 math functions for floating point types. + +--------------- +Source location +--------------- + +- The main source for fixed-point functions is located at: + ``libc/src/stdfix`` with subdirectories for internal implementations. + +--------------------- +Implementation Status +--------------------- + +Requirements +============ + +- In order to build LLVM libc to support fixed-point arithmetics, we need the + compiler to support the basic fixed-point types `_Fract` and `_Accum` in + C++. + +- For the users to be able to use the generated headers, their compiler needs + to support `_Fract` and `_Accum` types in C or C++. + +- This compiler support is checked at the beginning of + `libc/include/llvm-libc-macros/stdfix-macros.h <https://github.com/llvm/llvm-project/tree/main/libc/include/llvm-libc-macros/stdfix-macros.h>`_. + + + +Predefined Macros +================= + +- We use the macro `LIBC_COMPILER_HAS_FIXED_POINT` to specify whether the + compiler support the fixed-point types. + +- Other predefined precision macros specified in section 7.18a.3 are defined + in `libc/include/llvm-libc-macros/stdfix-macros.h <https://github.com/llvm/llvm-project/tree/main/libc/include/llvm-libc-macros/stdfix-macros.h>`_ + using the default configuration of `typical desktop processor` in section + A.3. + + +Fixed-point Arithmetics +======================= + +The following functions are included in the ISO/IEC TR 18037:2008 standard. + ++---------------+------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+ +| Function Name | _Fract (r) | _Accum (k) | +| +------------------------------+----------------------------+------------------------------+------------------------------+----------------------------+------------------------------+ +| | short (hr) | _ (r) | long (lr) | short (hk) | _ (k) | long (lk) | +| +----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| | unsigned (uhr) | signed (hr) | unsigned (ur) | signed (r) | unsigned (ulr) | signed (lr) | unsigned (uhk) | signed (hk) | unsigned (uk) | signed (k) | unsigned (ulk) | signed (lk) | ++===============+================+=============+===============+============+================+=============+================+=============+===============+============+================+=============+ +| abs | | |check| | | |check| | | |check| | | |check| | | |check| | | |check| | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| bits\* | | | | | | | | | | | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| \*bits | | | | | | | | | | | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| countls | | | | | | | | | | | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| divi | | | | | | | | | | | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| idivi | | | | | | | | | | | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| muli | | | | | | | | | | | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| rdivi | | | | | | | | | | | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| round | |check| | |check| | |check| | |check| | |check| | |check| | |check| | |check| | |check| | |check| | |check| | |check| | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ + +================== ========= +Type Generic Macro Available +================== ========= +absfx +countlsfx +roundfx +================== ========= + + +Higher math functions +===================== + +The following math functions are modeled after C99/C23 math functions for +floating point types, but are not part of the ISO/IEC TR 18037:2008 spec. + ++---------------+------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+ +| Function Name | _Fract (r) | _Accum (k) | +| +------------------------------+----------------------------+------------------------------+------------------------------+----------------------------+------------------------------+ +| | short (hr) | _ (r) | long (lr) | short (hk) | _ (k) | long (lk) | +| +----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| | unsigned (uhr) | signed (hr) | unsigned (ur) | signed (r) | unsigned (ulr) | signed (lr) | unsigned (uhk) | signed (hk) | unsigned (uk) | signed (k) | unsigned (ulk) | signed (lk) | ++===============+================+=============+===============+============+================+=============+================+=============+===============+============+================+=============+ +| cos | | | | | | | | | | | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| exp | | | | | | | | |check| | | |check| | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| log | | | | | | | | | | | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| sin | | | | | | | | | | | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| sqrt | |check| | | |check| | | |check| | | |check| | | |check| | | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| tan | | | | | | | | | | | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ + + +Conversion Functions +==================== + +The following conversion functions are included in the ISO/IEC TR 18037:2008 +standard. + ++---------------+------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+ +| Function Name | _Fract (r) | _Accum (k) | +| +------------------------------+----------------------------+------------------------------+------------------------------+----------------------------+------------------------------+ +| | short (hr) | _ (r) | long (lr) | short (hk) | _ (k) | long (lk) | +| +----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| | unsigned (uhr) | signed (hr) | unsigned (ur) | signed (r) | unsigned (ulr) | signed (lr) | unsigned (uhk) | signed (hk) | unsigned (uk) | signed (k) | unsigned (ulk) | signed (lk) | ++===============+================+=============+===============+============+================+=============+================+=============+===============+============+================+=============+ +| fprintf | | | | | | | | | | | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| fscanf | | | | | | | | | | | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ +| strtofx | | | | | | | | | | | | | ++---------------+----------------+-------------+---------------+------------+----------------+-------------+----------------+-------------+---------------+------------+----------------+-------------+ + + +Warnings +======== + +This is currently a work-in-progress, its headers, macros, and ABI are still unstable, and might be modified. diff --git a/libc/docs/headers/search.rst b/libc/docs/headers/search.rst new file mode 100644 index 000000000000..51832e9bdc2e --- /dev/null +++ b/libc/docs/headers/search.rst @@ -0,0 +1,71 @@ +======== +search.h +======== + +.. include:: ../check.rst + +--------------- +Source Location +--------------- + +- The main source for search functions is located at: + ``libc/src/search``. + +- Hashtable implementation is located at: + ``libc/src/__support/HashTable``. + +- The tests are located at: + ``libc/test/src/search/``. + +--------------------- +Implementation Status +--------------------- + +POSIX Standard Types +==================== + +============================ ========= +Type Name Available +============================ ========= +ACTION |check| +ENTRY |check| +VISIT +============================ ========= + +POSIX Standard Functions +======================== + +============================ ========= +Function Name Available +============================ ========= +hcreate |check| +hdestroy |check| +hsearch |check| +insque |check| +lfind |check| +lsearch +remque |check| +tdelete +tfind +tsearch +twalk +============================ ========= + + +GNU Extension Functions +======================= + +========================= ========= +Function Name Available +========================= ========= +hsearch_r |check| +hcreate_r |check| +hdestroy_r |check| +tdestroy +twalk_r +========================= ========= + + +Standards +========= +search.h is specified in POSIX.1-200x (Portable Operating System Interface, Volume1: Base Specifications). diff --git a/libc/docs/headers/setjmp.rst b/libc/docs/headers/setjmp.rst new file mode 100644 index 000000000000..b0091134f1a6 --- /dev/null +++ b/libc/docs/headers/setjmp.rst @@ -0,0 +1,43 @@ +.. include:: ../check.rst + +======== +setjmp.h +======== + +Macros +====== + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Macro + - Implemented + - C23 Standard Section + - POSIX.1-2024 Standard Section + * - __STDC_VERSION_SETJMP_H__ + - + - 7.13.2 + - + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX.1-2024 Standard Section + * - longjmp + - |check| + - 7.13.2.1 + - + * - setjmp + - |check| + - 7.13.1.1 + - diff --git a/libc/docs/headers/signal.rst b/libc/docs/headers/signal.rst new file mode 100644 index 000000000000..4f51f611c9fe --- /dev/null +++ b/libc/docs/headers/signal.rst @@ -0,0 +1,207 @@ +.. include:: ../check.rst + +======== +signal.h +======== + +Macros +====== + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Macro + - Implemented + - C23 Standard Section + - POSIX Docs + * - SIGABRT + - |check| + - 7.14.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGALRM + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGBUS + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGCHLD + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGCONT + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGFPE + - |check| + - 7.14.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGHUP + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGILL + - |check| + - 7.14.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGINT + - |check| + - 7.14.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGKILL + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGPIPE + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGPOLL + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGPROF + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGQUIT + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGRTMAX + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGRTMIN + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGSEGV + - |check| + - 7.14.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGSTOP + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGSYS + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGTERM + - |check| + - 7.14.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGTRAP + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGTSTP + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGTTIN + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGTTOU + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGURG + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGUSR1 + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGUSR2 + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGVTALRM + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGXCPU + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIGXFSZ + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIG_DFL + - |check| + - 7.14.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIG_ERR + - |check| + - 7.14.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIG_HOLD + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + * - SIG_IGN + - |check| + - 7.14.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html>`__ + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX Docs + * - kill + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/kill.html>`__ + * - raise + - |check| + - 7.14.2.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/raise.html>`__ + * - sigaction + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sigaction.html>`__ + * - sigaddset + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sigaddset.html>`__ + * - sigaltstack + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sigaltstack.html>`__ + * - sigdelset + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sigdelset.html>`__ + * - sigemptyset + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sigemptyset.html>`__ + * - sigfillset + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sigfillset.html>`__ + * - signal + - |check| + - 7.14.1.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/signal.html>`__ + * - sigprocmask + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sigprocmask.html>`__ diff --git a/libc/docs/headers/stdbit.rst b/libc/docs/headers/stdbit.rst new file mode 100644 index 000000000000..0484d951e19c --- /dev/null +++ b/libc/docs/headers/stdbit.rst @@ -0,0 +1,383 @@ +.. include:: ../check.rst + +======== +stdbit.h +======== + +Macros +====== + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Macro + - Implemented + - C23 Standard Section + - POSIX.1-2024 Standard Section + * - __STDC_ENDIAN_BIG__ + - |check| + - 7.18.2.2 + - + * - __STDC_ENDIAN_LITTLE__ + - |check| + - 7.18.2.2 + - + * - __STDC_ENDIAN_NATIVE__ + - |check| + - 7.18.2.2 + - + * - __STDC_VERSION_STDBIT_H__ + - |check| + - 7.18.1.2 + - + * - stdc_bit_ceil + - |check| + - 7.18.16.1 + - + * - stdc_bit_floor + - |check| + - 7.18.15.1 + - + * - stdc_bit_width + - |check| + - 7.18.14.1 + - + * - stdc_count_ones + - |check| + - 7.18.12.1 + - + * - stdc_count_zeros + - |check| + - 7.18.11.1 + - + * - stdc_first_leading_one + - |check| + - 7.18.8.1 + - + * - stdc_first_leading_zero + - |check| + - 7.18.7.1 + - + * - stdc_first_trailing_one + - |check| + - 7.18.10.1 + - + * - stdc_first_trailing_zero + - |check| + - 7.18.9.1 + - + * - stdc_has_single_bit + - |check| + - 7.18.13.1 + - + * - stdc_leading_ones + - |check| + - 7.18.4.1 + - + * - stdc_leading_zeros + - |check| + - 7.18.3.1 + - + * - stdc_trailing_ones + - |check| + - 7.18.6.1 + - + * - stdc_trailing_zeros + - |check| + - 7.18.5.1 + - + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX.1-2024 Standard Section + * - stdc_bit_ceil_uc + - |check| + - 7.18.16 + - + * - stdc_bit_ceil_ui + - |check| + - 7.18.16 + - + * - stdc_bit_ceil_ul + - |check| + - 7.18.16 + - + * - stdc_bit_ceil_ull + - |check| + - 7.18.16 + - + * - stdc_bit_ceil_us + - |check| + - 7.18.16 + - + * - stdc_bit_floor_uc + - |check| + - 7.18.15 + - + * - stdc_bit_floor_ui + - |check| + - 7.18.15 + - + * - stdc_bit_floor_ul + - |check| + - 7.18.15 + - + * - stdc_bit_floor_ull + - |check| + - 7.18.15 + - + * - stdc_bit_floor_us + - |check| + - 7.18.15 + - + * - stdc_bit_width_uc + - |check| + - 7.18.14 + - + * - stdc_bit_width_ui + - |check| + - 7.18.14 + - + * - stdc_bit_width_ul + - |check| + - 7.18.14 + - + * - stdc_bit_width_ull + - |check| + - 7.18.14 + - + * - stdc_bit_width_us + - |check| + - 7.18.14 + - + * - stdc_count_ones_uc + - |check| + - 7.18.12 + - + * - stdc_count_ones_ui + - |check| + - 7.18.12 + - + * - stdc_count_ones_ul + - |check| + - 7.18.12 + - + * - stdc_count_ones_ull + - |check| + - 7.18.12 + - + * - stdc_count_ones_us + - |check| + - 7.18.12 + - + * - stdc_count_zeros_uc + - |check| + - 7.18.11 + - + * - stdc_count_zeros_ui + - |check| + - 7.18.11 + - + * - stdc_count_zeros_ul + - |check| + - 7.18.11 + - + * - stdc_count_zeros_ull + - |check| + - 7.18.11 + - + * - stdc_count_zeros_us + - |check| + - 7.18.11 + - + * - stdc_first_leading_one_uc + - |check| + - 7.18.8 + - + * - stdc_first_leading_one_ui + - |check| + - 7.18.8 + - + * - stdc_first_leading_one_ul + - |check| + - 7.18.8 + - + * - stdc_first_leading_one_ull + - |check| + - 7.18.8 + - + * - stdc_first_leading_one_us + - |check| + - 7.18.8 + - + * - stdc_first_leading_zero_uc + - |check| + - 7.18.7 + - + * - stdc_first_leading_zero_ui + - |check| + - 7.18.7 + - + * - stdc_first_leading_zero_ul + - |check| + - 7.18.7 + - + * - stdc_first_leading_zero_ull + - |check| + - 7.18.7 + - + * - stdc_first_leading_zero_us + - |check| + - 7.18.7 + - + * - stdc_first_trailing_one_uc + - |check| + - 7.18.10 + - + * - stdc_first_trailing_one_ui + - |check| + - 7.18.10 + - + * - stdc_first_trailing_one_ul + - |check| + - 7.18.10 + - + * - stdc_first_trailing_one_ull + - |check| + - 7.18.10 + - + * - stdc_first_trailing_one_us + - |check| + - 7.18.10 + - + * - stdc_first_trailing_zero_uc + - |check| + - 7.18.9 + - + * - stdc_first_trailing_zero_ui + - |check| + - 7.18.9 + - + * - stdc_first_trailing_zero_ul + - |check| + - 7.18.9 + - + * - stdc_first_trailing_zero_ull + - |check| + - 7.18.9 + - + * - stdc_first_trailing_zero_us + - |check| + - 7.18.9 + - + * - stdc_has_single_bit_uc + - |check| + - 7.18.13 + - + * - stdc_has_single_bit_ui + - |check| + - 7.18.13 + - + * - stdc_has_single_bit_ul + - |check| + - 7.18.13 + - + * - stdc_has_single_bit_ull + - |check| + - 7.18.13 + - + * - stdc_has_single_bit_us + - |check| + - 7.18.13 + - + * - stdc_leading_ones_uc + - |check| + - 7.18.4 + - + * - stdc_leading_ones_ui + - |check| + - 7.18.4 + - + * - stdc_leading_ones_ul + - |check| + - 7.18.4 + - + * - stdc_leading_ones_ull + - |check| + - 7.18.4 + - + * - stdc_leading_ones_us + - |check| + - 7.18.4 + - + * - stdc_leading_zeros_uc + - |check| + - 7.18.3 + - + * - stdc_leading_zeros_ui + - |check| + - 7.18.3 + - + * - stdc_leading_zeros_ul + - |check| + - 7.18.3 + - + * - stdc_leading_zeros_ull + - |check| + - 7.18.3 + - + * - stdc_leading_zeros_us + - |check| + - 7.18.3 + - + * - stdc_trailing_ones_uc + - |check| + - 7.18.6 + - + * - stdc_trailing_ones_ui + - |check| + - 7.18.6 + - + * - stdc_trailing_ones_ul + - |check| + - 7.18.6 + - + * - stdc_trailing_ones_ull + - |check| + - 7.18.6 + - + * - stdc_trailing_ones_us + - |check| + - 7.18.6 + - + * - stdc_trailing_zeros_uc + - |check| + - 7.18.5 + - + * - stdc_trailing_zeros_ui + - |check| + - 7.18.5 + - + * - stdc_trailing_zeros_ul + - |check| + - 7.18.5 + - + * - stdc_trailing_zeros_ull + - |check| + - 7.18.5 + - + * - stdc_trailing_zeros_us + - |check| + - 7.18.5 + - diff --git a/libc/docs/headers/stdio.rst b/libc/docs/headers/stdio.rst new file mode 100644 index 000000000000..1833eb5acf8a --- /dev/null +++ b/libc/docs/headers/stdio.rst @@ -0,0 +1,359 @@ +.. include:: ../check.rst + +======= +stdio.h +======= + +Macros +====== + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Macro + - Implemented + - C23 Standard Section + - POSIX Docs + * - BUFSIZ + - |check| + - 7.23.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + * - EOF + - |check| + - 7.23.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + * - FILENAME_MAX + - + - 7.23.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + * - FOPEN_MAX + - + - 7.23.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + * - L_ctermid + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + * - L_tmpnam + - + - 7.23.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + * - SEEK_CUR + - |check| + - 7.23.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + * - SEEK_END + - |check| + - 7.23.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + * - SEEK_SET + - |check| + - 7.23.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + * - TMP_MAX + - + - 7.23.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + * - _IOFBF + - |check| + - 7.23.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + * - _IOLBF + - |check| + - 7.23.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + * - _IONBF + - |check| + - 7.23.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + * - _PRINTF_NAN_LEN_MAX + - + - 7.23.1 + - + * - __STDC_VERSION_STDIO_H__ + - + - 7.23.1 + - + * - stderr + - |check| + - 7.23.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + * - stdin + - |check| + - 7.23.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + * - stdout + - |check| + - 7.23.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdio.h.html>`__ + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX Docs + * - clearerr + - |check| + - 7.23.10.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/clearerr.html>`__ + * - ctermid + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ctermid.html>`__ + * - dprintf + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/dprintf.html>`__ + * - fclose + - |check| + - 7.23.5.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fclose.html>`__ + * - fdopen + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fdopen.html>`__ + * - feof + - |check| + - 7.23.10.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/feof.html>`__ + * - ferror + - |check| + - 7.23.10.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ferror.html>`__ + * - fflush + - |check| + - 7.23.5.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fflush.html>`__ + * - fgetc + - |check| + - 7.23.7.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fgetc.html>`__ + * - fgetpos + - + - 7.23.9.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fgetpos.html>`__ + * - fgets + - |check| + - 7.23.7.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fgets.html>`__ + * - fileno + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fileno.html>`__ + * - flockfile + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/flockfile.html>`__ + * - fmemopen + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fmemopen.html>`__ + * - fopen + - |check| + - 7.23.5.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fopen.html>`__ + * - fprintf + - |check| + - 7.23.6.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fprintf.html>`__ + * - fputc + - |check| + - 7.23.7.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fputc.html>`__ + * - fputs + - |check| + - 7.23.7.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fputs.html>`__ + * - fread + - |check| + - 7.23.8.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fread.html>`__ + * - freopen + - + - 7.23.5.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/freopen.html>`__ + * - fscanf + - |check| + - 7.23.6.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fscanf.html>`__ + * - fseek + - |check| + - 7.23.9.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fseek.html>`__ + * - fseeko + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fseeko.html>`__ + * - fsetpos + - + - 7.23.9.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fsetpos.html>`__ + * - ftell + - |check| + - 7.23.9.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ftell.html>`__ + * - ftello + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ftello.html>`__ + * - ftrylockfile + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ftrylockfile.html>`__ + * - funlockfile + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/funlockfile.html>`__ + * - fwrite + - |check| + - 7.23.8.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fwrite.html>`__ + * - getc + - |check| + - 7.23.7.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getc.html>`__ + * - getchar + - |check| + - 7.23.7.6 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getchar.html>`__ + * - getdelim + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getdelim.html>`__ + * - getline + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getline.html>`__ + * - open_memstream + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/open_memstream.html>`__ + * - pclose + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/pclose.html>`__ + * - perror + - + - 7.23.10.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/perror.html>`__ + * - popen + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/popen.html>`__ + * - printf + - |check| + - 7.23.6.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/printf.html>`__ + * - putc + - |check| + - 7.23.7.7 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/putc.html>`__ + * - putc_unlocked + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/putc_unlocked.html>`__ + * - putchar + - |check| + - 7.23.7.8 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/putchar.html>`__ + * - putchar_unlocked + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/putchar_unlocked.html>`__ + * - puts + - |check| + - 7.23.7.9 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/puts.html>`__ + * - remove + - |check| + - 7.23.4.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/remove.html>`__ + * - rename + - |check| + - 7.23.4.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/rename.html>`__ + * - renameat + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/renameat.html>`__ + * - rewind + - + - 7.23.9.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/rewind.html>`__ + * - scanf + - |check| + - 7.23.6.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/scanf.html>`__ + * - setbuf + - |check| + - 7.23.5.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/setbuf.html>`__ + * - setvbuf + - |check| + - 7.23.5.6 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/setvbuf.html>`__ + * - snprintf + - |check| + - 7.23.6.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/snprintf.html>`__ + * - sprintf + - |check| + - 7.23.6.6 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sprintf.html>`__ + * - sscanf + - |check| + - 7.23.6.7 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sscanf.html>`__ + * - tmpfile + - + - 7.23.4.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/tmpfile.html>`__ + * - tmpnam + - + - 7.23.4.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/tmpnam.html>`__ + * - ungetc + - |check| + - 7.23.7.10 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ungetc.html>`__ + * - vdprintf + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/vdprintf.html>`__ + * - vfprintf + - |check| + - 7.23.6.8 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/vfprintf.html>`__ + * - vfscanf + - |check| + - 7.23.6.9 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/vfscanf.html>`__ + * - vprintf + - |check| + - 7.23.6.10 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/vprintf.html>`__ + * - vscanf + - |check| + - 7.23.6.11 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/vscanf.html>`__ + * - vsnprintf + - |check| + - 7.23.6.12 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/vsnprintf.html>`__ + * - vsprintf + - |check| + - 7.23.6.13 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/vsprintf.html>`__ + * - vsscanf + - |check| + - 7.23.6.14 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/vsscanf.html>`__ diff --git a/libc/docs/headers/stdlib.rst b/libc/docs/headers/stdlib.rst new file mode 100644 index 000000000000..4151f2934c94 --- /dev/null +++ b/libc/docs/headers/stdlib.rst @@ -0,0 +1,255 @@ +.. include:: ../check.rst + +======== +stdlib.h +======== + +Macros +====== + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Macro + - Implemented + - C23 Standard Section + - POSIX Docs + * - EXIT_FAILURE + - |check| + - 7.24 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdlib.h.html>`__ + * - EXIT_SUCCESS + - |check| + - 7.24 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdlib.h.html>`__ + * - MB_CUR_MAX + - |check| + - 7.24 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdlib.h.html>`__ + * - RAND_MAX + - |check| + - 7.24 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stdlib.h.html>`__ + * - __STDC_VERSION_STDLIB_H__ + - + - 7.24 + - + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX Docs + * - _Exit + - |check| + - 7.24.4.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/_Exit.html>`__ + * - abort + - |check| + - 7.24.4.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/abort.html>`__ + * - abs + - |check| + - 7.24.6.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/abs.html>`__ + * - aligned_alloc + - |check| + - 7.24.3.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/aligned_alloc.html>`__ + * - at_quick_exit + - |check| + - 7.24.4.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/at_quick_exit.html>`__ + * - atexit + - |check| + - 7.24.4.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/atexit.html>`__ + * - atof + - |check| + - 7.24.1.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/atof.html>`__ + * - atoi + - |check| + - 7.24.1.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/atoi.html>`__ + * - atol + - |check| + - 7.24.1.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/atol.html>`__ + * - atoll + - |check| + - 7.24.1.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/atoll.html>`__ + * - bsearch + - |check| + - 7.24.5.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/bsearch.html>`__ + * - calloc + - |check| + - 7.24.3.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/calloc.html>`__ + * - div + - |check| + - 7.24.6.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/div.html>`__ + * - exit + - |check| + - 7.24.4.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/exit.html>`__ + * - free + - |check| + - 7.24.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/free.html>`__ + * - free_aligned_sized + - + - 7.24.3.5 + - + * - free_sized + - + - 7.24.3.4 + - + * - getenv + - |check| + - 7.24.4.6 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getenv.html>`__ + * - labs + - |check| + - 7.24.6.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/labs.html>`__ + * - ldiv + - |check| + - 7.24.6.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ldiv.html>`__ + * - llabs + - |check| + - 7.24.6.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/llabs.html>`__ + * - lldiv + - |check| + - 7.24.6.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/lldiv.html>`__ + * - malloc + - |check| + - 7.24.3.6 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/malloc.html>`__ + * - mblen + - + - 7.24.7.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/mblen.html>`__ + * - mbstowcs + - + - 7.24.8.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/mbstowcs.html>`__ + * - mbtowc + - + - 7.24.7.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/mbtowc.html>`__ + * - memalignment + - + - 7.24.9.1 + - + * - qsort + - |check| + - 7.24.5.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/qsort.html>`__ + * - quick_exit + - |check| + - 7.24.4.7 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/quick_exit.html>`__ + * - rand + - |check| + - 7.24.2.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/rand.html>`__ + * - realloc + - |check| + - 7.24.3.7 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/realloc.html>`__ + * - srand + - |check| + - 7.24.2.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/srand.html>`__ + * - strfromd + - |check| + - 7.24.1.3 + - + * - strfromd128 + - + - 7.24.1.4 + - + * - strfromd32 + - + - 7.24.1.4 + - + * - strfromd64 + - + - 7.24.1.4 + - + * - strfromf + - |check| + - 7.24.1.3 + - + * - strfroml + - |check| + - 7.24.1.3 + - + * - strtod + - |check| + - 7.24.1.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtod.html>`__ + * - strtod128 + - + - 7.24.1.6 + - + * - strtod32 + - + - 7.24.1.6 + - + * - strtod64 + - + - 7.24.1.6 + - + * - strtof + - |check| + - 7.24.1.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtof.html>`__ + * - strtol + - |check| + - 7.24.1.7 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtol.html>`__ + * - strtold + - |check| + - 7.24.1.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtold.html>`__ + * - strtoll + - |check| + - 7.24.1.7 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtoll.html>`__ + * - strtoul + - |check| + - 7.24.1.7 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtoul.html>`__ + * - strtoull + - |check| + - 7.24.1.7 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtoull.html>`__ + * - system + - |check| + - 7.24.4.8 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/system.html>`__ + * - wcstombs + - + - 7.24.8.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/wcstombs.html>`__ + * - wctomb + - + - 7.24.7.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/wctomb.html>`__ diff --git a/libc/docs/headers/string.rst b/libc/docs/headers/string.rst new file mode 100644 index 000000000000..2665ed8ca17e --- /dev/null +++ b/libc/docs/headers/string.rst @@ -0,0 +1,163 @@ +.. include:: ../check.rst + +======== +string.h +======== + +Macros +====== + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Macro + - Implemented + - C23 Standard Section + - POSIX Docs + * - __STDC_VERSION_STRING_H__ + - + - 7.26.1 + - + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX Docs + * - memccpy + - |check| + - 7.26.2.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/memccpy.html>`__ + * - memchr + - |check| + - 7.26.5.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/memchr.html>`__ + * - memcmp + - |check| + - 7.26.4.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/memcmp.html>`__ + * - memcpy + - |check| + - 7.26.2.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/memcpy.html>`__ + * - memmove + - |check| + - 7.26.2.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/memmove.html>`__ + * - mempcpy + - |check| + - TODO: glibc extension + - + * - memset + - |check| + - 7.26.6.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/memset.html>`__ + * - memset_explicit + - |check| + - 7.26.6.2 + - + * - stpcpy + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/stpcpy.html>`__ + * - stpncpy + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/stpncpy.html>`__ + * - strcat + - |check| + - 7.26.3.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strcat.html>`__ + * - strchr + - |check| + - 7.26.5.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strchr.html>`__ + * - strcmp + - |check| + - 7.26.4.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strcmp.html>`__ + * - strcoll + - |check| + - 7.26.4.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strcoll.html>`__ + * - strcoll_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strcoll_l.html>`__ + * - strcpy + - |check| + - 7.26.2.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strcpy.html>`__ + * - strcspn + - |check| + - 7.26.5.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strcspn.html>`__ + * - strdup + - |check| + - 7.26.2.6 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strdup.html>`__ + * - strerror + - |check| + - 7.26.6.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strerror.html>`__ + * - strlen + - |check| + - 7.26.6.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strlen.html>`__ + * - strncat + - |check| + - 7.26.3.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strncat.html>`__ + * - strncmp + - |check| + - 7.26.4.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strncmp.html>`__ + * - strncpy + - |check| + - 7.26.2.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strncpy.html>`__ + * - strndup + - |check| + - 7.26.2.7 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strndup.html>`__ + * - strpbrk + - |check| + - 7.26.5.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strpbrk.html>`__ + * - strrchr + - |check| + - 7.26.5.6 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strrchr.html>`__ + * - strspn + - |check| + - 7.26.5.7 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strspn.html>`__ + * - strstr + - |check| + - 7.26.5.8 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strstr.html>`__ + * - strtok + - |check| + - 7.26.5.9 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtok.html>`__ + * - strtok_r + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtok_r.html>`__ + * - strxfrm + - |check| + - 7.26.4.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strxfrm.html>`__ + * - strxfrm_l + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strxfrm_l.html>`__ diff --git a/libc/docs/headers/strings.rst b/libc/docs/headers/strings.rst new file mode 100644 index 000000000000..effd667cd521 --- /dev/null +++ b/libc/docs/headers/strings.rst @@ -0,0 +1,66 @@ +.. include:: ../check.rst + +========= +strings.h +========= + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX Docs + * - bcmp + - |check| + - + - `removed in POSIX.1-2008 <https://pubs.opengroup.org/onlinepubs/007904875/functions/bcmp.html>`__ + * - bcopy + - |check| + - + - `removed in POSIX.1-2008 <https://pubs.opengroup.org/onlinepubs/007904875/functions/bcopy.html>`__ + * - bzero + - |check| + - + - `removed in POSIX.1-2008 <https://pubs.opengroup.org/onlinepubs/007904875/functions/bzero.html>`__ + * - ffs + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ffs.html>`__ + * - ffsl + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ffsl.html>`__ + * - ffsll + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/ffsll.html>`__ + * - index + - |check| + - + - `removed in POSIX.1-2008 <https://pubs.opengroup.org/onlinepubs/007904875/functions/index.html>`__ + * - rindex + - |check| + - + - `removed in POSIX.1-2008 <https://pubs.opengroup.org/onlinepubs/007904875/functions/rindex.html>`__ + * - strcasecmp + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strcasecmp.html>`__ + * - strcasecmp_l + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strcasecmp_l.html>`__ + * - strncasecmp + - |check| + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strncasecmp.html>`__ + * - strncasecmp_l + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strncasecmp_l.html>`__ diff --git a/libc/docs/headers/sys/mman.rst b/libc/docs/headers/sys/mman.rst new file mode 100644 index 000000000000..e3404205c07a --- /dev/null +++ b/libc/docs/headers/sys/mman.rst @@ -0,0 +1,179 @@ +.. include:: ../../check.rst + +========== +sys/mman.h +========== + +Macros +====== + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Macro + - Implemented + - C23 Standard Section + - POSIX.1-2024 Standard Section + * - MAP_ANON + - + - + - + * - MAP_ANONYMOUS + - + - + - + * - MAP_FAILED + - |check| + - + - + * - MAP_FIXED + - + - + - + * - MAP_PRIVATE + - + - + - + * - MAP_SHARED + - + - + - + * - MCL_CURRENT + - + - + - + * - MCL_FUTURE + - + - + - + * - MS_ASYNC + - + - + - + * - MS_INVALIDATE + - + - + - + * - MS_SYNC + - + - + - + * - POSIX_MADV_DONTNEED + - |check| + - + - + * - POSIX_MADV_NORMAL + - |check| + - + - + * - POSIX_MADV_RANDOM + - |check| + - + - + * - POSIX_MADV_SEQUENTIAL + - |check| + - + - + * - POSIX_MADV_WILLNEED + - |check| + - + - + * - POSIX_TYPED_MEM_ALLOCATE + - + - + - + * - POSIX_TYPED_MEM_ALLOCATE_CONTIG + - + - + - + * - POSIX_TYPED_MEM_MAP_ALLOCATABLE + - + - + - + * - PROT_EXEC + - + - + - + * - PROT_NONE + - + - + - + * - PROT_READ + - + - + - + * - PROT_WRITE + - + - + - + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX.1-2024 Standard Section + * - mlock + - |check| + - + - + * - mlockall + - |check| + - + - + * - mmap + - |check| + - + - + * - mprotect + - |check| + - + - + * - msync + - |check| + - + - + * - munlock + - |check| + - + - + * - munlockall + - |check| + - + - + * - munmap + - |check| + - + - + * - posix_madvise + - |check| + - + - + * - posix_mem_offset + - + - + - + * - posix_typed_mem_get_info + - + - + - + * - posix_typed_mem_open + - + - + - + * - shm_open + - |check| + - + - + * - shm_unlink + - |check| + - + - diff --git a/libc/docs/headers/threads.rst b/libc/docs/headers/threads.rst new file mode 100644 index 000000000000..c2837b8c3591 --- /dev/null +++ b/libc/docs/headers/threads.rst @@ -0,0 +1,147 @@ +.. include:: ../check.rst + +========= +threads.h +========= + +Macros +====== + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Macro + - Implemented + - C23 Standard Section + - POSIX Docs + * - ONCE_FLAG_INIT + - + - 7.28.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/threads.h.html>`__ + * - TSS_DTOR_ITERATIONS + - + - 7.28.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/threads.h.html>`__ + * - __STDC_NO_THREADS__ + - + - 7.28.1 + - + * - thread_local + - + - + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/threads.h.html>`__ + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX Docs + * - call_once + - |check| + - 7.28.2.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/call_once.html>`__ + * - cnd_broadcast + - |check| + - 7.28.3.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/cnd_broadcast.html>`__ + * - cnd_destroy + - |check| + - 7.28.3.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/cnd_destroy.html>`__ + * - cnd_init + - |check| + - 7.28.3.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/cnd_init.html>`__ + * - cnd_signal + - |check| + - 7.28.3.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/cnd_signal.html>`__ + * - cnd_timedwait + - + - 7.28.3.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/cnd_timedwait.html>`__ + * - cnd_wait + - |check| + - 7.28.3.6 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/cnd_wait.html>`__ + * - mtx_destroy + - |check| + - 7.28.4.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/mtx_destroy.html>`__ + * - mtx_init + - |check| + - 7.28.4.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/mtx_init.html>`__ + * - mtx_lock + - |check| + - 7.28.4.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/mtx_lock.html>`__ + * - mtx_timedlock + - + - 7.28.4.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/mtx_timedlock.html>`__ + * - mtx_trylock + - + - 7.28.4.6 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/mtx_trylock.html>`__ + * - mtx_unlock + - |check| + - 7.28.4.7 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/mtx_unlock.html>`__ + * - thrd_create + - |check| + - 7.28.5.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/thrd_create.html>`__ + * - thrd_current + - |check| + - 7.28.5.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/thrd_current.html>`__ + * - thrd_detach + - |check| + - 7.28.5.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/thrd_detach.html>`__ + * - thrd_equal + - |check| + - 7.28.5.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/thrd_equal.html>`__ + * - thrd_exit + - |check| + - 7.28.5.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/thrd_exit.html>`__ + * - thrd_join + - |check| + - 7.28.5.6 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/thrd_join.html>`__ + * - thrd_sleep + - + - 7.28.5.7 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/thrd_sleep.html>`__ + * - thrd_yield + - + - 7.28.5.8 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/thrd_yield.html>`__ + * - tss_create + - |check| + - 7.28.6.1 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/tss_create.html>`__ + * - tss_delete + - |check| + - 7.28.6.2 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/tss_delete.html>`__ + * - tss_get + - |check| + - 7.28.6.3 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/tss_get.html>`__ + * - tss_set + - |check| + - 7.28.6.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/tss_set.html>`__ diff --git a/libc/docs/headers/time.rst b/libc/docs/headers/time.rst new file mode 100644 index 000000000000..de82d80a2bec --- /dev/null +++ b/libc/docs/headers/time.rst @@ -0,0 +1,113 @@ +====== +time.h +====== + +.. include:: ../check.rst + +--------------- +Source location +--------------- + +- The main source for time functions is located at: ``libc/src/time`` + +--------------------- +Implementation Status +--------------------- + +* To check date and time functions enabled for Linux: + + - `linux-x86_64 <https://github.com/llvm/llvm-project/tree/main/libc/config/linux/x86_64/entrypoints.txt>`_ + + - `linux-aarch64 <https://github.com/llvm/llvm-project/tree/main/libc/config/linux/aarch64/entrypoints.txt>`_ + + - `linux-aarch32 <https://github.com/llvm/llvm-project/tree/main/libc/config/linux/arm/entrypoints.txt>`_ + + - `linux-riscv and linux-riscv32 <https://github.com/llvm/llvm-project/tree/main/libc/config/linux/riscv/entrypoints.txt>`_ + +* To check date and time functions enabled for Windows: + + - `windows-x86_64 <https://github.com/llvm/llvm-project/tree/main/libc/config/windows/entrypoints.txt>`_ + + - windows-aarch64 - to be added + +* To check date and time functions enabled for macOS: + + - `darwin-x86_64 <https://github.com/llvm/llvm-project/tree/main/libc/config/darwin/x86_64/entrypoints.txt>`_ + + - `darwin-aarch64 <https://github.com/llvm/llvm-project/tree/main/libc/config/darwin/arm/entrypoints.txt>`_ + +* To check date and time functions enabled for GPU: + + - `gpu-entrypoints <https://github.com/llvm/llvm-project/tree/main/libc/config/gpu/entrypoints.txt>`_ + +* To check date and time functions enabled for embedded system: + + - `barebone-aarch32 <https://github.com/llvm/llvm-project/tree/main/libc/config/baremetal/arm/entrypoints.txt>`_ + + - barebone-riscv32 - to be added + ++---------------------+-----------------------------------------------+-------------------+-------------------+-------------------+-------------------+ +| <Func> | Linux | Windows | MacOS | Embedded | GPU | +| +---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| | x86_64 | aarch64 | aarch32 | riscv64/riscv32 | x86_64 | aarch64 | x86_64 | aarch64 | aarch32 | riscv32 | AMD | nVidia | ++=====================+=========+=========+=========+=================+=========+=========+=========+=========+=========+=========+=========+=========+ +| asctime | |check| | |check| | | |check| | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| asctime_r | |check| | |check| | | |check| | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| ctime | |check| | |check| | | |check| | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| ctime_r | |check| | |check| | | |check| | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| clock | |check| | |check| | | |check| | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| clock_getcpuclockid | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| clock_getres | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| clock_gettime | |check| | |check| | | |check| | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| clock_nanosleep | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| clock_settime | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| ctime | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| ctime_r | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| difftime | |check| | |check| | | |check| | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| getdate | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| gettimeofday | |check| | |check| | | |check| | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| gmtime | |check| | |check| | | |check| | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| gmtime_r | |check| | |check| | | |check| | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| localtime | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| localtime_r | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| mktime | |check| | |check| | | |check| | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| nanosleep | |check| | |check| | | |check| | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| strftime | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| strptime | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| time | |check| | |check| | | |check| | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| timer_create | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| timer_delete | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| timer_gettime | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| timer_getoverrun | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| timer_settime | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ +| tzset | | | | | | | | | | | | | ++---------------------+---------+---------+---------+-----------------+---------+---------+---------+---------+---------+---------+---------+---------+ diff --git a/libc/docs/headers/uchar.rst b/libc/docs/headers/uchar.rst new file mode 100644 index 000000000000..abb684bf9ae0 --- /dev/null +++ b/libc/docs/headers/uchar.rst @@ -0,0 +1,59 @@ +.. include:: ../check.rst + +======= +uchar.h +======= + +Macros +====== + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Macro + - Implemented + - C23 Standard Section + - POSIX Docs + * - __STDC_VERSION_UCHAR_H__ + - + - 7.30.1 + - + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX Docs + * - c16rtomb + - + - 7.30.2.5 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/c16rtomb.html>`__ + * - c32rtomb + - + - 7.30.2.7 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/c32rtomb.html>`__ + * - c8rtomb + - + - 7.30.2.3 + - + * - mbrtoc16 + - + - 7.30.2.4 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/mbrtoc16.html>`__ + * - mbrtoc32 + - + - 7.30.2.6 + - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/functions/mbrtoc32.html>`__ + * - mbrtoc8 + - + - 7.30.2.2 + - diff --git a/libc/docs/headers/wchar.rst b/libc/docs/headers/wchar.rst new file mode 100644 index 000000000000..89a1e7b3fe66 --- /dev/null +++ b/libc/docs/headers/wchar.rst @@ -0,0 +1,287 @@ +.. include:: ../check.rst + +======= +wchar.h +======= + +Macros +====== + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Macro + - Implemented + - C23 Standard Section + - POSIX Docs + * - WEOF + - |check| + - 7.31.1 + - + * - __STDC_VERSION_WCHAR_H__ + - + - 7.31.1 + - + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX Docs + * - btowc + - |check| + - 7.31.6.2.1 + - + * - fgetwc + - + - 7.31.3.1 + - + * - fgetws + - + - 7.31.3.2 + - + * - fputwc + - + - 7.31.3.3 + - + * - fputws + - + - 7.31.3.4 + - + * - fwide + - + - 7.31.3.5 + - + * - fwprintf + - + - 7.31.2.2 + - + * - fwscanf + - + - 7.31.2.3 + - + * - getwc + - + - 7.31.3.6 + - + * - getwchar + - + - 7.31.3.7 + - + * - mbrlen + - + - 7.31.6.4.2 + - + * - mbrtowc + - + - 7.31.6.4.3 + - + * - mbsinit + - + - 7.31.6.3.1 + - + * - mbsrtowcs + - + - 7.31.6.5.2 + - + * - putwc + - + - 7.31.3.8 + - + * - putwchar + - + - 7.31.3.9 + - + * - swprintf + - + - 7.31.2.4 + - + * - swscanf + - + - 7.31.2.5 + - + * - ungetwc + - + - 7.31.3.10 + - + * - vfwprintf + - + - 7.31.2.6 + - + * - vfwscanf + - + - 7.31.2.7 + - + * - vswprintf + - + - 7.31.2.8 + - + * - vswscanf + - + - 7.31.2.9 + - + * - vwprintf + - + - 7.31.2.10 + - + * - vwscanf + - + - 7.31.2.11 + - + * - wcrtomb + - + - 7.31.6.4.4 + - + * - wcscat + - + - 7.31.4.4.1 + - + * - wcschr + - + - 7.31.4.6.2 + - + * - wcscmp + - + - 7.31.4.5.2 + - + * - wcscoll + - + - 7.31.4.5.3 + - + * - wcscpy + - + - 7.31.4.3.1 + - + * - wcscspn + - + - 7.31.4.6.3 + - + * - wcsftime + - + - 7.31.5.1 + - + * - wcslen + - + - 7.31.4.7.1 + - + * - wcsncat + - + - 7.31.4.4.2 + - + * - wcsncmp + - + - 7.31.4.5.4 + - + * - wcsncpy + - + - 7.31.4.3.2 + - + * - wcspbrk + - + - 7.31.4.6.4 + - + * - wcsrchr + - + - 7.31.4.6.5 + - + * - wcsrtombs + - + - 7.31.6.5.3 + - + * - wcsspn + - + - 7.31.4.6.6 + - + * - wcsstr + - + - 7.31.4.6.7 + - + * - wcstod + - + - 7.31.4.2.2 + - + * - wcstod128 + - + - 7.31.4.2.3 + - + * - wcstod32 + - + - 7.31.4.2.3 + - + * - wcstod64 + - + - 7.31.4.2.3 + - + * - wcstof + - + - 7.31.4.2.2 + - + * - wcstok + - + - 7.31.4.6.8 + - + * - wcstol + - + - 7.31.4.2.4 + - + * - wcstold + - + - 7.31.4.2.2 + - + * - wcstoll + - + - 7.31.4.2.4 + - + * - wcstoul + - + - 7.31.4.2.4 + - + * - wcstoull + - + - 7.31.4.2.4 + - + * - wcsxfrm + - + - 7.31.4.5.5 + - + * - wctob + - |check| + - 7.31.6.2.2 + - + * - wmemchr + - + - 7.31.4.6.9 + - + * - wmemcmp + - + - 7.31.4.5.6 + - + * - wmemcpy + - + - 7.31.4.3.3 + - + * - wmemmove + - + - 7.31.4.3.4 + - + * - wmemset + - + - 7.31.4.7.2 + - + * - wprintf + - + - 7.31.2.12 + - + * - wscanf + - + - 7.31.2.13 + - diff --git a/libc/docs/headers/wctype.rst b/libc/docs/headers/wctype.rst new file mode 100644 index 000000000000..076db04f183e --- /dev/null +++ b/libc/docs/headers/wctype.rst @@ -0,0 +1,86 @@ +.. include:: ../check.rst + +======== +wctype.h +======== + +Functions +========= + +.. list-table:: + :widths: auto + :align: center + :header-rows: 1 + + * - Function + - Implemented + - C23 Standard Section + - POSIX Docs + * - iswalnum + - + - 7.32.2.1.1 + - + * - iswalpha + - + - 7.32.2.1.2 + - + * - iswblank + - + - 7.32.2.1.4 + - + * - iswctype + - + - 7.32.2.2.1 + - + * - iswdigit + - + - 7.32.2.1.5 + - + * - iswgraph + - + - 7.32.2.1.6 + - + * - iswlower + - + - 7.32.2.1.7 + - + * - iswprint + - + - 7.32.2.1.8 + - + * - iswpunct + - + - 7.32.2.1.9 + - + * - iswspace + - + - 7.32.2.1.10 + - + * - iswupper + - + - 7.32.2.1.11 + - + * - iswxdigit + - + - 7.32.2.1.12 + - + * - towctrans + - + - 7.32.3.2.1 + - + * - towlower + - + - 7.32.3.1.1 + - + * - towupper + - + - 7.32.3.1.2 + - + * - wctrans + - + - 7.32.3.2.2 + - + * - wctype + - + - 7.32.2.2.2 + - |
