src/libtsduck/base/tsUString.cpp
ts::UString ts::UString::Float(double value, size_type width, size_type precision, bool force_sign)
{
    // Slightly oversized buffer.
    char valueStr[10 + std::numeric_limits<double>::digits - std::numeric_limits<double>::min_exponent];
    if (force_sign) {
        std::snprintf(valueStr, sizeof(valueStr), "%+*.*f", int(width), int(precision), value);
    }
    else {
        std::snprintf(valueStr, sizeof(valueStr), "%*.*f", int(width), int(precision), value);
    }
    return FromUTF8(valueStr);
}
//----------------------------------------------------------------------------
// Format a string containing a floating point value.
//----------------------------------------------------------------------------
Format a string containing a floating point value.
Format a string containing a floating point value .
ts::UString ts::UString::Float(double value, size_type width, size_type precision, bool force_sign)
{
    char valueStr[10 + std::numeric_limits<double>::digits - std::numeric_limits<double>::min_exponent];
    if (force_sign) {
        std::snprintf(valueStr, sizeof(valueStr), "%+*.*f", int(width), int(precision), value);
    }
    else {
        std::snprintf(valueStr, sizeof(valueStr), "%*.*f", int(width), int(precision), value);
    }
    return FromUTF8(valueStr);
}
ts :: UString ts :: UString :: Float ( double value , size_type width , size_type precision , bool force_sign ) { char valueStr [ 10 + std :: numeric_limits < double > :: digits - std :: numeric_limits < double > :: min_exponent ] ; if ( force_sign ) { std :: snprintf ( valueStr , sizeof ( valueStr ) , " " , int ( width ) , int ( precision ) , value ) ; } else { std :: snprintf ( valueStr , sizeof ( valueStr ) , " " , int ( width ) , int ( precision ) , value ) ; } return FromUTF8 ( valueStr ) ; }
Format a string containing a floating point value.
Format a string containing a floating point value .
// Slightly oversized buffer.