mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 01:08:18 +08:00
[PTRun][Calculator]Add support for log2 and log10 (#24137)
* Add support for log2 and log10 in run * Remove test case as it did not make much sense
This commit is contained in:
parent
c819b287f3
commit
3828ac6ecf
@ -74,6 +74,8 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
new object[] { "e*2", 5.43656365691809M },
|
||||
new object[] { "ln(3)", 1.09861228866810M },
|
||||
new object[] { "log(3)", 0.47712125471966M },
|
||||
new object[] { "log2(3)", 1.58496250072116M },
|
||||
new object[] { "log10(3)", 0.47712125471966M },
|
||||
new object[] { "ln(e)", 1M },
|
||||
new object[] { "cosh(0)", 1M },
|
||||
};
|
||||
@ -166,6 +168,10 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
[DataTestMethod]
|
||||
[DataRow("log(3)", true)]
|
||||
[DataRow("ln(3)", true)]
|
||||
[DataRow("log2(3)", true)]
|
||||
[DataRow("log10(3)", true)]
|
||||
[DataRow("log2", false)]
|
||||
[DataRow("log10", false)]
|
||||
[DataRow("log", false)]
|
||||
[DataRow("ln", false)]
|
||||
[DataRow("ceil(2 * (pi ^ 2))", true)]
|
||||
|
@ -12,7 +12,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
|
||||
private static readonly Regex RegValidExpressChar = new Regex(
|
||||
@"^(" +
|
||||
@"%|" +
|
||||
@"ceil\s*\(|floor\s*\(|exp\s*\(|max\s*\(|min\s*\(|abs\s*\(|log\s*\(|ln\s*\(|sqrt\s*\(|pow\s*\(|" +
|
||||
@"ceil\s*\(|floor\s*\(|exp\s*\(|max\s*\(|min\s*\(|abs\s*\(|log(?:2|10)?\s*\(|ln\s*\(|sqrt\s*\(|pow\s*\(|" +
|
||||
@"factorial\s*\(|sign\s*\(|round\s*\(|rand\s*\(|" +
|
||||
@"sin\s*\(|cos\s*\(|tan\s*\(|arcsin\s*\(|arccos\s*\(|arctan\s*\(|" +
|
||||
@"sinh\s*\(|cosh\s*\(|tanh\s*\(|arsinh\s*\(|arcosh\s*\(|artanh\s*\(|" +
|
||||
|
Loading…
Reference in New Issue
Block a user