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

Function remainder

include/half.hpp:2763–2774  ·  view source on GitHub ↗

Remainder of division. See also:** Documentation for [std::remainder](https://en.cppreference.com/w/cpp/numeric/math/remainder). \param x first operand \param y second operand \return remainder of floating-point division. \exception FE_INVALID if \a x is infinite or \a y is 0 or if \a x or \a y is signaling NaN

Source from the content-addressed store, hash-verified

2761 /// \return remainder of floating-point division.
2762 /// \exception FE_INVALID if \a x is infinite or \a y is 0 or if \a x or \a y is signaling NaN
2763 inline half remainder(half x, half y)
2764 {
2765 unsigned int absx = x.data_ & 0x7FFF, absy = y.data_ & 0x7FFF, sign = x.data_ & 0x8000;
2766 if(absx >= 0x7C00 || absy >= 0x7C00)
2767 return half(detail::binary, (absx>0x7C00 || absy>0x7C00) ? detail::signal(x.data_, y.data_) :
2768 (absx==0x7C00) ? detail::invalid() : x.data_);
2769 if(!absy)
2770 return half(detail::binary, detail::invalid());
2771 if(absx == absy)
2772 return half(detail::binary, sign);
2773 return half(detail::binary, sign^detail::mod<false,true>(absx, absy));
2774 }
2775
2776 /// Remainder of division.
2777 /// **See also:** Documentation for [std::remquo](https://en.cppreference.com/w/cpp/numeric/math/remquo).

Callers

nothing calls this directly

Calls 3

halfClass · 0.85
signalFunction · 0.85
invalidFunction · 0.85

Tested by

no test coverage detected