Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change decimal formatting #3818

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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