MCPcopy Create free account
hub / github.com/apache/singa / cosh

Function cosh

include/half.hpp:3795–3812  ·  view source on GitHub ↗

Hyperbolic cosine. This function is exact to rounding for all rounding modes. See also:** Documentation for [std::cosh](https://en.cppreference.com/w/cpp/numeric/math/cosh). \param arg function argument \return hyperbolic cosine value of \a arg \exception FE_INVALID for signaling NaN \exception FE_OVERFLOW, ...UNDERFLOW, ...INEXACT according to rounding

Source from the content-addressed store, hash-verified

3793 /// \exception FE_INVALID for signaling NaN
3794 /// \exception FE_OVERFLOW, ...UNDERFLOW, ...INEXACT according to rounding
3795 inline half cosh(half arg)
3796 {
3797 #ifdef HALF_ARITHMETIC_TYPE
3798 return half(detail::binary, detail::float2half<half::round_style>(std::cosh(detail::half2float<detail::internal_t>(arg.data_))));
3799 #else
3800 int abs = arg.data_ & 0x7FFF, exp;
3801 if(!abs)
3802 return half(detail::binary, 0x3C00);
3803 if(abs >= 0x7C00)
3804 return half(detail::binary, (abs>0x7C00) ? detail::signal(arg.data_) : 0x7C00);
3805 std::pair<detail::uint32,detail::uint32> mm = detail::hyperbolic_args(abs, exp, (half::round_style==std::round_to_nearest) ? 23 : 26);
3806 detail::uint32 m = mm.first + mm.second, i = (~m&0xFFFFFFFF) >> 31;
3807 m = (m>>i) | (m&i) | 0x80000000;
3808 if((exp+=13+i) > 29)
3809 return half(detail::binary, detail::overflow<half::round_style>());
3810 return half(detail::binary, detail::fixed2half<half::round_style,31,false,false,true>(m, exp));
3811 #endif
3812 }
3813
3814 /// Hyperbolic tangent.
3815 /// This function is exact to rounding for all rounding modes.

Callers

nothing calls this directly

Calls 3

halfClass · 0.85
signalFunction · 0.85
hyperbolic_argsFunction · 0.85

Tested by

no test coverage detected