public static Number encode(double scalar, int maxExponent) {
return innerEncode(new BigDecimal(String.valueOf(scalar)),
getExponent(getDoublePrecExponent(scalar), maxExponent));</BUG>
}
<BUG>public static Number encode(double scalar, double precision) {
return innerEncode(new BigDecimal(String.valueOf(scalar)), getPrecExponent(precision));
}</BUG>
private static int getPrecExponent(double precision) {
return (int) Math.floor(Math.log(precision) / Math.log((double) BASE));
}

public static Number encode(double scalar, int maxExponent) {
if (Double.isInfinite(scalar) || Double.isNaN(scalar) || maxExponent < 0)
throw new EncodeException("Input value cannot be encoded.");
return innerEncode(new BigDecimal(scalar),
getExponent(getDoublePrecExponent(scalar), maxExponent));
}
public static Number encode(double scalar, double precision) {
if (Double.isInfinite(scalar) || Double.isNaN(scalar) || (precision > 1 && precision <= 0))
throw new EncodeException("Input value cannot be encoded.");
return innerEncode(new BigDecimal(scalar), getPrecExponent(precision));
}
private static int getPrecExponent(double precision) {
return (int) Math.floor(Math.log(precision) / Math.log((double) BASE));
}
