MCPcopy Create free account
hub / github.com/boostorg/json / dec_to_float

Function dec_to_float

include/boost/json/basic_parser_impl.hpp:146–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146inline
147double
148dec_to_float(
149 std::uint64_t m,
150 std::int32_t e,
151 bool neg) noexcept
152{
153 // convert to double explicitly to silence warnings
154 double x = static_cast<double>(m);
155 if(neg)
156 x = -x;
157
158 if(e < -305)
159 {
160 x *= 1e-305 ;
161 e += 305;
162 }
163
164 if(e >= -22 && e < 0)
165 return x / pow10(-e);
166
167 return x * pow10(e);
168}
169
170inline
171bool

Callers 1

parse_numberMethod · 0.85

Calls 1

pow10Function · 0.85

Tested by

no test coverage detected