mirror of
https://github.com/boostorg/json.git
synced 2026-02-20 02:42:21 +00:00
Better decimal to float accuracy
This commit is contained in:
@@ -138,13 +138,14 @@ dec_to_float(
|
||||
std::int32_t e,
|
||||
bool neg) noexcept
|
||||
{
|
||||
auto x =
|
||||
static_cast<double>(m);
|
||||
if(neg)
|
||||
return (-static_cast<
|
||||
double>(m)) *
|
||||
pow10(e);
|
||||
return (static_cast<
|
||||
double>(m)) *
|
||||
pow10(e);
|
||||
x = -x;
|
||||
if(e < -307)
|
||||
return x * 1e-307 *
|
||||
pow10(e+307);
|
||||
return x * pow10(e);
|
||||
}
|
||||
|
||||
inline
|
||||
|
||||
Reference in New Issue
Block a user