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

Function fmod

include/half.hpp:2742–2755  ·  view source on GitHub ↗

Remainder of division. See also:** Documentation for [std::fmod](https://en.cppreference.com/w/cpp/numeric/math/fmod). \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

2740 /// \return remainder of floating-point division.
2741 /// \exception FE_INVALID if \a x is infinite or \a y is 0 or if \a x or \a y is signaling NaN
2742 inline half fmod(half x, half y)
2743 {
2744 unsigned int absx = x.data_ & 0x7FFF, absy = y.data_ & 0x7FFF, sign = x.data_ & 0x8000;
2745 if(absx >= 0x7C00 || absy >= 0x7C00)
2746 return half(detail::binary, (absx>0x7C00 || absy>0x7C00) ? detail::signal(x.data_, y.data_) :
2747 (absx==0x7C00) ? detail::invalid() : x.data_);
2748 if(!absy)
2749 return half(detail::binary, detail::invalid());
2750 if(!absx)
2751 return x;
2752 if(absx == absy)
2753 return half(detail::binary, sign);
2754 return half(detail::binary, sign|detail::mod<false,false>(absx, absy));
2755 }
2756
2757 /// Remainder of division.
2758 /// **See also:** Documentation for [std::remainder](https://en.cppreference.com/w/cpp/numeric/math/remainder).

Callers

nothing calls this directly

Calls 3

halfClass · 0.85
signalFunction · 0.85
invalidFunction · 0.85

Tested by

no test coverage detected