From c45e97be72c7ba48b9398a46b59956b5e844c531 Mon Sep 17 00:00:00 2001 From: mlsample Date: Mon, 22 Apr 2024 18:56:31 -0700 Subject: [PATCH] Changed % X.Ylf to %.Yg --- src/Observables/ForceEnergy.cpp | 4 ++-- src/Observables/PotentialEnergy.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Observables/ForceEnergy.cpp b/src/Observables/ForceEnergy.cpp index 2bc05eeb..cc9de16f 100644 --- a/src/Observables/ForceEnergy.cpp +++ b/src/Observables/ForceEnergy.cpp @@ -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); } } diff --git a/src/Observables/PotentialEnergy.cpp b/src/Observables/PotentialEnergy.cpp index a4aefb8d..d9ba7f65 100644 --- a/src/Observables/PotentialEnergy.cpp +++ b/src/Observables/PotentialEnergy.cpp @@ -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 { @@ -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); } }