I am using the function String(float floatValue, int numberOfDecimalPlaces) to write the text of a textEditor like this:
it all works great except for when the absolute value of gainDbVal_ is smaller than one, at which point the generated string has many more decimal places. On the other hand, if I do it the classic way:
stream << std::fixed << std::setprecision(2) << gainDbVal_;
std::string s = stream.str();
everything goes as intended and I get two digits after the comma.
Is this an intended behaviour? Am I doing something wrong? Is there a solution to my problem?
Thank you very much