Skip to content

Commit

Permalink
Use stringstream for double formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lpugin committed Oct 8, 2024
1 parent b8b7818 commit 6a13735
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libmei/addons/att.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ std::string Att::StrToStr(std::string str) const

std::string Att::DblToStr(double data) const
{
return StringFormat("%.10g", round(data * 10000.0) / 10000.0);
std::stringstream sstream;
sstream << round(data * 10000.0) / 10000.0;
return sstream.str();
}

std::string Att::IntToStr(int data) const
Expand Down Expand Up @@ -365,7 +367,9 @@ data_KEYSIGNATURE Att::StrToKeysignature(const std::string &value, bool logWarni

std::string Att::MeasurebeatToStr(data_MEASUREBEAT data) const
{
return StringFormat("%dm+%.10g", data.first, round(data.second * 10000.0) / 10000.0);
std::stringstream sstream;
sstream << data.first << "m+" << round(data.second * 10000.0) / 10000.0;
return sstream.str();
}

data_MEASUREBEAT Att::StrToMeasurebeat(std::string value, bool) const
Expand Down

0 comments on commit 6a13735

Please sign in to comment.