Skip to content

Commit

Permalink
Changed % X.Ylf to %.Yg
Browse files Browse the repository at this point in the history
  • Loading branch information
mlsample committed Apr 23, 2024
1 parent 7def8c7 commit c45e97b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Observables/ForceEnergy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ std::string ForceEnergy::get_output_string(llint curr_step) {
U /= _config_info->N();

if (_precision == "") {
return Utils::sformat("% 10.6lf", U);
return Utils::sformat("%g", U);
}
else {
return Utils::sformat("% 10." + _precision + "lf", U);
return Utils::sformat("%." + _precision + "g", U);
}
}
8 changes: 4 additions & 4 deletions src/Observables/PotentialEnergy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ std::string PotentialEnergy::get_output_string(llint curr_step) {
number energy = get_potential_energy();

if (_precision == "") {
return Utils::sformat("% 10.6lf", energy);
return Utils::sformat("%g", energy);
}
else {
return Utils::sformat("% 10." + _precision + "lf", energy);
return Utils::sformat("%." + _precision + "g", energy);
}
}
else {
Expand All @@ -52,10 +52,10 @@ std::string PotentialEnergy::get_output_string(llint curr_step) {
for(auto energy_item : energies) {
number contrib = energy_item.second / _config_info->N();
if (_precision == "") {
res = Utils::sformat("%s % 10.6lf", res.c_str(), contrib);
res = Utils::sformat("%s %g", res.c_str(), contrib);
}
else {
res = Utils::sformat("%s % 10." + _precision + "lf", res.c_str(), contrib);
res = Utils::sformat("%s %." + _precision + "g", res.c_str(), contrib);
}
}

Expand Down

0 comments on commit c45e97b

Please sign in to comment.