Made DP counting more logical (now reports the last correct figure, instead of the first incorrect)
This commit is contained in:
parent
53c5f8a968
commit
ae585a7449
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user