diff --git a/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs b/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs index b1e4cd606..9cd735274 100644 --- a/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs @@ -8,6 +8,7 @@ using Mages.Core; using Flow.Launcher.Plugin.Calculator.ViewModels; using Flow.Launcher.Plugin.Calculator.Views; + namespace Flow.Launcher.Plugin.Calculator { public class Main : IPlugin, IPluginI18n, ISettingProvider @@ -15,7 +16,7 @@ namespace Flow.Launcher.Plugin.Calculator private static readonly Regex RegValidExpressChar = new Regex( @"^(" + @"ceil|floor|exp|pi|e|max|min|det|abs|log|ln|sqrt|" + - @"sin|cos|tan|arcsin|arccos|arctan|" + + @"sin|cos|tan|arcsin|arccos|arctan|rad2deg|deg2rad|" + @"eigval|eigvec|eig|sum|polar|plot|round|sort|real|zeta|" + @"bin2dec|hex2dec|oct2dec|" + @"factorial|sign|isprime|isinfty|" + @@ -45,6 +46,8 @@ namespace Flow.Launcher.Plugin.Calculator { "e", Math.E }, // e is not contained in the default mages engine } }); + MagesEngine.SetFunction("rad2deg", (double rad) => rad * (180.0 / Math.PI)); + MagesEngine.SetFunction("deg2rad", (double x) => x * (Math.PI / 180.0)); } public List Query(Query query) @@ -169,9 +172,9 @@ namespace Flow.Launcher.Plugin.Calculator private bool IsBracketComplete(string query) { - var matchs = RegBrackets.Matches(query); + var matches = RegBrackets.Matches(query); var leftBracketCount = 0; - foreach (Match match in matchs) + foreach (Match match in matches) { if (match.Value == "(" || match.Value == "[") {