MCPcopy Create free account
hub / github.com/OpenNMT/CTranslate2 / exp2_post

Function exp2_post

include/half_float/half.hpp:1688–1707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1686 /// \exception FE_UNDERFLOW on underflows
1687 /// \exception FE_INEXACT if value had to be rounded or \a I is `true`
1688 template<std::float_round_style R> unsigned int exp2_post(uint32 m, int exp, bool esign, unsigned int sign = 0, unsigned int n = 32)
1689 {
1690 if(esign)
1691 {
1692 exp = -exp - (m!=0);
1693 if(exp < -25)
1694 return underflow<R>(sign);
1695 else if(exp == -25)
1696 return rounded<R,false>(sign, 1, m!=0);
1697 }
1698 else if(exp > 15)
1699 return overflow<R>(sign);
1700 if(!m)
1701 return sign | (((exp+=15)>0) ? (exp<<10) : check_underflow(0x200>>-exp));
1702 m = exp2(m, n);
1703 int s = 0;
1704 if(esign)
1705 m = divide64(0x80000000, m, s);
1706 return fixed2half<R,31,false,false,true>(m, exp+14, sign, s);
1707 }
1708
1709 /// Postprocessing for binary logarithm.
1710 /// \tparam R rounding mode to use

Callers

nothing calls this directly

Calls 3

check_underflowFunction · 0.85
exp2Function · 0.85
divide64Function · 0.85

Tested by

no test coverage detected