Log10 always returns 0 if the calculation is a finite number. In the below condition, I believe the value should be set to zero only if the calculation is not a finite number. Rather for a finite number return value is getting set as zero.
if(Double.isNaN(calculation) || Double.isFinite(calculation)) {
result.outParamReturnValue = BigDecimal.ZERO;
}