Mercurial > minori
changeset 186:6ef31dbb90ca
anime: no unnecessary conversion to floating point
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Wed, 06 Dec 2023 11:47:59 -0500 |
parents | 62e336597bb7 |
children | 9613d72b097e |
files | src/core/anime.cc |
diffstat | 1 files changed, 2 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/anime.cc Tue Dec 05 13:45:23 2023 -0500 +++ b/src/core/anime.cc Wed Dec 06 11:47:59 2023 -0500 @@ -49,12 +49,8 @@ return ""; switch (session.config.anime_list.score_format) { - case ScoreFormat::POINT_10_DECIMAL: { - std::ostringstream out; - out.precision(1); - out << std::fixed << (static_cast<double>(score) / 10); - return std::move(out).str(); - } + case ScoreFormat::POINT_10_DECIMAL: + return std::to_string(score / 10) + "." + std::to_string(score % 10); case ScoreFormat::POINT_10: return std::to_string(score / 10); case ScoreFormat::POINT_5: {