From e4ea8d2abdeb0627974e9b073ddff6d6883618e9 Mon Sep 17 00:00:00 2001 From: Clint Rutkas Date: Thu, 13 Aug 2020 14:02:38 -0700 Subject: [PATCH] Correcting floating point error (#5949) --- .../launcher/Plugins/Microsoft.Plugin.Calculator/Main.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/Main.cs index 18f18882b0..6a7fe036f8 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/Main.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Runtime.InteropServices; using System.Text.RegularExpressions; using System.Threading; @@ -71,11 +72,13 @@ namespace Microsoft.Plugin.Calculator if (!string.IsNullOrEmpty(result?.ToString())) { + var roundedResult = Math.Round(Convert.ToDecimal(result, CultureInfo.CurrentCulture), 10, MidpointRounding.AwayFromZero); + return new List { new Result { - Title = result.ToString(), + Title = roundedResult.ToString(CultureInfo.CurrentCulture), IcoPath = IconPath, Score = 300, SubTitle = Context.API.GetTranslation("wox_plugin_calculator_copy_number_to_clipboard"),