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

Function acos

include/half.hpp:3657–3672  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

3655 /// \exception FE_INVALID for signaling NaN or if abs(\a arg) > 1
3656 /// \exception FE_OVERFLOW, ...UNDERFLOW, ...INEXACT according to rounding
3657 inline half acos(half arg)
3658 {
3659 #ifdef HALF_ARITHMETIC_TYPE
3660 return half(detail::binary, detail::float2half<half::round_style>(std::acos(detail::half2float<detail::internal_t>(arg.data_))));
3661 #else
3662 unsigned int abs = arg.data_ & 0x7FFF, sign = arg.data_ >> 15;
3663 if(!abs)
3664 return half(detail::binary, detail::rounded<half::round_style,true>(0x3E48, 0, 1));
3665 if(abs >= 0x3C00)
3666 return half(detail::binary, (abs>0x7C00) ? detail::signal(arg.data_) : (abs>0x3C00) ? detail::invalid() :
3667 sign ? detail::rounded<half::round_style,true>(0x4248, 0, 1) : 0);
3668 std::pair<detail::uint32,detail::uint32> cs = detail::atan2_args(abs);
3669 detail::uint32 m = detail::atan2(cs.second, cs.first, 28);
3670 return half(detail::binary, detail::fixed2half<half::round_style,31,false,true,true>(sign ? (0xC90FDAA2-m) : m, 15, 0, sign));
3671 #endif
3672 }
3673
3674 /// Arc tangent function.
3675 /// This function is exact to rounding for all rounding modes.

Callers

nothing calls this directly

Calls 5

halfClass · 0.85
signalFunction · 0.85
invalidFunction · 0.85
atan2_argsFunction · 0.85
atan2Function · 0.85

Tested by

no test coverage detected