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

Function exp2_post

include/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,bool I> unsigned int exp2_post(uint32 m, int exp, bool esign, unsigned int sign = 0)
1689 {
1690 int s = 0;
1691 if(esign)
1692 {
1693 if(m > 0x80000000)
1694 {
1695 m = divide64(0x80000000, m, s);
1696 ++exp;
1697 }
1698 if(exp > 25)
1699 return underflow<R>(sign);
1700 else if(exp == 25)
1701 return rounded<R,I>(sign, 1, (m&0x7FFFFFFF)!=0);
1702 exp = -exp;
1703 }
1704 else if(exp > 15)
1705 return overflow<R>(sign);
1706 return fixed2half<R,31,false,false,I>(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 1

divide64Function · 0.85

Tested by

no test coverage detected