public String asDecimal() { String result = digits; if (decimal != digits.length()) if (decimal < 0) result = "0."+stringMultiply('0', 0-decimal)+digits; else if (decimal < result.length()) if (decimal == 0) result = "0."+result; else result = insert(".", result, decimal); else result = result + stringMultiply('0', decimal - result.length()); if (negative && !allZeros(result, 0)) result = "-" + result; return result; }
public String asScientific() { String result = digits; boolean zero = allZeros(result, 0); if (zero) { if (precision < 2) result = "0e0"; else result = "0."+stringMultiply('0', precision-1)+"e0"; } else { if (digits.length() > 1) result = insert(".", result, 1); result = result + 'e'+Integer.toString(decimal - 1); } if (negative && !zero) result = '-' + result; return result; }
throw new Error("Unhandled"); else if (max < s3.length()) s3 = insert(".", s3, max); else throw new Error("Unhandled");
throw new Error("Unhandled"); else if (max < s3.length()) s3 = insert(".", s3, max); else throw new Error("Unhandled");
for (int j = s1.length() - 1; j >= 0; j--) { t = c + (dig(s1.charAt(j)) * dig(s2.charAt(i))); s[i] = insert(String.valueOf(cdig(t % 10)), s[i], 0); c = t / 10; s[i] = insert(String.valueOf(cdig(t % 10)), s[i], 0); c = t / 10; for (int j = 0; j < s.length; j++) c = c + dig(s[j].charAt(i)); res = insert(String.valueOf(cdig(c %10)), res, 0); c = c / 10;
public String asScientific() { String result = digits; boolean zero = allZeros(result, 0); if (zero) { if (precision < 2) result = "0e0"; else result = "0."+stringMultiply('0', precision-1)+"e0"; } else { if (digits.length() > 1) result = insert(".", result, 1); result = result + 'e'+Integer.toString(decimal - 1); } if (negative && !zero) result = '-' + result; return result; }
public String asDecimal() { String result = digits; if (decimal != digits.length()) if (decimal < 0) result = "0."+stringMultiply('0', 0-decimal)+digits; else if (decimal < result.length()) if (decimal == 0) result = "0."+result; else result = insert(".", result, decimal); else result = result + stringMultiply('0', decimal - result.length()); if (negative && !allZeros(result, 0)) result = "-" + result; return result; }
throw new Error("Unhandled"); else if (max < s3.length()) s3 = insert(".", s3, max); else throw new Error("Unhandled");
throw new Error("Unhandled"); else if (max < s3.length()) s3 = insert(".", s3, max); else throw new Error("Unhandled");
for (int j = s1.length() - 1; j >= 0; j--) { t = c + (dig(s1.charAt(j)) * dig(s2.charAt(i))); s[i] = insert(String.valueOf(cdig(t % 10)), s[i], 0); c = t / 10; s[i] = insert(String.valueOf(cdig(t % 10)), s[i], 0); c = t / 10; for (int j = 0; j < s.length; j++) c = c + dig(s[j].charAt(i)); res = insert(String.valueOf(cdig(c %10)), res, 0); c = c / 10;