fixes
This commit is contained in:
1 parent
e617008930
commit
b90db6954e
4 files changed
+21
-21
No files matched your search
@@ -264,13 +264,13 @@ public class FunctionValue extends Value implements Fluff.ILazyFunction
|
||||
|
||||
public void assertArgsOk(List<?> list, Consumer<Boolean> feedback)
|
||||
{
|
||||
int size = list==null?0:list.size();
|
||||
if (varArgs == null && args.size() != size) // wrong number of args for fixed args
|
||||
int size = list.size();
|
||||
if (varArgs == null && args.size() != size) // wrong number of args for fixed args
|
||||
{
|
||||
feedback.accept(true);
|
||||
|
||||
}
|
||||
else if (varArgs != null && args.size() > size) // too few args for varargs
|
||||
else if (varArgs != null && args.size() > size) // too few args for varargs
|
||||
{
|
||||
feedback.accept(false);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ public class NumericValue extends Value
|
||||
{
|
||||
private final Double value;
|
||||
private Long longValue;
|
||||
final static double epsilon = 32*((7*0.1)*10-7);
|
||||
private final static double epsilon = 32*((7*0.1)*10-7);
|
||||
private final static MathContext displayRounding = new MathContext(12, RoundingMode.HALF_EVEN);
|
||||
|
||||
public static NumericValue asNumber(Value v1, String id)
|
||||
{
|
||||
@@ -49,7 +50,7 @@ public class NumericValue extends Value
|
||||
if (value.isInfinite()) return "INFINITY";
|
||||
if (value.isNaN()) return "NaN";
|
||||
// dobules have 16 point precision, 12 is plenty to display
|
||||
return BigDecimal.valueOf(value).round(new MathContext(12, RoundingMode.HALF_EVEN)).stripTrailingZeros().toPlainString();
|
||||
return BigDecimal.valueOf(value).round(displayRounding).stripTrailingZeros().toPlainString();
|
||||
}
|
||||
catch (NumberFormatException exc)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user