Compare commits

...

4 Commits

3 changed files with 5008 additions and 8 deletions

View File

@ -11,6 +11,8 @@ Output is saved as imprecision.txt, where the exe is run from.
See [Releases](/BrychanD/159.341_A3_ImprecisionFinder/releases) for a compiled version 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: Sample output:
7 dp 4 dp (.000001 .000005) 7 dp 4 dp (.000001 .000005)

File diff suppressed because it is too large Load Diff

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);
} }
} }