Commit 8952991c authored by Robert Zenz's avatar Robert Zenz

#58 Setting precision of 0 (infinity) is now working correctly.

parent 082c2d76
......@@ -260,9 +260,15 @@ public class Paper {
}
public void setPrecision(int precision) {
evaluator.setCalculationMathContext(new MathContext(
Math.max(precision * 2, 4),
evaluator.getCalculationMathContext().getRoundingMode()));
if (precision <= 0) {
evaluator.setCalculationMathContext(new MathContext(
precision,
evaluator.getCalculationMathContext().getRoundingMode()));
} else {
evaluator.setCalculationMathContext(new MathContext(
Math.max(precision * 2, 4),
evaluator.getCalculationMathContext().getRoundingMode()));
}
evaluator.setResultMathContext(new MathContext(
precision,
evaluator.getResultMathContext().getRoundingMode()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment