Skip to content

Commit accee2b

Browse files
authored
[libc][math][c23] Add atanhf16 C23 math function. (#132612)
Implementation of atanhf16 function for 16-bit inputs. Closes: #132209
1 parent 2d1b5a2 commit accee2b

File tree

14 files changed

+401
-1
lines changed

14 files changed

+401
-1
lines changed

libc/config/linux/x86_64/entrypoints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
665665
libc.src.math.acospif16
666666
libc.src.math.asinf16
667667
libc.src.math.asinhf16
668+
libc.src.math.atanhf16
668669
libc.src.math.canonicalizef16
669670
libc.src.math.ceilf16
670671
libc.src.math.copysignf16

libc/docs/headers/math/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ Higher Math Functions
267267
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
268268
| atan2pi | | | | | | 7.12.4.11 | F.10.1.11 |
269269
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
270-
| atanh | |check| | | | | | 7.12.5.3 | F.10.2.3 |
270+
| atanh | |check| | | | |check| | | 7.12.5.3 | F.10.2.3 |
271271
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
272272
| atanpi | | | | | | 7.12.4.10 | F.10.1.10 |
273273
+-----------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+

libc/include/math.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ functions:
120120
return_type: float
121121
arguments:
122122
- type: float
123+
- name: atanhf16
124+
standards:
125+
- stdc
126+
return_type: _Float16
127+
arguments:
128+
- type: _Float16
129+
guard: LIBC_TYPES_HAS_FLOAT16
123130
- name: canonicalize
124131
standards:
125132
- stdc

libc/src/math/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ add_math_entrypoint_object(atan2f128)
6868

6969
add_math_entrypoint_object(atanh)
7070
add_math_entrypoint_object(atanhf)
71+
add_math_entrypoint_object(atanhf16)
7172

7273
add_math_entrypoint_object(canonicalize)
7374
add_math_entrypoint_object(canonicalizef)

libc/src/math/atanhf16.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===-- Implementation header for atanhf16 ----------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_SRC_MATH_ATANHF16_H
10+
#define LLVM_LIBC_SRC_MATH_ATANHF16_H
11+
12+
#include "src/__support/macros/config.h"
13+
#include "src/__support/macros/properties/types.h"
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
float16 atanhf16(float16 x);
18+
19+
} // namespace LIBC_NAMESPACE_DECL
20+
21+
#endif // LLVM_LIBC_SRC_MATH_ATANHF16_H

libc/src/math/generic/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4029,6 +4029,26 @@ add_entrypoint_object(
40294029
libc.src.__support.macros.optimization
40304030
)
40314031

4032+
add_entrypoint_object(
4033+
atanhf16
4034+
SRCS
4035+
atanhf16.cpp
4036+
HDRS
4037+
../atanhf16.h
4038+
DEPENDS
4039+
.explogxf
4040+
libc.hdr.errno_macros
4041+
libc.hdr.fenv_macros
4042+
libc.src.__support.FPUtil.cast
4043+
libc.src.__support.FPUtil.except_value_utils
4044+
libc.src.__support.FPUtil.fenv_impl
4045+
libc.src.__support.FPUtil.fp_bits
4046+
libc.src.__support.FPUtil.multiply_add
4047+
libc.src.__support.FPUtil.polyeval
4048+
libc.src.__support.macros.optimization
4049+
libc.src.__support.macros.properties.types
4050+
)
4051+
40324052
add_object_library(
40334053
inv_trigf_utils
40344054
HDRS

libc/src/math/generic/atanhf16.cpp

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
//===-- Half-precision atanh(x) function ----------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "src/math/atanhf16.h"
10+
#include "explogxf.h"
11+
#include "hdr/errno_macros.h"
12+
#include "hdr/fenv_macros.h"
13+
#include "src/__support/FPUtil/FEnvImpl.h"
14+
#include "src/__support/FPUtil/FPBits.h"
15+
#include "src/__support/FPUtil/PolyEval.h"
16+
#include "src/__support/FPUtil/cast.h"
17+
#include "src/__support/FPUtil/except_value_utils.h"
18+
#include "src/__support/FPUtil/multiply_add.h"
19+
#include "src/__support/common.h"
20+
#include "src/__support/macros/config.h"
21+
#include "src/__support/macros/optimization.h"
22+
23+
namespace LIBC_NAMESPACE_DECL {
24+
25+
static constexpr size_t N_EXCEPTS = 1;
26+
static constexpr fputil::ExceptValues<float16, N_EXCEPTS> ATANHF16_EXCEPTS{{
27+
// (input, RZ output, RU offset, RD offset, RN offset)
28+
// x = 0x1.a5cp-4, atanhf16(x) = 0x1.a74p-4 (RZ)
29+
{0x2E97, 0x2E9D, 1, 0, 0},
30+
}};
31+
32+
LLVM_LIBC_FUNCTION(float16, atanhf16, (float16 x)) {
33+
using FPBits = fputil::FPBits<float16>;
34+
35+
FPBits xbits(x);
36+
Sign sign = xbits.sign();
37+
uint16_t x_abs = xbits.abs().uintval();
38+
39+
// |x| >= 1
40+
if (LIBC_UNLIKELY(x_abs >= 0x3c00U)) {
41+
if (xbits.is_nan()) {
42+
if (xbits.is_signaling_nan()) {
43+
fputil::raise_except_if_required(FE_INVALID);
44+
return FPBits::quiet_nan().get_val();
45+
}
46+
return x;
47+
}
48+
49+
// |x| == 1.0
50+
if (x_abs == 0x3c00U) {
51+
fputil::set_errno_if_required(ERANGE);
52+
fputil::raise_except_if_required(FE_DIVBYZERO);
53+
return FPBits::inf(sign).get_val();
54+
}
55+
// |x| > 1.0
56+
fputil::set_errno_if_required(EDOM);
57+
fputil::raise_except_if_required(FE_INVALID);
58+
return FPBits::quiet_nan().get_val();
59+
}
60+
61+
if (auto r = ATANHF16_EXCEPTS.lookup(xbits.uintval());
62+
LIBC_UNLIKELY(r.has_value()))
63+
return r.value();
64+
65+
// For |x| less than approximately 0.24
66+
if (LIBC_UNLIKELY(x_abs <= 0x33f3U)) {
67+
// atanh(+/-0) = +/-0
68+
if (LIBC_UNLIKELY(x_abs == 0U))
69+
return x;
70+
// The Taylor expansion of atanh(x) is:
71+
// atanh(x) = x + x^3/3 + x^5/5 + x^7/7 + x^9/9 + x^11/11
72+
// = x * [1 + x^2/3 + x^4/5 + x^6/7 + x^8/9 + x^10/11]
73+
// When |x| < 2^-5 (0x0800U), this can be approximated by:
74+
// atanh(x) ≈ x + (1/3)*x^3
75+
if (LIBC_UNLIKELY(x_abs < 0x0800U)) {
76+
float xf = x;
77+
return fputil::cast<float16>(xf + 0x1.555556p-2f * xf * xf * xf);
78+
}
79+
80+
// For 2^-5 <= |x| <= 0x1.fccp-3 (~0.24):
81+
// Let t = x^2.
82+
// Define P(t) ≈ (1/3)*t + (1/5)*t^2 + (1/7)*t^3 + (1/9)*t^4 + (1/11)*t^5.
83+
// Coefficients (from Sollya, RN, hexadecimal):
84+
// 1/3 = 0x1.555556p-2, 1/5 = 0x1.99999ap-3, 1/7 = 0x1.24924ap-3,
85+
// 1/9 = 0x1.c71c72p-4, 1/11 = 0x1.745d18p-4
86+
// Thus, atanh(x) ≈ x * (1 + P(x^2)).
87+
float xf = x;
88+
float x2 = xf * xf;
89+
float pe = fputil::polyeval(x2, 0.0f, 0x1.555556p-2f, 0x1.99999ap-3f,
90+
0x1.24924ap-3f, 0x1.c71c72p-4f, 0x1.745d18p-4f);
91+
return fputil::cast<float16>(fputil::multiply_add(xf, pe, xf));
92+
}
93+
94+
float xf = x;
95+
return fputil::cast<float16>(0.5 * log_eval_f((xf + 1.0f) / (xf - 1.0f)));
96+
}
97+
98+
} // namespace LIBC_NAMESPACE_DECL

libc/src/math/generic/common_constants.cpp

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,45 @@
1313

1414
namespace LIBC_NAMESPACE_DECL {
1515

16+
// Lookup table for logf(f) = logf(1 + n*2^(-7)) where n = 0..127,
17+
// computed and stored as float precision constants.
18+
// Generated by Sollya with the following commands:
19+
// display = hexadecimal;
20+
// for n from 0 to 127 do { print(single(1 / (1 + n / 128.0))); };
21+
const float ONE_OVER_F_FLOAT[128] = {
22+
0x1p0f, 0x1.fc07fp-1f, 0x1.f81f82p-1f, 0x1.f4465ap-1f,
23+
0x1.f07c2p-1f, 0x1.ecc07cp-1f, 0x1.e9131ap-1f, 0x1.e573acp-1f,
24+
0x1.e1e1e2p-1f, 0x1.de5d6ep-1f, 0x1.dae608p-1f, 0x1.d77b66p-1f,
25+
0x1.d41d42p-1f, 0x1.d0cb58p-1f, 0x1.cd8568p-1f, 0x1.ca4b3p-1f,
26+
0x1.c71c72p-1f, 0x1.c3f8fp-1f, 0x1.c0e07p-1f, 0x1.bdd2b8p-1f,
27+
0x1.bacf92p-1f, 0x1.b7d6c4p-1f, 0x1.b4e81cp-1f, 0x1.b20364p-1f,
28+
0x1.af286cp-1f, 0x1.ac5702p-1f, 0x1.a98ef6p-1f, 0x1.a6d01ap-1f,
29+
0x1.a41a42p-1f, 0x1.a16d4p-1f, 0x1.9ec8eap-1f, 0x1.9c2d14p-1f,
30+
0x1.99999ap-1f, 0x1.970e5p-1f, 0x1.948b1p-1f, 0x1.920fb4p-1f,
31+
0x1.8f9c18p-1f, 0x1.8d3018p-1f, 0x1.8acb9p-1f, 0x1.886e6p-1f,
32+
0x1.861862p-1f, 0x1.83c978p-1f, 0x1.818182p-1f, 0x1.7f406p-1f,
33+
0x1.7d05f4p-1f, 0x1.7ad22p-1f, 0x1.78a4c8p-1f, 0x1.767dcep-1f,
34+
0x1.745d18p-1f, 0x1.724288p-1f, 0x1.702e06p-1f, 0x1.6e1f76p-1f,
35+
0x1.6c16c2p-1f, 0x1.6a13cep-1f, 0x1.681682p-1f, 0x1.661ec6p-1f,
36+
0x1.642c86p-1f, 0x1.623fa8p-1f, 0x1.605816p-1f, 0x1.5e75bcp-1f,
37+
0x1.5c9882p-1f, 0x1.5ac056p-1f, 0x1.58ed24p-1f, 0x1.571ed4p-1f,
38+
0x1.555556p-1f, 0x1.539094p-1f, 0x1.51d07ep-1f, 0x1.501502p-1f,
39+
0x1.4e5e0ap-1f, 0x1.4cab88p-1f, 0x1.4afd6ap-1f, 0x1.49539ep-1f,
40+
0x1.47ae14p-1f, 0x1.460cbcp-1f, 0x1.446f86p-1f, 0x1.42d662p-1f,
41+
0x1.414142p-1f, 0x1.3fb014p-1f, 0x1.3e22ccp-1f, 0x1.3c995ap-1f,
42+
0x1.3b13b2p-1f, 0x1.3991c2p-1f, 0x1.381382p-1f, 0x1.3698ep-1f,
43+
0x1.3521dp-1f, 0x1.33ae46p-1f, 0x1.323e34p-1f, 0x1.30d19p-1f,
44+
0x1.2f684cp-1f, 0x1.2e025cp-1f, 0x1.2c9fb4p-1f, 0x1.2b404ap-1f,
45+
0x1.29e412p-1f, 0x1.288b02p-1f, 0x1.27350cp-1f, 0x1.25e228p-1f,
46+
0x1.24924ap-1f, 0x1.234568p-1f, 0x1.21fb78p-1f, 0x1.20b47p-1f,
47+
0x1.1f7048p-1f, 0x1.1e2ef4p-1f, 0x1.1cf06ap-1f, 0x1.1bb4a4p-1f,
48+
0x1.1a7b96p-1f, 0x1.194538p-1f, 0x1.181182p-1f, 0x1.16e068p-1f,
49+
0x1.15b1e6p-1f, 0x1.1485fp-1f, 0x1.135c82p-1f, 0x1.12358ep-1f,
50+
0x1.111112p-1f, 0x1.0fef02p-1f, 0x1.0ecf56p-1f, 0x1.0db20ap-1f,
51+
0x1.0c9714p-1f, 0x1.0b7e6ep-1f, 0x1.0a681p-1f, 0x1.0953f4p-1f,
52+
0x1.08421p-1f, 0x1.07326p-1f, 0x1.0624dep-1f, 0x1.05198p-1f,
53+
0x1.041042p-1f, 0x1.03091cp-1f, 0x1.020408p-1f, 0x1.010102p-1f};
54+
1655
// Lookup table for (1/f) where f = 1 + n*2^(-7), n = 0..127.
1756
const double ONE_OVER_F[128] = {
1857
0x1.0000000000000p+0, 0x1.fc07f01fc07f0p-1, 0x1.f81f81f81f820p-1,
@@ -59,6 +98,45 @@ const double ONE_OVER_F[128] = {
5998
0x1.05197f7d73404p-1, 0x1.0410410410410p-1, 0x1.03091b51f5e1ap-1,
6099
0x1.0204081020408p-1, 0x1.0101010101010p-1};
61100

101+
// Lookup table for log(f) = log(1 + n*2^(-7)) where n = 0..127,
102+
// computed and stored as float precision constants.
103+
// Generated by Sollya with the following commands:
104+
// display = hexadecimal;
105+
// for n from 0 to 127 do { print(single(log(1 + n / 128.0))); };
106+
const float LOG_F_FLOAT[128] = {
107+
0.0f, 0x1.fe02a6p-8f, 0x1.fc0a8cp-7f, 0x1.7b91bp-6f,
108+
0x1.f829bp-6f, 0x1.39e87cp-5f, 0x1.77459p-5f, 0x1.b42dd8p-5f,
109+
0x1.f0a30cp-5f, 0x1.16536ep-4f, 0x1.341d7ap-4f, 0x1.51b074p-4f,
110+
0x1.6f0d28p-4f, 0x1.8c345ep-4f, 0x1.a926d4p-4f, 0x1.c5e548p-4f,
111+
0x1.e27076p-4f, 0x1.fec914p-4f, 0x1.0d77e8p-3f, 0x1.1b72aep-3f,
112+
0x1.29553p-3f, 0x1.371fc2p-3f, 0x1.44d2b6p-3f, 0x1.526e5ep-3f,
113+
0x1.5ff308p-3f, 0x1.6d60fep-3f, 0x1.7ab89p-3f, 0x1.87fa06p-3f,
114+
0x1.9525aap-3f, 0x1.a23bc2p-3f, 0x1.af3c94p-3f, 0x1.bc2868p-3f,
115+
0x1.c8ff7cp-3f, 0x1.d5c216p-3f, 0x1.e27076p-3f, 0x1.ef0adcp-3f,
116+
0x1.fb9186p-3f, 0x1.04025ap-2f, 0x1.0a324ep-2f, 0x1.1058cp-2f,
117+
0x1.1675cap-2f, 0x1.1c898cp-2f, 0x1.22942p-2f, 0x1.2895a2p-2f,
118+
0x1.2e8e2cp-2f, 0x1.347ddap-2f, 0x1.3a64c6p-2f, 0x1.404308p-2f,
119+
0x1.4618bcp-2f, 0x1.4be5fap-2f, 0x1.51aad8p-2f, 0x1.576772p-2f,
120+
0x1.5d1bdcp-2f, 0x1.62c83p-2f, 0x1.686c82p-2f, 0x1.6e08eap-2f,
121+
0x1.739d8p-2f, 0x1.792a56p-2f, 0x1.7eaf84p-2f, 0x1.842d1ep-2f,
122+
0x1.89a338p-2f, 0x1.8f11e8p-2f, 0x1.947942p-2f, 0x1.99d958p-2f,
123+
0x1.9f323ep-2f, 0x1.a4840ap-2f, 0x1.a9cecap-2f, 0x1.af1294p-2f,
124+
0x1.b44f78p-2f, 0x1.b9858ap-2f, 0x1.beb4dap-2f, 0x1.c3dd7ap-2f,
125+
0x1.c8ff7cp-2f, 0x1.ce1afp-2f, 0x1.d32fe8p-2f, 0x1.d83e72p-2f,
126+
0x1.dd46ap-2f, 0x1.e24882p-2f, 0x1.e74426p-2f, 0x1.ec399ep-2f,
127+
0x1.f128f6p-2f, 0x1.f6124p-2f, 0x1.faf588p-2f, 0x1.ffd2ep-2f,
128+
0x1.02552ap-1f, 0x1.04bdfap-1f, 0x1.0723e6p-1f, 0x1.0986f4p-1f,
129+
0x1.0be72ep-1f, 0x1.0e4498p-1f, 0x1.109f3ap-1f, 0x1.12f71ap-1f,
130+
0x1.154c3ep-1f, 0x1.179eacp-1f, 0x1.19ee6cp-1f, 0x1.1c3b82p-1f,
131+
0x1.1e85f6p-1f, 0x1.20cdcep-1f, 0x1.23130ep-1f, 0x1.2555bcp-1f,
132+
0x1.2795e2p-1f, 0x1.29d38p-1f, 0x1.2c0e9ep-1f, 0x1.2e4744p-1f,
133+
0x1.307d74p-1f, 0x1.32b134p-1f, 0x1.34e28ap-1f, 0x1.37117cp-1f,
134+
0x1.393e0ep-1f, 0x1.3b6844p-1f, 0x1.3d9026p-1f, 0x1.3fb5b8p-1f,
135+
0x1.41d8fep-1f, 0x1.43f9fep-1f, 0x1.4618bcp-1f, 0x1.48353ep-1f,
136+
0x1.4a4f86p-1f, 0x1.4c679ap-1f, 0x1.4e7d82p-1f, 0x1.50913cp-1f,
137+
0x1.52a2d2p-1f, 0x1.54b246p-1f, 0x1.56bf9ep-1f, 0x1.58cadcp-1f,
138+
0x1.5ad404p-1f, 0x1.5cdb1ep-1f, 0x1.5ee02ap-1f, 0x1.60e33p-1f};
139+
62140
// Lookup table for log(f) = log(1 + n*2^(-7)) where n = 0..127.
63141
const double LOG_F[128] = {
64142
0x0.0000000000000p+0, 0x1.fe02a6b106788p-8, 0x1.fc0a8b0fc03e3p-7,

libc/src/math/generic/common_constants.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,17 @@
1515

1616
namespace LIBC_NAMESPACE_DECL {
1717

18+
// Lookup table for (1/f) where f = 1 + n*2^(-7), n = 0..127,
19+
// computed and stored as float precision constants.
20+
extern const float ONE_OVER_F_FLOAT[128];
21+
1822
// Lookup table for (1/f) where f = 1 + n*2^(-7), n = 0..127.
1923
extern const double ONE_OVER_F[128];
2024

25+
// Lookup table for log(f) = log(1 + n*2^(-7)) where n = 0..127,
26+
// computed and stored as float precision constants.
27+
extern const float LOG_F_FLOAT[128];
28+
2129
// Lookup table for log(f) = log(1 + n*2^(-7)) where n = 0..127.
2230
extern const double LOG_F[128];
2331

libc/src/math/generic/explogxf.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,49 @@ LIBC_INLINE static double log2_eval(double x) {
297297
return result;
298298
}
299299

300+
// x should be positive, normal finite value
301+
// TODO: Simplify range reduction and polynomial degree for float16.
302+
// See issue #137190.
303+
LIBC_INLINE static float log_eval_f(float x) {
304+
// For x = 2^ex * (1 + mx), logf(x) = ex * logf(2) + logf(1 + mx).
305+
using FPBits = fputil::FPBits<float>;
306+
FPBits xbits(x);
307+
308+
float ex = static_cast<float>(xbits.get_exponent());
309+
// p1 is the leading 7 bits of mx, i.e.
310+
// p1 * 2^(-7) <= m_x < (p1 + 1) * 2^(-7).
311+
int p1 = static_cast<int>(xbits.get_mantissa() >> (FPBits::FRACTION_LEN - 7));
312+
313+
// Set bits to (1 + (mx - p1*2^(-7)))
314+
xbits.set_uintval(xbits.uintval() & (FPBits::FRACTION_MASK >> 7));
315+
xbits.set_biased_exponent(FPBits::EXP_BIAS);
316+
// dx = (mx - p1*2^(-7)) / (1 + p1*2^(-7)).
317+
float dx = (xbits.get_val() - 1.0f) * ONE_OVER_F_FLOAT[p1];
318+
319+
// Minimax polynomial for log(1 + dx), generated using Sollya:
320+
// > P = fpminimax(log(1 + x)/x, 6, [|SG...|], [0, 2^-7]);
321+
// > Q = (P - 1) / x;
322+
// > for i from 0 to degree(Q) do print(coeff(Q, i));
323+
constexpr float COEFFS[6] = {-0x1p-1f, 0x1.555556p-2f, -0x1.00022ep-2f,
324+
0x1.9ea056p-3f, -0x1.e50324p-2f, 0x1.c018fp3f};
325+
326+
float dx2 = dx * dx;
327+
328+
float c1 = fputil::multiply_add(dx, COEFFS[1], COEFFS[0]);
329+
float c2 = fputil::multiply_add(dx, COEFFS[3], COEFFS[2]);
330+
float c3 = fputil::multiply_add(dx, COEFFS[5], COEFFS[4]);
331+
332+
float p = fputil::polyeval(dx2, dx, c1, c2, c3);
333+
334+
// Generated by Sollya with the following commands:
335+
// > display = hexadecimal;
336+
// > round(log(2), SG, RN);
337+
constexpr float LOGF_2 = 0x1.62e43p-1f;
338+
339+
float result = fputil::multiply_add(ex, LOGF_2, LOG_F_FLOAT[p1] + p);
340+
return result;
341+
}
342+
300343
// x should be positive, normal finite value
301344
LIBC_INLINE static double log_eval(double x) {
302345
// For x = 2^ex * (1 + mx)

libc/test/src/math/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,6 +2143,17 @@ add_fp_unittest(
21432143
libc.src.__support.FPUtil.fp_bits
21442144
)
21452145

2146+
add_fp_unittest(
2147+
atanhf16_test
2148+
NEED_MPFR
2149+
SUITE
2150+
libc-math-unittests
2151+
SRCS
2152+
atanhf16_test.cpp
2153+
DEPENDS
2154+
libc.src.math.atanhf16
2155+
)
2156+
21462157
add_fp_unittest(
21472158
fmul_test
21482159
NEED_MPFR

0 commit comments

Comments
 (0)