diff --git a/3rdparty/Boost/boost/math/special_functions/nonfinite_num_facets.hpp b/3rdparty/Boost/boost/math/special_functions/nonfinite_num_facets.hpp index 8ee9170..286d109 100644 --- a/3rdparty/Boost/boost/math/special_functions/nonfinite_num_facets.hpp +++ b/3rdparty/Boost/boost/math/special_functions/nonfinite_num_facets.hpp @@ -99,35 +99,30 @@ namespace boost { if(flags_ & trap_infinity) throw std::ios_base::failure("Infinity"); else if((boost::math::signbit)(val)) - put_num_and_fill(it, iosb, "-", "inf", fill); + put_num_and_fill(it, iosb, "-", "inf", fill, val); else if(iosb.flags() & std::ios_base::showpos) - put_num_and_fill(it, iosb, "+", "inf", fill); + put_num_and_fill(it, iosb, "+", "inf", fill, val); else - put_num_and_fill(it, iosb, "", "inf", fill); + put_num_and_fill(it, iosb, "", "inf", fill, val); break; case FP_NAN: if(flags_ & trap_nan) throw std::ios_base::failure("NaN"); else if((boost::math::signbit)(val)) - put_num_and_fill(it, iosb, "-", "nan", fill); + put_num_and_fill(it, iosb, "-", "nan", fill, val); else if(iosb.flags() & std::ios_base::showpos) - put_num_and_fill(it, iosb, "+", "nan", fill); + put_num_and_fill(it, iosb, "+", "nan", fill, val); else - put_num_and_fill(it, iosb, "", "nan", fill); + put_num_and_fill(it, iosb, "", "nan", fill, val); break; case FP_ZERO: - if(flags_ & signed_zero) { - if((boost::math::signbit)(val)) - put_num_and_fill(it, iosb, "-", "0", fill); - else if(iosb.flags() & std::ios_base::showpos) - put_num_and_fill(it, iosb, "+", "0", fill); - else - put_num_and_fill(it, iosb, "", "0", fill); + if((flags_ & signed_zero) && ((boost::math::signbit)(val))) { + put_num_and_fill(it, iosb, "-", 0, fill, val); + } else { + put_num_and_fill(it, iosb, 0, 0, fill, val); } - else - put_num_and_fill(it, iosb, "", "0", fill); break; default: @@ -137,36 +132,50 @@ namespace boost { } } + template void put_num_and_fill( OutputIterator& it, std::ios_base& iosb, const char* prefix, - const char* body, CharType fill) const + const char* body, CharType fill, ValType val) const { - int width = (int)strlen(prefix) + (int)strlen(body); + int prefix_length = prefix ? (int)std::strlen(prefix) : 0; + int body_length = prefix ? (int)std::strlen(body) : 0; + int width = prefix_length + body_length; std::ios_base::fmtflags adjust = iosb.flags() & std::ios_base::adjustfield; const std::ctype& ct = std::use_facet >(iosb.getloc()); - if(adjust != std::ios_base::internal && adjust != std::ios_base::left) - put_fill(it, iosb, fill, width); + if(body || prefix) + if(adjust != std::ios_base::internal && adjust != std::ios_base::left) + put_fill(it, iosb, fill, width); - while(*prefix) - *it = ct.widen(*(prefix++)); + if(prefix) { + while(*prefix) + *it = ct.widen(*(prefix++)); + iosb.width( iosb.width() - prefix_length ); + width -= prefix_length; + } - if(adjust == std::ios_base::internal) - put_fill(it, iosb, fill, width); + if(body) { + if(adjust == std::ios_base::internal) + put_fill(it, iosb, fill, width); - if(iosb.flags() & std::ios_base::uppercase) { - while(*body) - *it = ct.toupper(ct.widen(*(body++))); + if(iosb.flags() & std::ios_base::uppercase) { + while(*body) + *it = ct.toupper(ct.widen(*(body++))); + } + else { + while(*body) + *it = ct.widen(*(body++)); + } + + if(adjust == std::ios_base::left) + put_fill(it, iosb, fill, width); } else { - while(*body) - *it = ct.widen(*(body++)); + it = std::num_put::do_put( + it, iosb, fill, val); } - - if(adjust == std::ios_base::left) - put_fill(it, iosb, fill, width); } void put_fill(