Angus Leeming <[EMAIL PROTECTED]> writes:

| Juergen Spitzmueller wrote:
>
>> Angus Leeming wrote:
>>> QString float2qstr(float value, size_t precision)
>>> {
>>> std::ostringstream ss;
>>> ss << setprecision(precision) << value;
>>> return toqstr(ss.str());
>>> }
>> 
>> Since this problem is frontend-independent, I will add an
>> appropriate function to lstrings (correct place, or rather tostr?).
>
| Why not
|         float tostr(float value, int precision = -1)
|         {
|                 std::ostringstream ss;
|                 if (precision < 0)
|                         ss << value;
|                 else
|                         ss << setprecision(precision) << value;
|                 return ss.str();
|         }
>
|         // Ditto for 'double'.
|         double tostr(double value, int precision = -1);

better to get rid of floats/doubles used in ui

-- 
        Lgb

Reply via email to