Continued fraction/Arithmetic/G(matrix ng, continued fraction n): Difference between revisions
Continued fraction/Arithmetic/G(matrix ng, continued fraction n) (view source)
Revision as of 17:00, 16 August 2023
, 9 months agoImproved coding.
(New post.) |
m (Improved coding.) |
||
Line 5,021:
public static void main(String[] aArgs) {
List<CFData> cfData = List.of(
new CFData("[1; 5, 2] + 1/2 ", new int[] { 2, 1, 0, 2 }, (CFIterator) new
new CFData("[3; 7] + 1/2 ", new int[] { 2, 1, 0, 2 }, (CFIterator) new
new CFData("[3; 7] divided by 4 ", new int[] { 1, 0, 0, 4 }, (CFIterator) new
new CFData("sqrt(2) ", new int[] { 0, 1, 1, 0 }, (CFIterator) new
new CFData("1 / sqrt(2) ", new int[] { 0, 1, 1, 0 }, (CFIterator) new
new CFData("(1 + sqrt(2)) / 2 ", new int[] { 1, 1, 0, 2 }, (CFIterator) new
new CFData("(1 + 1 / sqrt(2)) / 2", new int[] { 1, 1, 0, 2 }, (CFIterator) new
for ( CFData data : cfData ) {
Line 5,058:
public void ingress(int aN) {
int temp = a; a = a1; a1 = temp + a1 * aN;
}
public int egress() {
final int n = a / b;
int temp = a; a = b; b = temp - b * n;
return n;
}
Line 5,083 ⟶ 5,075:
public int egressDone() {
if ( needsTerm() ) {
a = a1;
b = b1;
}
Line 5,103 ⟶ 5,095:
}
private static class
public
numerator = aNumerator; denominator = aDenominator;
}
Line 5,125 ⟶ 5,117:
}
private static class
public
firstReturn = true;
}
Line 5,147 ⟶ 5,139:
}
private static class
public
firstReturn = true;
secondReturn = true;
|