if (type2.isLessThan(Type.BIGINTEGER)) throw new InternalReasonerException("Cannot promote to anything less than BigInteger"); final Type type1 = findType(arg); _decimalArgs[position] = new BigDecimal((BigInteger) arg, 0, MathContext.DECIMAL128); else if (type1.isLessThan(Type.BIGINTEGER)) _decimalArgs[position] = new BigDecimal(arg.longValue(), MathContext.DECIMAL128); else _bigIntArgs[position] = (BigInteger) arg; else if (type1.isLessThan(Type.BIGINTEGER)) _bigIntArgs[position] = new BigDecimal(arg.longValue(), MathContext.DECIMAL128).toBigInteger(); else
if (type2.isLessThan(Type.BIGINTEGER)) throw new InternalReasonerException("Cannot promote to anything less than BigInteger"); final Type type1 = findType(arg); _decimalArgs[position] = new BigDecimal((BigInteger) arg, 0, MathContext.DECIMAL128); else if (type1.isLessThan(Type.BIGINTEGER)) _decimalArgs[position] = new BigDecimal(arg.longValue(), MathContext.DECIMAL128); else _bigIntArgs[position] = (BigInteger) arg; else if (type1.isLessThan(Type.BIGINTEGER)) _bigIntArgs[position] = new BigDecimal(arg.longValue(), MathContext.DECIMAL128).toBigInteger(); else
/** * Takes an array of numeric values and converts all of them into the same _type, with 'minType' defining the minimum common _type. type become The common * type everything was converted to. */ private void promote(final Type minType, final Number... nums) { Type largest = findHighestType(nums); if (largest.isLessThan(minType)) largest = minType; prepArray(largest, nums.length); for (int i = 0; i < nums.length; i++) promote(nums[i], i, largest); _type = largest; }
/** * Return the highest _type seen in an array of Numbers. */ private static Type findHighestType(final Number[] nums) { Type largest = Type.BYTE; for (final Number num : nums) { final Type type = findType(num); if (largest.isLessThan(type)) largest = type; } return largest; }
/** * Return the highest _type seen in an array of Numbers. */ private static Type findHighestType(final Number[] nums) { Type largest = Type.BYTE; for (final Number num : nums) { final Type type = findType(num); if (largest.isLessThan(type)) largest = type; } return largest; }
/** * Takes an array of numeric values and converts all of them into the same _type, with 'minType' defining the minimum common _type. type become The common * type everything was converted to. */ private void promote(final Type minType, final Number... nums) { Type largest = findHighestType(nums); if (largest.isLessThan(minType)) largest = minType; prepArray(largest, nums.length); for (int i = 0; i < nums.length; i++) promote(nums[i], i, largest); _type = largest; }