Refactoring and clean up 2
This commit is contained in:
+2
-6
@@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace processor
|
namespace processor
|
||||||
@@ -12,7 +9,7 @@ namespace processor
|
|||||||
internal static string RemoveComment(string text)
|
internal static string RemoveComment(string text)
|
||||||
{
|
{
|
||||||
int idx = text.LastIndexOf("#");
|
int idx = text.LastIndexOf("#");
|
||||||
return idx > 0 ? text.Substring(0, idx) : text;
|
return idx > 0 ? text[..idx] : text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -71,7 +68,6 @@ namespace processor
|
|||||||
_ => 0
|
_ => 0
|
||||||
};
|
};
|
||||||
|
|
||||||
double sum;
|
|
||||||
string mantissa = new(new[] { '.', bin[4], bin[5], bin[6], bin[7] });
|
string mantissa = new(new[] { '.', bin[4], bin[5], bin[6], bin[7] });
|
||||||
switch (exp)
|
switch (exp)
|
||||||
{
|
{
|
||||||
@@ -88,7 +84,7 @@ namespace processor
|
|||||||
|
|
||||||
|
|
||||||
string[] parts = mantissa.Split('.');
|
string[] parts = mantissa.Split('.');
|
||||||
sum = Convert.ToInt32(parts[0], 2);
|
double sum = Convert.ToInt32(parts[0], 2);
|
||||||
for (int i = 0; i < parts[1].Length; i++)
|
for (int i = 0; i < parts[1].Length; i++)
|
||||||
sum += int.Parse(parts[1][i].ToString()) / Math.Pow(2, i + 1);
|
sum += int.Parse(parts[1][i].ToString()) / Math.Pow(2, i + 1);
|
||||||
|
|
||||||
|
|||||||
+2
-8
@@ -1,18 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace processor
|
namespace processor
|
||||||
{
|
{
|
||||||
static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
private static void Main()
|
||||||
{
|
{
|
||||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
|
|||||||
Reference in New Issue
Block a user