if (isWholeNumber() && other.isWholeNumber()) else if (isWholeNumber()) prec = other.precision; else if (other.isWholeNumber()) prec = precision; else
if (isWholeNumber() && other.isWholeNumber() && (l < m)) { for (int i = 0; i < d; i++) { if (r.charAt(r.length()-1) == '0') { if (isWholeNumber() && other.isWholeNumber()) prec = Math.max(digits.length(), other.digits.length()); else if (isWholeNumber()) prec = Math.max(other.precision, r.length() - d); else if (other.isWholeNumber()) prec = Math.max(precision, r.length() - d); else
public int asInteger() throws UcumException { if (!isWholeNumber()) throw new UcumException("Unable to represent "+toString()+" as an integer"); if (comparesTo(new Decimal(Integer.MIN_VALUE)) < 0) throw new UcumException("Unable to represent "+toString()+" as a signed 8 byte integer"); if (comparesTo(new Decimal(Integer.MAX_VALUE)) > 0) throw new UcumException("Unable to represent "+toString()+" as a signed 8 byte integer"); return Integer.parseInt(asDecimal()); }
if (isWholeNumber() && other.isWholeNumber()) else if (isWholeNumber()) prec = other.precision; else if (other.isWholeNumber()) prec = precision; else
if (isWholeNumber() && other.isWholeNumber() && (l < m)) { for (int i = 0; i < d; i++) { if (r.charAt(r.length()-1) == '0') { if (isWholeNumber() && other.isWholeNumber()) prec = Math.max(digits.length(), other.digits.length()); else if (isWholeNumber()) prec = Math.max(other.precision, r.length() - d); else if (other.isWholeNumber()) prec = Math.max(precision, r.length() - d); else
public int asInteger() throws UcumException { if (!isWholeNumber()) throw new UcumException("Unable to represent "+toString()+" as an integer"); if (comparesTo(new Decimal(Integer.MIN_VALUE)) < 0) throw new UcumException("Unable to represent "+toString()+" as a signed 8 byte integer"); if (comparesTo(new Decimal(Integer.MAX_VALUE)) > 0) throw new UcumException("Unable to represent "+toString()+" as a signed 8 byte integer"); return Integer.parseInt(asDecimal()); }