Commit e61089e5 authored by Justin Klaassen's avatar Justin Klaassen
Browse files

Increase number of guard digits

Bug: 18544929

In order to decrease the visibility of floating point errors, maximize
the number of guard digits.

Change-Id: I5c12f4e7e00c4d3e3a281cc2383c3bb12c530e39
parent 0ba5a499
......@@ -22,8 +22,16 @@ import org.javia.arity.Util;
public class CalculatorExpressionEvaluator {
/**
* The maximum number of significant digits to display.
*/
private static final int MAX_DIGITS = 12;
private static final int ROUNDING_DIGITS = 2;
/**
* A {@link Double} has at least 17 significant digits, we show the first {@link #MAX_DIGITS}
* and use the remaining digits as guard digits to hide floating point precision errors.
*/
private static final int ROUNDING_DIGITS = Math.max(17 - MAX_DIGITS, 0);
private final Symbols mSymbols;
private final CalculatorExpressionTokenizer mTokenizer;
......
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