Lines 17-22
Link Here
|
17 |
|
17 |
|
18 |
package org.apache.poi.ss.formula.atp; |
18 |
package org.apache.poi.ss.formula.atp; |
19 |
|
19 |
|
|
|
20 |
import java.math.BigDecimal; |
21 |
import java.math.RoundingMode; |
22 |
|
20 |
import org.apache.poi.ss.formula.OperationEvaluationContext; |
23 |
import org.apache.poi.ss.formula.OperationEvaluationContext; |
21 |
import org.apache.poi.ss.formula.eval.*; |
24 |
import org.apache.poi.ss.formula.eval.*; |
22 |
import org.apache.poi.ss.formula.functions.FreeRefFunction; |
25 |
import org.apache.poi.ss.formula.functions.FreeRefFunction; |
Lines 56-62
Link Here
|
56 |
// Returns #NUM! because the number and the multiple have different signs |
59 |
// Returns #NUM! because the number and the multiple have different signs |
57 |
throw new EvaluationException(ErrorEval.NUM_ERROR); |
60 |
throw new EvaluationException(ErrorEval.NUM_ERROR); |
58 |
} |
61 |
} |
59 |
result = multiple * Math.round( number / multiple ); |
62 |
BigDecimal bdMultiple = BigDecimal.valueOf(multiple); |
|
|
63 |
result = bdMultiple.multiply(BigDecimal.valueOf(number).divide(bdMultiple, 0, RoundingMode.HALF_UP)) |
64 |
.doubleValue(); |
60 |
} |
65 |
} |
61 |
NumericFunction.checkValue(result); |
66 |
NumericFunction.checkValue(result); |
62 |
return new NumberEval(result); |
67 |
return new NumberEval(result); |