{
final int parameterCount = parameters.getParameterCount();
if(parameterCount == 0)
{
return new TypeValuePair(NumberType.GENERIC_NUMBER, ZERO);
}
BigDecimal last = null;
for (int paramIdx = 0; paramIdx < parameterCount; paramIdx++)
{
final Type type = parameters.getType(paramIdx);
final Object value = parameters.getValue(paramIdx);
final NumberSequence sequence = context.getTypeRegistry().convertToNumberSequence(type, value);
while(sequence.hasNext())
{
final BigDecimal next = NumberUtil.getAsBigDecimal(sequence.nextNumber());
if(last == null)
{
last = next;
}
else
{
if(last.compareTo(next) == -1)
{
last = next;
}
}
}
}
if(last == null)
{
throw new EvaluationException(
LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
}
return new TypeValuePair(NumberType.GENERIC_NUMBER, last);
}