@@ -178,6 +178,14 @@ struct SinChecked {
178178 }
179179};
180180
181+ struct Sinh {
182+ template <typename T, typename Arg0>
183+ static enable_if_floating_value<Arg0, T> Call (KernelContext*, Arg0 val, Status*) {
184+ static_assert (std::is_same<T, Arg0>::value, " " );
185+ return std::sinh (val);
186+ }
187+ };
188+
181189struct Cos {
182190 template <typename T, typename Arg0>
183191 static enable_if_floating_value<Arg0, T> Call (KernelContext*, Arg0 val, Status*) {
@@ -198,6 +206,14 @@ struct CosChecked {
198206 }
199207};
200208
209+ struct Cosh {
210+ template <typename T, typename Arg0>
211+ static enable_if_floating_value<Arg0, T> Call (KernelContext*, Arg0 val, Status*) {
212+ static_assert (std::is_same<T, Arg0>::value, " " );
213+ return std::cosh (val);
214+ }
215+ };
216+
201217struct Tan {
202218 template <typename T, typename Arg0>
203219 static enable_if_floating_value<Arg0, T> Call (KernelContext*, Arg0 val, Status*) {
@@ -219,6 +235,14 @@ struct TanChecked {
219235 }
220236};
221237
238+ struct Tanh {
239+ template <typename T, typename Arg0>
240+ static enable_if_floating_value<Arg0, T> Call (KernelContext*, Arg0 val, Status*) {
241+ static_assert (std::is_same<T, Arg0>::value, " " );
242+ return std::tanh (val);
243+ }
244+ };
245+
222246struct Asin {
223247 template <typename T, typename Arg0>
224248 static enable_if_floating_value<Arg0, T> Call (KernelContext*, Arg0 val, Status*) {
@@ -242,6 +266,14 @@ struct AsinChecked {
242266 }
243267};
244268
269+ struct Asinh {
270+ template <typename T, typename Arg0>
271+ static enable_if_floating_value<Arg0, T> Call (KernelContext*, Arg0 val, Status*) {
272+ static_assert (std::is_same<T, Arg0>::value, " " );
273+ return std::asinh (val);
274+ }
275+ };
276+
245277struct Acos {
246278 template <typename T, typename Arg0>
247279 static enable_if_floating_value<Arg0, T> Call (KernelContext*, Arg0 val, Status*) {
@@ -265,6 +297,29 @@ struct AcosChecked {
265297 }
266298};
267299
300+ struct Acosh {
301+ template <typename T, typename Arg0>
302+ static enable_if_floating_value<Arg0, T> Call (KernelContext*, Arg0 val, Status*) {
303+ static_assert (std::is_same<T, Arg0>::value, " " );
304+ if (ARROW_PREDICT_FALSE (val < 1.0 )) {
305+ return std::numeric_limits<T>::quiet_NaN ();
306+ }
307+ return std::acosh (val);
308+ }
309+ };
310+
311+ struct AcoshChecked {
312+ template <typename T, typename Arg0>
313+ static enable_if_floating_value<Arg0, T> Call (KernelContext*, Arg0 val, Status* st) {
314+ static_assert (std::is_same<T, Arg0>::value, " " );
315+ if (ARROW_PREDICT_FALSE (val < 1.0 )) {
316+ *st = Status::Invalid (" domain error" );
317+ return val;
318+ }
319+ return std::acosh (val);
320+ }
321+ };
322+
268323struct Atan {
269324 template <typename T, typename Arg0>
270325 static enable_if_floating_value<Arg0, T> Call (KernelContext*, Arg0 val, Status*) {
@@ -273,6 +328,35 @@ struct Atan {
273328 }
274329};
275330
331+ struct Atanh {
332+ template <typename T, typename Arg0>
333+ static enable_if_floating_value<Arg0, T> Call (KernelContext*, Arg0 val, Status*) {
334+ static_assert (std::is_same<T, Arg0>::value, " " );
335+ if (ARROW_PREDICT_FALSE ((val < -1.0 || val > 1.0 ))) {
336+ // N.B. This predicate does *not* match the predicate in AtanhChecked. In
337+ // GH-44630 it was decided that the checked version should error when asked
338+ // for +/- 1 as an input and the unchecked version should return +/- oo
339+ return std::numeric_limits<T>::quiet_NaN ();
340+ }
341+ return std::atanh (val);
342+ }
343+ };
344+
345+ struct AtanhChecked {
346+ template <typename T, typename Arg0>
347+ static enable_if_floating_value<Arg0, T> Call (KernelContext*, Arg0 val, Status* st) {
348+ static_assert (std::is_same<T, Arg0>::value, " " );
349+ if (ARROW_PREDICT_FALSE ((val <= -1.0 || val >= 1.0 ))) {
350+ // N.B. This predicate does *not* match the predicate in Atanh. In GH-44630 it was
351+ // decided that the checked version should error when asked for +/- 1 as an input
352+ // and the unchecked version should return +/- oo
353+ *st = Status::Invalid (" domain error" );
354+ return val;
355+ }
356+ return std::atanh (val);
357+ }
358+ };
359+
276360struct Atan2 {
277361 template <typename T, typename Arg0, typename Arg1>
278362 static enable_if_floating_value<Arg0, T> Call (KernelContext*, Arg0 y, Arg1 x, Status*) {
@@ -1178,6 +1262,8 @@ const FunctionDoc sin_checked_doc{"Compute the sine",
11781262 " to return NaN instead, see \" sin\" ." ),
11791263 {" x" }};
11801264
1265+ const FunctionDoc sinh_doc{" Compute the hyperbolic sine" , (" " ), {" x" }};
1266+
11811267const FunctionDoc cos_doc{" Compute the cosine" ,
11821268 (" NaN is returned for invalid input values;\n "
11831269 " to raise an error instead, see \" cos_checked\" ." ),
@@ -1188,6 +1274,8 @@ const FunctionDoc cos_checked_doc{"Compute the cosine",
11881274 " to return NaN instead, see \" cos\" ." ),
11891275 {" x" }};
11901276
1277+ const FunctionDoc cosh_doc{" Compute the hyperbolic cosine" , (" " ), {" x" }};
1278+
11911279const FunctionDoc tan_doc{" Compute the tangent" ,
11921280 (" NaN is returned for invalid input values;\n "
11931281 " to raise an error instead, see \" tan_checked\" ." ),
@@ -1198,6 +1286,8 @@ const FunctionDoc tan_checked_doc{"Compute the tangent",
11981286 " to return NaN instead, see \" tan\" ." ),
11991287 {" x" }};
12001288
1289+ const FunctionDoc tanh_doc{" Compute the hyperbolic tangent" , (" " ), {" x" }};
1290+
12011291const FunctionDoc asin_doc{" Compute the inverse sine" ,
12021292 (" NaN is returned for invalid input values;\n "
12031293 " to raise an error instead, see \" asin_checked\" ." ),
@@ -1208,6 +1298,8 @@ const FunctionDoc asin_checked_doc{"Compute the inverse sine",
12081298 " to return NaN instead, see \" asin\" ." ),
12091299 {" x" }};
12101300
1301+ const FunctionDoc asinh_doc{" Compute the inverse hyperbolic sine" , (" " ), {" x" }};
1302+
12111303const FunctionDoc acos_doc{" Compute the inverse cosine" ,
12121304 (" NaN is returned for invalid input values;\n "
12131305 " to raise an error instead, see \" acos_checked\" ." ),
@@ -1218,6 +1310,16 @@ const FunctionDoc acos_checked_doc{"Compute the inverse cosine",
12181310 " to return NaN instead, see \" acos\" ." ),
12191311 {" x" }};
12201312
1313+ const FunctionDoc acosh_doc{" Compute the inverse hyperbolic cosine" ,
1314+ (" NaN is returned for input values < 1.0;\n "
1315+ " to raise an error instead, see \" acosh_checked\" ." ),
1316+ {" x" }};
1317+
1318+ const FunctionDoc acosh_checked_doc{" Compute the inverse hyperbolic cosine" ,
1319+ (" Input values < 1.0 raise an error;\n "
1320+ " to return NaN instead, see \" acosh\" ." ),
1321+ {" x" }};
1322+
12211323const FunctionDoc atan_doc{" Compute the inverse tangent of x" ,
12221324 (" The return value is in the range [-pi/2, pi/2];\n "
12231325 " for a full return range [-pi, pi], see \" atan2\" ." ),
@@ -1227,6 +1329,17 @@ const FunctionDoc atan2_doc{"Compute the inverse tangent of y/x",
12271329 (" The return value is in the range [-pi, pi]." ),
12281330 {" y" , " x" }};
12291331
1332+ const FunctionDoc atanh_doc{" Compute the inverse hyperbolic tangent" ,
1333+ (" NaN is returned for input values x with |x| > 1.\n "
1334+ " At x = +/- 1, returns +/- infinity.\n "
1335+ " To raise an error instead, see \" atanh_checked\" ." ),
1336+ {" x" }};
1337+
1338+ const FunctionDoc atanh_checked_doc{" Compute the inverse hyperbolic tangent" ,
1339+ (" Input values x with |x| >= 1.0 raise an error\n "
1340+ " to return NaN instead, see \" atanh\" ." ),
1341+ {" x" }};
1342+
12301343const FunctionDoc ln_doc{
12311344 " Compute natural logarithm" ,
12321345 (" Non-positive values return -inf or NaN. Null values return null.\n "
@@ -1691,40 +1804,66 @@ void RegisterScalarArithmetic(FunctionRegistry* registry) {
16911804 " sin_checked" , sin_checked_doc);
16921805 DCHECK_OK (registry->AddFunction (std::move (sin_checked)));
16931806
1807+ auto sinh = MakeUnaryArithmeticFunctionFloatingPoint<Sinh>(" sinh" , sinh_doc);
1808+ DCHECK_OK (registry->AddFunction (std::move (sinh)));
1809+
16941810 auto cos = MakeUnaryArithmeticFunctionFloatingPoint<Cos>(" cos" , cos_doc);
16951811 DCHECK_OK (registry->AddFunction (std::move (cos)));
16961812
16971813 auto cos_checked = MakeUnaryArithmeticFunctionFloatingPointNotNull<CosChecked>(
16981814 " cos_checked" , cos_checked_doc);
16991815 DCHECK_OK (registry->AddFunction (std::move (cos_checked)));
17001816
1817+ auto cosh = MakeUnaryArithmeticFunctionFloatingPoint<Cosh>(" cosh" , cosh_doc);
1818+ DCHECK_OK (registry->AddFunction (std::move (cosh)));
1819+
17011820 auto tan = MakeUnaryArithmeticFunctionFloatingPoint<Tan>(" tan" , tan_doc);
17021821 DCHECK_OK (registry->AddFunction (std::move (tan)));
17031822
17041823 auto tan_checked = MakeUnaryArithmeticFunctionFloatingPointNotNull<TanChecked>(
17051824 " tan_checked" , tan_checked_doc);
17061825 DCHECK_OK (registry->AddFunction (std::move (tan_checked)));
17071826
1827+ auto tanh = MakeUnaryArithmeticFunctionFloatingPoint<Tanh>(" tanh" , tanh_doc);
1828+ DCHECK_OK (registry->AddFunction (std::move (tanh)));
1829+
17081830 auto asin = MakeUnaryArithmeticFunctionFloatingPoint<Asin>(" asin" , asin_doc);
17091831 DCHECK_OK (registry->AddFunction (std::move (asin)));
17101832
17111833 auto asin_checked = MakeUnaryArithmeticFunctionFloatingPointNotNull<AsinChecked>(
17121834 " asin_checked" , asin_checked_doc);
17131835 DCHECK_OK (registry->AddFunction (std::move (asin_checked)));
17141836
1837+ auto asinh = MakeUnaryArithmeticFunctionFloatingPoint<Asinh>(" asinh" , asinh_doc);
1838+ DCHECK_OK (registry->AddFunction (std::move (asinh)));
1839+
17151840 auto acos = MakeUnaryArithmeticFunctionFloatingPoint<Acos>(" acos" , acos_doc);
17161841 DCHECK_OK (registry->AddFunction (std::move (acos)));
17171842
17181843 auto acos_checked = MakeUnaryArithmeticFunctionFloatingPointNotNull<AcosChecked>(
17191844 " acos_checked" , acos_checked_doc);
17201845 DCHECK_OK (registry->AddFunction (std::move (acos_checked)));
17211846
1847+ auto acosh = MakeUnaryArithmeticFunctionFloatingPoint<Acosh>(" acosh" , acosh_doc);
1848+ DCHECK_OK (registry->AddFunction (std::move (acosh)));
1849+
1850+ auto acosh_checked = MakeUnaryArithmeticFunctionFloatingPointNotNull<AcoshChecked>(
1851+ " acosh_checked" , acosh_checked_doc);
1852+ DCHECK_OK (registry->AddFunction (std::move (acosh_checked)));
1853+
17221854 auto atan = MakeUnaryArithmeticFunctionFloatingPoint<Atan>(" atan" , atan_doc);
17231855 DCHECK_OK (registry->AddFunction (std::move (atan)));
17241856
17251857 auto atan2 = MakeArithmeticFunctionFloatingPoint<Atan2>(" atan2" , atan2_doc);
17261858 DCHECK_OK (registry->AddFunction (std::move (atan2)));
17271859
1860+ auto atanh = MakeUnaryArithmeticFunctionFloatingPoint<Atanh>(" atanh" , atanh_doc);
1861+ DCHECK_OK (registry->AddFunction (std::move (atanh)));
1862+
1863+ auto atanh_checked = MakeUnaryArithmeticFunctionFloatingPointNotNull<AtanhChecked>(
1864+ " atanh_checked" , atanh_checked_doc);
1865+ DCHECK_OK (registry->AddFunction (std::move (atanh_checked)));
1866+
17281867 // ----------------------------------------------------------------------
17291868 // Logarithms
17301869 auto ln = MakeUnaryArithmeticFunctionFloatingPoint<LogNatural>(" ln" , ln_doc);
0 commit comments