Skip to content

Commit

Permalink
Merge pull request #3818 from rism-digital/develop-decimal-formatting
Browse files Browse the repository at this point in the history
Change decimal formatting
  • Loading branch information
ahankinson authored Oct 10, 2024
2 parents 355d15e + 6a13735 commit 528bdb9
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("%f", data);
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+%.4f", data.first, data.second);
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 528bdb9

Please sign in to comment.