+static int perform_decimal(int *a, int *b, int *output)
+{
+ int p10;
+
+ /*
+ * Add a decimal digit to the front of a number;
+ * fail if it's not an integer.
+ * So, 1 --> 0.1, 15 --> 0.15,
+ * or, rather, 1 --> 1/10, 15 --> 15/100,
+ * x --> x / (smallest power of 10 > than x)
+ *
+ */
+ if (a[1] != 1) return FALSE;
+
+ if (!max_p10(a[0], &p10)) return FALSE;
+
+ OUT(output, a[0], p10);
+ return TRUE;
+}
+
+static int perform_recur(int *a, int *b, int *output)
+{
+ int p10, tn, bn;
+
+ /*
+ * This converts a number like .4 to .44444..., or .45 to .45454...
+ * The input number must be -1 < a < 1.
+ *
+ * Calculate the smallest power of 10 that divides the denominator exactly,
+ * returning if no such power of 10 exists. Then multiply the numerator
+ * up accordingly, and the new denominator becomes that power of 10 - 1.
+ */
+ if (abs(a[0]) >= abs(a[1])) return FALSE; /* -1 < a < 1 */
+
+ p10 = 10;
+ while (p10 <= (INT_MAX/10)) {
+ if ((a[1] <= p10) && (p10 % a[1]) == 0) goto found;
+ p10 *= 10;
+ }
+ return FALSE;
+found:
+ tn = a[0] * (p10 / a[1]);
+ bn = p10 - 1;
+
+ OUT(output, tn, bn);
+ return TRUE;
+}
+
+static int perform_root(int *a, int *b, int *output)
+{
+ /*
+ * A root B is: 1 iff a == 0
+ * B ^ (1/A) otherwise
+ */
+ int ainv[2], res;
+
+ if (a[0] == 0) {
+ OUT(output, 1, 1);
+ return TRUE;
+ }
+
+ OUT(ainv, a[1], a[0]);
+ res = perform_exp(b, ainv, output);
+ return res;
+}
+