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

Function asin

include/half.hpp:3628–3647  ·  view source on GitHub ↗

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

3626 /// \exception FE_INVALID for signaling NaN or if abs(\a arg) > 1
3627 /// \exception FE_OVERFLOW, ...UNDERFLOW, ...INEXACT according to rounding
3628 inline half asin(half arg)
3629 {
3630 #ifdef HALF_ARITHMETIC_TYPE
3631 return half(detail::binary, detail::float2half<half::round_style>(std::asin(detail::half2float<detail::internal_t>(arg.data_))));
3632 #else
3633 unsigned int abs = arg.data_ & 0x7FFF, sign = arg.data_ & 0x8000;
3634 if(!abs)
3635 return arg;
3636 if(abs >= 0x3C00)
3637 return half(detail::binary, (abs>0x7C00) ? detail::signal(arg.data_) : (abs>0x3C00) ? detail::invalid() :
3638 detail::rounded<half::round_style,true>(sign|0x3E48, 0, 1));
3639 if(abs < 0x2900)
3640 return half(detail::binary, detail::rounded<half::round_style,true>(arg.data_, 0, 1));
3641 if(half::round_style != std::round_to_nearest && (abs == 0x2B44 || abs == 0x2DC3))
3642 return half(detail::binary, detail::rounded<half::round_style,true>(arg.data_+1, 1, 1));
3643 std::pair<detail::uint32,detail::uint32> sc = detail::atan2_args(abs);
3644 detail::uint32 m = detail::atan2(sc.first, sc.second, (half::round_style==std::round_to_nearest) ? 27 : 26);
3645 return half(detail::binary, detail::fixed2half<half::round_style,30,false,true,true>(m, 14, sign));
3646 #endif
3647 }
3648
3649 /// Arc cosine function.
3650 /// 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