From a33f2b53b32dbe9aefb4613bfec0b18d858ed285 Mon Sep 17 00:00:00 2001 From: Stephane Janel Date: Sat, 15 Jun 2024 12:03:17 +0200 Subject: [PATCH] Only log warning when truncating integer part, not decimal part --- CMakeLists.txt | 2 +- src/objects/include/monetaryamount.hpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 89cc32a0..26c5b4ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.15) # cmake does not currently support version suffixes (for dev / rc releases for instance.) # Github actions will detect if version has 'tweak' value (3 '.' in version) # in order to avoid pushing Docker image for versions in development. -project(coincenter VERSION 3.25.0.0 +project(coincenter VERSION 3.24.1 DESCRIPTION "A C++ library centralizing several crypto currencies exchanges REST API into a single all in one tool with a unified interface" LANGUAGES CXX) diff --git a/src/objects/include/monetaryamount.hpp b/src/objects/include/monetaryamount.hpp index 19781483..f8969fde 100644 --- a/src/objects/include/monetaryamount.hpp +++ b/src/objects/include/monetaryamount.hpp @@ -376,12 +376,11 @@ class MonetaryAmount { constexpr int8_t sanitizeIntegralPart(int8_t nbDecs) noexcept { if (_amount >= kMaxAmountFullNDigits) { - if (!std::is_constant_evaluated()) { - log::warn("Truncating last digit of integral part {} which is too big", _amount); - } _amount /= 10; if (nbDecs > 0) { --nbDecs; + } else if (!std::is_constant_evaluated()) { + log::warn("Truncating last digit of integral part {} which is too big", _amount); } } return nbDecs;