]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/spirit/home/karma/numeric/detail/real_utils.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / spirit / home / karma / numeric / detail / real_utils.hpp
index 526985d280521e32fb4ef2797acaa2cab5a6635e..84ea67dd4b593554d268c7471b023c07bd5b1b59 100644 (file)
@@ -105,7 +105,13 @@ namespace boost { namespace spirit { namespace karma
                     if (exp != -dim)
                         ++exp;
                     dim = static_cast<U>(-exp);
-                    n *= spirit::traits::pow10<U>(exp);
+                    // detect and handle denormalized numbers to prevent overflow in pow10
+                    if (exp > std::numeric_limits<U>::max_exponent10)
+                    {
+                        n *= spirit::traits::pow10<U>(std::numeric_limits<U>::max_exponent10);
+                        n *= spirit::traits::pow10<U>(exp - std::numeric_limits<U>::max_exponent10);
+                    } else
+                        n *= spirit::traits::pow10<U>(exp);
                 }
             }