Compare commits

6 Commits
3 changed files with 5028 additions and 9 deletions
+22 -1
View File
@@ -1,3 +1,24 @@
# 159.341_A3_ImprecisionFinder # 159.341_A3_ImprecisionFinder
Quick program to find imprecision in the data set Quick program to find imprecision in the generated data set
Usage:
The full file path when prompted (shift+right click on the file -> 'Copy as Path')
Output is saved as imprecision.txt, where the exe is run from.
See [Releases](/BrychanD/159.341_A3_ImprecisionFinder/releases) for a compiled version
The Sample Data folder contains output data from the sequential run
```
Sample output:
7 dp 4 dp (.000001 .000005)
3 dp 3 dp (.000397 .000702)
3 dp 3 dp (.000771 .000736)
7 dp 7 dp (.000000 .000000)
4 dp 4 dp (.000496 .000622)
match match (.000000 .000000)
```
File diff suppressed because it is too large Load Diff
+6 -8
View File
@@ -52,10 +52,9 @@ namespace TextImprecision
{ {
decimalPos1 = i; decimalPos1 = i;
} }
if (strDbl1[i < strDbl1.Length ? i : strDbl1.Length-1] != strDbl3[i < strDbl3.Length ? i : strDbl3.Length - 1]) if (nonMatchIndex1 == -1 && strDbl1[i < strDbl1.Length ? i : strDbl1.Length-1] != strDbl3[i < strDbl3.Length ? i : strDbl3.Length - 1] )
{ {
nonMatchIndex1 = i; nonMatchIndex1 = i;
break;
} }
} }
@@ -66,10 +65,9 @@ namespace TextImprecision
{ {
decimalPos2 = i; decimalPos2 = i;
} }
if (strDbl2[i < strDbl2.Length ? i : strDbl2.Length - 1] != strDbl4[i < strDbl4.Length ? i : strDbl4.Length - 1]) if (nonMatchIndex2 == -1 && strDbl2[i < strDbl2.Length ? i : strDbl2.Length - 1] != strDbl4[i < strDbl4.Length ? i : strDbl4.Length - 1])
{ {
nonMatchIndex2 = i; nonMatchIndex2 = i;
break;
} }
} }
@@ -78,11 +76,11 @@ namespace TextImprecision
{ {
if (decimalPos1 > -1) if (decimalPos1 > -1)
{ {
output.Write("{0} dp", nonMatchIndex1 - decimalPos1, strDbl1.Length < strDbl3.Length ? strDbl1.Length : strDbl3.Length); output.Write("{0} dp", nonMatchIndex1 - decimalPos1 -1, strDbl1.Length < strDbl3.Length ? strDbl1.Length : strDbl3.Length);
} }
else else
{ {
output.Write("{0} sf", nonMatchIndex1); output.Write("{0} sf", decimalPos1);
} }
} }
@@ -95,11 +93,11 @@ namespace TextImprecision
{ {
if (decimalPos2 > -1) if (decimalPos2 > -1)
{ {
output.Write("{0} dp", nonMatchIndex2 - decimalPos2, strDbl2.Length < strDbl4.Length ? strDbl2.Length : strDbl4.Length); output.Write("{0} dp", nonMatchIndex2 - decimalPos2 -1, strDbl2.Length < strDbl4.Length ? strDbl2.Length : strDbl4.Length);
} }
else else
{ {
output.Write("{0} sf", nonMatchIndex2); output.Write("{0} sf", decimalPos2);
} }
} }