fixed bugs
This commit is contained in:
parent
4ebb81c211
commit
c9447cebdf
@ -1 +1 @@
|
|||||||
Subproject commit 7dab069aa6c58ea4a5270e8983663076eb35dbf2
|
Subproject commit 43d38645a527aff10f585a01f62313cbd840014e
|
||||||
@ -83,13 +83,20 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
// expression is being processed by Calculator class that implemented in FusionCalculator Module
|
// expression is being processed by Calculator class that implemented in FusionCalculator Module
|
||||||
double result = Calculator.Calculate(exprStr);
|
double result = Calculator.Calculate(exprStr);
|
||||||
|
|
||||||
|
// incomplete expression with no rezult
|
||||||
if (double.IsNaN(result))
|
if (double.IsNaN(result))
|
||||||
Output.Text = "";
|
Output.Text = "";
|
||||||
// scientific notation with 5-digit precision for big and small numbers
|
else if (Math.Abs(result) is >= 10e-5 and <= 10e15)
|
||||||
else if (result > 10e+15 || result < 10e-5)
|
{
|
||||||
|
// decimal number with 5-digit precision for regular numbers
|
||||||
|
Output.Text = result.ToString("0.#####", CultureInfo.InvariantCulture);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// scientific notation with 5-digit precision for big and small numbers
|
||||||
Output.Text = result.ToString("0.#####E0", CultureInfo.InvariantCulture);
|
Output.Text = result.ToString("0.#####E0", CultureInfo.InvariantCulture);
|
||||||
// decimal number with 5-digit precision for regular numbers
|
}
|
||||||
else Output.Text = result.ToString("0.#####", CultureInfo.InvariantCulture);
|
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user