From 431dc6a6155655647fe26f764bdee34d3a96c860 Mon Sep 17 00:00:00 2001 From: Aleksander Kosarskii Date: Mon, 30 Jan 2023 03:37:59 +0500 Subject: [PATCH] fix : fixed an issue when a variable with a trailing zero was written as an integer --- .gitignore | 1 + cmake-build-debug/Testing/Temporary/LastTest.log | 4 ++-- include/yaml-cpp/emitter.h | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 2f9d10f..bda4cab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build/ /tags /bazel-* +/cmake-build-debug diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log index 51e8311..8c5c7ab 100644 --- a/cmake-build-debug/Testing/Temporary/LastTest.log +++ b/cmake-build-debug/Testing/Temporary/LastTest.log @@ -1,3 +1,3 @@ -Start testing: Jan 30 03:31 +05 +Start testing: Jan 30 03:33 +05 ---------------------------------------------------------- -End testing: Jan 30 03:31 +05 +End testing: Jan 30 03:33 +05 diff --git a/include/yaml-cpp/emitter.h b/include/yaml-cpp/emitter.h index 210b1ec..6cf5c11 100644 --- a/include/yaml-cpp/emitter.h +++ b/include/yaml-cpp/emitter.h @@ -177,7 +177,9 @@ inline Emitter& Emitter::WriteStreamable(T value) { } } - if (!special) { + if ((float)((int) value ) == value ){ + stream << std::fixed << std::setprecision(1) << value; + }else if (!special) { stream << value; } m_stream << stream.str();