From 76f550d9e7e75a8d75d3ea2f03ab3499172daad5 Mon Sep 17 00:00:00 2001 From: jam1garner <8260240+jam1garner@users.noreply.github.com> Date: Wed, 25 Aug 2021 14:01:01 -0400 Subject: [PATCH] ui: Format floats sensibly (#281) * Use general form with scientific notation as fallback (i.e. `{:G}`) --- plugins/builtin/source/content/data_inspector.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/builtin/source/content/data_inspector.cpp b/plugins/builtin/source/content/data_inspector.cpp index e3139ec04..f3e24bbf4 100644 --- a/plugins/builtin/source/content/data_inspector.cpp +++ b/plugins/builtin/source/content/data_inspector.cpp @@ -80,12 +80,12 @@ namespace hex::plugin::builtin { }); hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.float", sizeof(float), [](auto buffer, auto endian, auto style) { - auto value = hex::format("{0:E}", hex::changeEndianess(*reinterpret_cast(buffer.data()), endian)); + auto value = hex::format("{0:G}", hex::changeEndianess(*reinterpret_cast(buffer.data()), endian)); return [value] { ImGui::TextUnformatted(value.c_str()); return value; }; }); hex::ContentRegistry::DataInspector::add("hex.builtin.inspector.double", sizeof(double), [](auto buffer, auto endian, auto style) { - auto value = hex::format("{0:E}", hex::changeEndianess(*reinterpret_cast(buffer.data()), endian)); + auto value = hex::format("{0:G}", hex::changeEndianess(*reinterpret_cast(buffer.data()), endian)); return [value] { ImGui::TextUnformatted(value.c_str()); return value; }; });