Mercurial > minori
diff src/core/anime.cc @ 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 | 975a3f0965e2 |
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: {