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

Function sinh

include/half.hpp:3767–3785  ·  view source on GitHub ↗

Hyperbolic sine. This function is exact to rounding for all rounding modes. See also:** Documentation for [std::sinh](https://en.cppreference.com/w/cpp/numeric/math/sinh). \param arg function argument \return hyperbolic sine 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

3765 /// \exception FE_INVALID for signaling NaN
3766 /// \exception FE_OVERFLOW, ...UNDERFLOW, ...INEXACT according to rounding
3767 inline half sinh(half arg)
3768 {
3769 #ifdef HALF_ARITHMETIC_TYPE
3770 return half(detail::binary, detail::float2half<half::round_style>(std::sinh(detail::half2float<detail::internal_t>(arg.data_))));
3771 #else
3772 int abs = arg.data_ & 0x7FFF, exp;
3773 if(!abs || abs >= 0x7C00)
3774 return (abs>0x7C00) ? half(detail::binary, detail::signal(arg.data_)) : arg;
3775 if(abs <= 0x2900)
3776 return half(detail::binary, detail::rounded<half::round_style,true>(arg.data_, 0, 1));
3777 std::pair<detail::uint32,detail::uint32> mm = detail::hyperbolic_args(abs, exp, (half::round_style==std::round_to_nearest) ? 29 : 27);
3778 detail::uint32 m = mm.first - mm.second;
3779 for(exp+=13; m<0x80000000 && exp; m<<=1,--exp) ;
3780 unsigned int sign = arg.data_ & 0x8000;
3781 if(exp > 29)
3782 return half(detail::binary, detail::overflow<half::round_style>(sign));
3783 return half(detail::binary, detail::fixed2half<half::round_style,31,false,false,true>(m, exp, sign));
3784 #endif
3785 }
3786
3787 /// Hyperbolic cosine.
3788 /// 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